Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: tools/perf/generate_perf_json.py

Issue 2519803002: Make generate_perf_json.py work regardless of starting working directory (Closed)
Patch Set: Simplify Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Script to generate chromium.perf.json and chromium.perf.fyi.json in 6 """Script to generate chromium.perf.json and chromium.perf.fyi.json in
7 the src/testing/buildbot directory. Maintaining these files by hand is 7 the src/testing/buildbot directory. Maintaining these files by hand is
8 too unwieldy. 8 too unwieldy.
9 """ 9 """
10 10
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 'rasterize_and_record_micro_ct', 520 'rasterize_and_record_micro_ct',
521 'repaint_ct', 521 'repaint_ct',
522 'multipage_skpicture_printer', 522 'multipage_skpicture_printer',
523 'multipage_skpicture_printer_ct', 523 'multipage_skpicture_printer_ct',
524 'skpicture_printer', 524 'skpicture_printer',
525 'skpicture_printer_ct', 525 'skpicture_printer_ct',
526 ] 526 ]
527 527
528 528
529 def current_benchmarks(use_whitelist): 529 def current_benchmarks(use_whitelist):
530 current_dir = os.path.dirname(__file__) 530 benchmarks_dir = os.path.join(os.getcwd(), 'benchmarks')
531 benchmarks_dir = os.path.join(current_dir, 'benchmarks')
532 top_level_dir = os.path.dirname(benchmarks_dir) 531 top_level_dir = os.path.dirname(benchmarks_dir)
533 532
534 all_benchmarks = discover.DiscoverClasses( 533 all_benchmarks = discover.DiscoverClasses(
535 benchmarks_dir, top_level_dir, benchmark_module.Benchmark, 534 benchmarks_dir, top_level_dir, benchmark_module.Benchmark,
536 index_by_class_name=True).values() 535 index_by_class_name=True).values()
537 # Remove all blacklisted benchmarks 536 # Remove all blacklisted benchmarks
538 for blacklisted in BENCHMARK_NAME_BLACKLIST: 537 for blacklisted in BENCHMARK_NAME_BLACKLIST:
539 for benchmark in all_benchmarks: 538 for benchmark in all_benchmarks:
540 if benchmark.Name() == blacklisted: 539 if benchmark.Name() == blacklisted:
541 all_benchmarks.remove(benchmark) 540 all_benchmarks.remove(benchmark)
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 scripts = generate_script_tests(waterfall['name'], name, shard + 1) 641 scripts = generate_script_tests(waterfall['name'], name, shard + 1)
643 if scripts: 642 if scripts:
644 tests[tester_name] = { 643 tests[tester_name] = {
645 'scripts': sorted(scripts, key=lambda x: x['name']) 644 'scripts': sorted(scripts, key=lambda x: x['name'])
646 } 645 }
647 646
648 tests['AAAAA1 AUTOGENERATED FILE DO NOT EDIT'] = {} 647 tests['AAAAA1 AUTOGENERATED FILE DO NOT EDIT'] = {}
649 tests['AAAAA2 See //tools/perf/generate_perf_json.py to make changes'] = {} 648 tests['AAAAA2 See //tools/perf/generate_perf_json.py to make changes'] = {}
650 filename = '%s.json' % waterfall['name'] 649 filename = '%s.json' % waterfall['name']
651 650
652 current_dir = os.path.dirname(os.path.abspath(__file__)) 651 src_dir = os.path.dirname(os.path.dirname(os.getcwd()))
653 src_dir = os.path.dirname(os.path.dirname(current_dir))
654 652
655 with open(os.path.join(src_dir, 'testing', 'buildbot', filename), 'w') as fp: 653 with open(os.path.join(src_dir, 'testing', 'buildbot', filename), 'w') as fp:
656 json.dump(tests, fp, indent=2, separators=(',', ': '), sort_keys=True) 654 json.dump(tests, fp, indent=2, separators=(',', ': '), sort_keys=True)
657 fp.write('\n') 655 fp.write('\n')
658 656
657 def chdir_to_parent_directory():
658 parent_directory = os.path.dirname(os.path.abspath(__file__))
659 os.chdir(parent_directory)
659 660
660 def main(): 661 def main():
662 chdir_to_parent_directory()
663
661 waterfall = get_waterfall_config() 664 waterfall = get_waterfall_config()
662 waterfall['name'] = 'chromium.perf' 665 waterfall['name'] = 'chromium.perf'
663 fyi_waterfall = get_fyi_waterfall_config() 666 fyi_waterfall = get_fyi_waterfall_config()
664 fyi_waterfall['name'] = 'chromium.perf.fyi' 667 fyi_waterfall['name'] = 'chromium.perf.fyi'
665 668
666 generate_all_tests(fyi_waterfall) 669 generate_all_tests(fyi_waterfall)
667 generate_all_tests(waterfall) 670 generate_all_tests(waterfall)
668 return 0 671 return 0
669 672
670 if __name__ == '__main__': 673 if __name__ == '__main__':
671 sys.exit(main()) 674 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698