Skip to content

Commit e974058

Browse files
sbc100hedwigz
authored andcommitted
rebaseline_tests.py: Add --new-branch and --clear-cache. NFC (emscripten-core#23192)
1 parent b80de20 commit e974058

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tools/maint/rebaseline_tests.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,13 @@ def process_changed_file(filename):
6464
def main(argv):
6565
parser = argparse.ArgumentParser()
6666
parser.add_argument('-s', '--skip-tests', action='store_true', help="don't actually run the tests, just analyze the existing results")
67+
parser.add_argument('-b', '--new-branch', action='store_true', help='create a new branch containing the updates')
68+
parser.add_argument('-c', '--clear-cache', action='store_true', help='clear the cache before rebaselining (useful when working with llvm changes)')
6769
args = parser.parse_args()
6870

71+
if args.clear_cache:
72+
run(['emcc', '--clear-cache'])
73+
6974
if not args.skip_tests:
7075
if run(['git', 'status', '-uno', '--porcelain']).strip():
7176
print('tree is not clean')
@@ -91,14 +96,18 @@ def main(argv):
9196
The following ({len(filenames)}) test expectation files were updated by
9297
running the tests with `--rebaseline`:
9398
99+
```
94100
'''
95101

96102
for file in filenames:
97103
commit_message += process_changed_file(file)
98104

99105
commit_message += f'\nAverage change: {statistics.mean(all_deltas):+.2f}% ({min(all_deltas):+.2f}% - {max(all_deltas):+.2f}%)\n'
100106

101-
run(['git', 'checkout', '-b', 'rebaseline_tests'])
107+
commit_message += '```\n'
108+
109+
if args.new_branch:
110+
run(['git', 'checkout', '-b', 'rebaseline_tests'])
102111
run(['git', 'add', '-u', '.'])
103112
run(['git', 'commit', '-F', '-'], input=commit_message)
104113

0 commit comments

Comments
 (0)