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

Side by Side Diff: tools/determinism/compare_build_artifacts.py

Issue 2303063003: Skip COFF timestamp difference. (Closed)
Patch Set: skip only if windows. Created 4 years, 3 months 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 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 """Compare the artifacts from two builds.""" 6 """Compare the artifacts from two builds."""
7 7
8 import difflib 8 import difflib
9 import json 9 import json
10 import optparse 10 import optparse
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 if os.path.isabs(path): 536 if os.path.isabs(path):
537 print >> sys.stderr, ('not support abs path %s used for target %s' 537 print >> sys.stderr, ('not support abs path %s used for target %s'
538 % (path, target)) 538 % (path, target))
539 continue 539 continue
540 files.append(path) 540 files.append(path)
541 return files 541 return files
542 542
543 543
544 def compare_deps(first_dir, second_dir, targets): 544 def compare_deps(first_dir, second_dir, targets):
545 """Print difference of dependent files.""" 545 """Print difference of dependent files."""
546 COFF_TIMESTAMP_DIFF_PATTERN = re.compile(r'[1-3] out of ')
546 for target in targets: 547 for target in targets:
547 first_deps = get_deps(first_dir, target) 548 first_deps = get_deps(first_dir, target)
548 second_deps = get_deps(second_dir, target) 549 second_deps = get_deps(second_dir, target)
549 print 'Checking %s difference: (%s deps)' % (target, len(first_deps)) 550 print 'Checking %s difference: (%s deps)' % (target, len(first_deps))
550 if set(first_deps) != set(second_deps): 551 if set(first_deps) != set(second_deps):
551 # Since we do not thiks this case occur, we do not do anything special 552 # Since we do not thiks this case occur, we do not do anything special
552 # for this case. 553 # for this case.
553 print 'deps on %s are different: %s' % ( 554 print 'deps on %s are different: %s' % (
554 target, set(first_deps).symmetric_difference(set(second_deps))) 555 target, set(first_deps).symmetric_difference(set(second_deps)))
555 continue 556 continue
556 max_filepath_len = max(len(n) for n in first_deps) 557 max_filepath_len = max(len(n) for n in first_deps)
557 for d in first_deps: 558 for d in first_deps:
558 first_file = os.path.join(first_dir, d) 559 first_file = os.path.join(first_dir, d)
559 second_file = os.path.join(second_dir, d) 560 second_file = os.path.join(second_dir, d)
560 result = compare_files(first_file, second_file) 561 result = compare_files(first_file, second_file)
561 if result: 562 if result:
562 print('%-*s: %s' % (max_filepath_len, d, result)) 563 if (sys.platform == 'win32' and
M-A Ruel 2016/09/02 16:30:26 This code belongs to binary_diff(); should passlis
Yoshisato Yanagisawa 2016/09/05 02:44:25 I cannot catch what you mean exactly but I guess y
564 COFF_TIMESTAMP_DIFF_PATTERN.match(result)):
565 continue
566 print(' %-*s: %s' % (max_filepath_len, d, result))
563 567
564 568
565 def compare_build_artifacts(first_dir, second_dir, target_platform, 569 def compare_build_artifacts(first_dir, second_dir, target_platform,
566 recursive=False): 570 recursive=False):
567 """Compares the artifacts from two distinct builds.""" 571 """Compares the artifacts from two distinct builds."""
568 if not os.path.isdir(first_dir): 572 if not os.path.isdir(first_dir):
569 print >> sys.stderr, '%s isn\'t a valid directory.' % first_dir 573 print >> sys.stderr, '%s isn\'t a valid directory.' % first_dir
570 return 1 574 return 1
571 if not os.path.isdir(second_dir): 575 if not os.path.isdir(second_dir):
572 print >> sys.stderr, '%s isn\'t a valid directory.' % second_dir 576 print >> sys.stderr, '%s isn\'t a valid directory.' % second_dir
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 parser.error('--target-platform is required') 662 parser.error('--target-platform is required')
659 663
660 return compare_build_artifacts(os.path.abspath(options.first_build_dir), 664 return compare_build_artifacts(os.path.abspath(options.first_build_dir),
661 os.path.abspath(options.second_build_dir), 665 os.path.abspath(options.second_build_dir),
662 options.target_platform, 666 options.target_platform,
663 options.recursive) 667 options.recursive)
664 668
665 669
666 if __name__ == '__main__': 670 if __name__ == '__main__':
667 sys.exit(main()) 671 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