Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be the default perhaps?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most of the time this script will be used to update expectations in response for local emscripten changes (i.e. minor changes to JS libraries) not upstream llvm change. At least for me I often run rebases without clearing the cache when I know llvm has not changed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also makes it much slower if you clear the cache first, and when this script runs in CI it would never be needed (since CI libs are always built using tot anyway).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. lgtm either way.

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
Loading