diff --git a/tools/maint/rebaseline_tests.py b/tools/maint/rebaseline_tests.py index ac00ee04b422f..09c9455acf278 100755 --- a/tools/maint/rebaseline_tests.py +++ b/tools/maint/rebaseline_tests.py @@ -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') @@ -91,6 +96,7 @@ def main(argv): The following ({len(filenames)}) test expectation files were updated by running the tests with `--rebaseline`: +``` ''' for file in filenames: @@ -98,7 +104,10 @@ def main(argv): 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)