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
# that the list is up to date.
import os
import json
import re
import sys
from pathlib import Path
def comp(version_string):
return [int(c) for c in version_string.split('.')]
path = os.path.dirname(os.path.realpath(__file__))
with open(path + '/../docs/bugs.json', encoding='utf8') as bugsFile:
bugs = json.load(bugsFile)
root_path = Path(__file__).resolve().parent.parent
bugs = json.loads((root_path / 'docs/bugs.json').read_text(encoding='utf8'))
versions = {}
with open(path + '/../Changelog.md', encoding='utf8') as changelog:
with (root_path / 'Changelog.md').open(encoding='utf8') as changelog:
for line in changelog:
m = re.search(r'^### (\S+) \((\d+-\d+-\d+)\)$', line)
if m:
@ -35,9 +34,9 @@ for key, value in versions.items():
continue
value['bugs'] += [bug['name']]
new_contents = json.dumps(versions, sort_keys=True, indent=4, separators=(',', ': '))
with open(path + '/../docs/bugs_by_version.json', 'r', encoding='utf8') as bugs_by_version:
old_contents = bugs_by_version.read()
with open(path + '/../docs/bugs_by_version.json', 'w', encoding='utf8') as bugs_by_version:
bugs_by_version.write(new_contents)
sys.exit(old_contents != new_contents)
(root_path / 'docs/bugs_by_version.json').write_text(json.dumps(
versions,
sort_keys=True,
indent=4,
separators=(',', ': ')
), 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
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 '/^=======/d'
)
@ -375,8 +375,13 @@ function test_via_ir_equivalence()
## RUN
echo "Checking that the bug list is up to date..."
"$REPO_ROOT"/scripts/update_bugs_by_version.py
SOLTMPDIR=$(mktemp -d)
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..."
(