Merge pull request #13360 from ethereum/update-bugs-by-version-no-error-on-update

`update_bugs_by_version.py`: don't fail when the list gets updated
This commit is contained in:
Kamil Śliwak 2022-08-10 15:51:41 +02:00 committed by GitHub
commit 80f77dc1ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 15 deletions

View File

@ -6,20 +6,19 @@
# This makes it possible to use this script as part of CI to check # This makes it possible to use this script as part of CI to check
# that the list is up to date. # that the list is up to date.
import os
import json import json
import re import re
import sys from pathlib import Path
def comp(version_string): def comp(version_string):
return [int(c) for c in version_string.split('.')] return [int(c) for c in version_string.split('.')]
path = os.path.dirname(os.path.realpath(__file__)) root_path = Path(__file__).resolve().parent.parent
with open(path + '/../docs/bugs.json', encoding='utf8') as bugsFile:
bugs = json.load(bugsFile) bugs = json.loads((root_path / 'docs/bugs.json').read_text(encoding='utf8'))
versions = {} versions = {}
with open(path + '/../Changelog.md', encoding='utf8') as changelog: with (root_path / 'Changelog.md').open(encoding='utf8') as changelog:
for line in changelog: for line in changelog:
m = re.search(r'^### (\S+) \((\d+-\d+-\d+)\)$', line) m = re.search(r'^### (\S+) \((\d+-\d+-\d+)\)$', line)
if m: if m:
@ -35,9 +34,9 @@ for key, value in versions.items():
continue continue
value['bugs'] += [bug['name']] value['bugs'] += [bug['name']]
new_contents = json.dumps(versions, sort_keys=True, indent=4, separators=(',', ': ')) (root_path / 'docs/bugs_by_version.json').write_text(json.dumps(
with open(path + '/../docs/bugs_by_version.json', 'r', encoding='utf8') as bugs_by_version: versions,
old_contents = bugs_by_version.read() sort_keys=True,
with open(path + '/../docs/bugs_by_version.json', 'w', encoding='utf8') as bugs_by_version: indent=4,
bugs_by_version.write(new_contents) separators=(',', ': ')
sys.exit(old_contents != new_contents) ), encoding='utf8')

View File

@ -355,7 +355,7 @@ function test_via_ir_equivalence()
for yul_file in $(find . -name "${output_file_prefix}*.yul" | sort -V); do for yul_file in $(find . -name "${output_file_prefix}*.yul" | sort -V); do
bin_output_two_stage+=$( bin_output_two_stage+=$(
msg_on_error --no-stderr "$SOLC" --strict-assembly --bin "${optimizer_flags[@]}" "$yul_file" | msg_on_error --no-stderr "$SOLC" --strict-assembly --bin "${optimizer_flags[@]}" "$yul_file" |
sed '/^Binary representation:$/d' | sed '/^Binary representation:$/d' |
sed '/^=======/d' sed '/^=======/d'
) )
@ -375,8 +375,13 @@ function test_via_ir_equivalence()
## RUN ## RUN
echo "Checking that the bug list is up to date..." SOLTMPDIR=$(mktemp -d)
"$REPO_ROOT"/scripts/update_bugs_by_version.py printTask "Checking that the bug list is up to date..."
cp "${REPO_ROOT}/docs/bugs_by_version.json" "${SOLTMPDIR}/original_bugs_by_version.json"
"${REPO_ROOT}/scripts/update_bugs_by_version.py"
diff --unified "${SOLTMPDIR}/original_bugs_by_version.json" "${REPO_ROOT}/docs/bugs_by_version.json" || \
fail "The bug list in bugs_by_version.json was out of date and has been updated. Please investigate and submit a bugfix if necessary."
rm -r "$SOLTMPDIR"
printTask "Testing unknown options..." printTask "Testing unknown options..."
( (