Skip to content

Commit

Permalink
rebaseline_tests.py: Add --new-branch and --clear-cache. NFC (#23192)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 authored Dec 17, 2024
1 parent 2f97d04 commit 916b34e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tools/maint/rebaseline_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,13 @@ def process_changed_file(filename):
def main(argv):
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--skip-tests', action='store_true', help="don't actually run the tests, just analyze the existing results")
parser.add_argument('-b', '--new-branch', action='store_true', help='create a new branch containing the updates')
parser.add_argument('-c', '--clear-cache', action='store_true', help='clear the cache before rebaselining (useful when working with llvm changes)')
args = parser.parse_args()

if args.clear_cache:
run(['emcc', '--clear-cache'])

if not args.skip_tests:
if run(['git', 'status', '-uno', '--porcelain']).strip():
print('tree is not clean')
Expand All @@ -91,14 +96,18 @@ def main(argv):
The following ({len(filenames)}) test expectation files were updated by
running the tests with `--rebaseline`:
```
'''

for file in filenames:
commit_message += process_changed_file(file)

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

run(['git', 'checkout', '-b', 'rebaseline_tests'])
commit_message += '```\n'

if args.new_branch:
run(['git', 'checkout', '-b', 'rebaseline_tests'])
run(['git', 'add', '-u', '.'])
run(['git', 'commit', '-F', '-'], input=commit_message)

Expand Down

0 comments on commit 916b34e

Please sign in to comment.