| OLD | NEW |
| 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 |
| 11 import os | 11 import os |
| 12 import struct | 12 import struct |
| 13 import sys | 13 import sys |
| 14 import time | 14 import time |
| 15 | 15 |
| 16 from infra.libs.infra_types import freeze | 16 from infra.libs.infra_types import freeze |
| 17 | 17 |
| 18 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | 18 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 19 | 19 |
| 20 | 20 |
| 21 # List of files that are known to be non deterministic. This is a "temporary" | 21 # List of files that are known to be non deterministic. This is a "temporary" |
| 22 # workaround to find regression on the deterministic builders. | 22 # workaround to find regression on the deterministic builders. |
| 23 # | 23 # |
| 24 # PNaCl general bug: http://crbug.com/429358 | 24 # PNaCl general bug: https://crbug.com/429358 |
| 25 # | 25 # |
| 26 # TODO(sebmarchand): Remove this once all the files are deterministic. | 26 # TODO(sebmarchand): Remove this once all the files are deterministic. |
| 27 WHITELIST = freeze({ | 27 WHITELIST = freeze({ |
| 28 # http://crbug.com/383340 | 28 # https://crbug.com/383340 |
| 29 'android': { | 29 'android': { |
| 30 'd8', | 30 'd8', |
| 31 'mksnapshot', | 31 'mksnapshot', |
| 32 }, | 32 }, |
| 33 | 33 |
| 34 # http://crbug.com/330263 | 34 # https://crbug.com/330263 |
| 35 'linux': { | 35 'linux': { |
| 36 # Completed. | 36 # Completed. |
| 37 }, | 37 }, |
| 38 | 38 |
| 39 # http://crbug.com/330262 | 39 # https://crbug.com/330262 |
| 40 'mac': { | 40 'mac': { |
| 41 'accessibility_unittests', | 41 'accessibility_unittests', |
| 42 'accessibility_unittests.isolated', | 42 'accessibility_unittests.isolated', |
| 43 'angle_unittests', | 43 'angle_unittests', |
| 44 'app_list_demo', | 44 'app_list_demo', |
| 45 'app_list_unittests', | 45 'app_list_unittests', |
| 46 'app_list_unittests.isolated', | 46 'app_list_unittests.isolated', |
| 47 'app_shell_unittests', | 47 'app_shell_unittests', |
| 48 'app_shell_unittests.isolated', | 48 'app_shell_unittests.isolated', |
| 49 'ar_sample_test_driver', | 49 'ar_sample_test_driver', |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 'views_examples_with_content_exe', | 308 'views_examples_with_content_exe', |
| 309 'views_unittests', | 309 'views_unittests', |
| 310 'webkit_unit_tests', | 310 'webkit_unit_tests', |
| 311 'wifi_test', | 311 'wifi_test', |
| 312 'wtf_unittests', | 312 'wtf_unittests', |
| 313 'xz', | 313 'xz', |
| 314 'xzdec', | 314 'xzdec', |
| 315 'yasm', | 315 'yasm', |
| 316 }, | 316 }, |
| 317 | 317 |
| 318 # http://crbug.com/330260 | 318 # https://crbug.com/330260 |
| 319 'win': { | 319 'win': { |
| 320 'accessibility_unittests.exe', | 320 'accessibility_unittests.exe', |
| 321 'accessibility_unittests.isolated', | 321 'accessibility_unittests.isolated', |
| 322 'angle_end2end_tests.exe', |
| 322 'angle_unittests.exe', | 323 'angle_unittests.exe', |
| 323 'app_list_demo.exe', | 324 'app_list_demo.exe', |
| 325 'app_list_unittests.exe', |
| 326 'app_list_unittests.isolated', |
| 327 'app_shell.exe', |
| 324 'app_shell_unittests.exe', | 328 'app_shell_unittests.exe', |
| 325 'app_shell_unittests.isolated', | 329 'app_shell_unittests.isolated', |
| 326 'app_shell.exe', | 330 'ar_sample_test_driver.exe', |
| 327 'ash_shell.exe', | 331 'ash_shell.exe', |
| 332 'ash_unittests.exe', |
| 328 'ash_unittests.isolated', | 333 'ash_unittests.isolated', |
| 329 'audio_unittests.exe', | 334 'audio_unittests.exe', |
| 330 'audio_unittests.isolated', | 335 'audio_unittests.isolated', |
| 336 'base_i18n_perftests.exe', |
| 337 'base_perftests.exe', |
| 331 'base_unittests.exe', | 338 'base_unittests.exe', |
| 332 'base_unittests.isolated', | 339 'base_unittests.isolated', |
| 333 'blink_heap_unittests.exe', | 340 'blink_heap_unittests.exe', |
| 334 'blink_platform_unittests.exe', | 341 'blink_platform_unittests.exe', |
| 335 'browser_tests.exe', | 342 'browser_tests.exe', |
| 336 'browser_tests.isolated', | 343 'browser_tests.isolated', |
| 337 'cast_unittests.exe', | 344 'cast_unittests.exe', |
| 338 'cast_unittests.isolated', | 345 'cast_unittests.isolated', |
| 339 'cc_blink_unittests.exe', | 346 'cc_blink_unittests.exe', |
| 340 'cc_perftests.exe', | 347 'cc_perftests.exe', |
| 341 'cc_unittests.exe', | 348 'cc_unittests.exe', |
| 342 'cc_unittests.isolated', | 349 'cc_unittests.isolated', |
| 343 'chrome_child.dll', | |
| 344 'chrome_watcher.dll', | |
| 345 'chrome.dll', | 350 'chrome.dll', |
| 346 'chrome.exe', | 351 'chrome.exe', |
| 347 'chrome.isolated', | 352 'chrome.isolated', |
| 353 'chrome_child.dll', |
| 354 'chrome_elf_unittests.exe', |
| 355 'chrome_watcher.dll', |
| 356 'chromedriver.exe', |
| 357 'chromedriver_tests.exe', |
| 358 'chromoting_test_driver.exe', |
| 348 'clearkeycdm.dll', | 359 'clearkeycdm.dll', |
| 360 'cloud_print_service.exe', |
| 361 'cloud_print_service_config.exe', |
| 362 'cloud_print_unittests.exe', |
| 349 'components_browsertests.exe', | 363 'components_browsertests.exe', |
| 350 'components_browsertests.isolated', | 364 'components_browsertests.isolated', |
| 351 'components_unittests.exe', | 365 'components_unittests.exe', |
| 352 'components_unittests.isolated', | 366 'components_unittests.isolated', |
| 353 'compositor_unittests.exe', | 367 'compositor_unittests.exe', |
| 354 'compositor_unittests.isolated', | 368 'compositor_unittests.isolated', |
| 355 'content_browsertests.exe', | 369 'content_browsertests.exe', |
| 356 'content_browsertests.isolated', | 370 'content_browsertests.isolated', |
| 357 'content_gl_benchmark.exe', | 371 'content_gl_benchmark.exe', |
| 358 'content_gl_tests.exe', | 372 'content_gl_tests.exe', |
| 359 'content_perftests.exe', | 373 'content_perftests.exe', |
| 360 'content_shell.exe', | 374 'content_shell.exe', |
| 361 'content_unittests.exe', | 375 'content_unittests.exe', |
| 362 'content_unittests.isolated', | 376 'content_unittests.isolated', |
| 363 'courgette64.exe', | 377 'courgette64.exe', |
| 364 'crash_service64.exe', | 378 'crash_service64.exe', |
| 379 'crypto_unittests.exe', |
| 365 'crypto_unittests.isolated', | 380 'crypto_unittests.isolated', |
| 366 'd8.exe', | 381 'd8.exe', |
| 382 'delegate_execute.exe', |
| 367 'delegate_execute_unittests.exe', | 383 'delegate_execute_unittests.exe', |
| 368 'delegate_execute.exe', | |
| 369 'device_unittests.exe', | 384 'device_unittests.exe', |
| 370 'device_unittests.isolated', | 385 'device_unittests.isolated', |
| 371 'events_unittests.exe', | 386 'events_unittests.exe', |
| 372 'events_unittests.isolated', | 387 'events_unittests.isolated', |
| 373 'extensions_browsertests.exe', | 388 'extensions_browsertests.exe', |
| 374 'extensions_browsertests.isolated', | 389 'extensions_browsertests.isolated', |
| 375 'extensions_unittests.exe', | 390 'extensions_unittests.exe', |
| 376 'extensions_unittests.isolated', | 391 'extensions_unittests.isolated', |
| 377 'gcm_unit_tests.exe', | 392 'gcm_unit_tests.exe', |
| 378 'gcm_unit_tests.isolated', | 393 'gcm_unit_tests.isolated', |
| 394 'gcp20_device.exe', |
| 395 'gcp20_device_unittests.exe', |
| 379 'gcp_portmon64.dll', | 396 'gcp_portmon64.dll', |
| 397 'get_server_time.exe', |
| 380 'gfx_unittests.exe', | 398 'gfx_unittests.exe', |
| 381 'gin_shell.exe', | 399 'gin_shell.exe', |
| 382 'gin_unittests.exe', | 400 'gin_unittests.exe', |
| 383 'gl_unittests.exe', | 401 'gl_unittests.exe', |
| 384 'gl_unittests.isolated', | 402 'gl_unittests.isolated', |
| 385 'google_apis_unittests.exe', | 403 'google_apis_unittests.exe', |
| 386 'google_apis_unittests.isolated', | 404 'google_apis_unittests.isolated', |
| 405 'gpu_perftests.exe', |
| 387 'gpu_unittests.exe', | 406 'gpu_unittests.exe', |
| 388 'gpu_unittests.isolated', | 407 'gpu_unittests.isolated', |
| 389 'interactive_ui_tests.exe', | 408 'interactive_ui_tests.exe', |
| 390 'interactive_ui_tests.isolated', | 409 'interactive_ui_tests.isolated', |
| 391 'ipc_mojo_perftests.exe', | 410 'ipc_mojo_perftests.exe', |
| 392 'ipc_mojo_unittests.exe', | 411 'ipc_mojo_unittests.exe', |
| 393 'ipc_perftests.exe', | 412 'ipc_perftests.exe', |
| 413 'ipc_tests.exe', |
| 414 'ipc_tests.isolated', |
| 394 'jingle_unittests.exe', | 415 'jingle_unittests.exe', |
| 395 'jingle_unittests.isolated', | 416 'jingle_unittests.isolated', |
| 417 'keyboard_unittests.exe', |
| 396 'libaddressinput_unittests.exe', | 418 'libaddressinput_unittests.exe', |
| 397 'media_unittests.exe', | 419 'media_unittests.exe', |
| 398 'media_unittests.isolated', | 420 'media_unittests.isolated', |
| 399 'metro_driver.dll', | 421 'metro_driver.dll', |
| 400 'midi_unittests.exe', | 422 'midi_unittests.exe', |
| 401 'midi_unittests.isolated', | 423 'midi_unittests.isolated', |
| 402 'mini_installer.exe', | 424 'mini_installer.exe', |
| 403 'mksnapshot.exe', | 425 'mksnapshot.exe', |
| 404 'mock_nacl_gdb.exe', | 426 'mock_nacl_gdb.exe', |
| 405 'mojo_js_integration_tests.exe', | 427 'mojo_js_integration_tests.exe', |
| 406 'mojo_js_unittests.exe', | 428 'mojo_js_unittests.exe', |
| 429 'mojo_message_pipe_perftests.exe', |
| 430 'mojo_public_bindings_perftests.exe', |
| 431 'mojo_public_bindings_unittests.exe', |
| 432 'mojo_public_bindings_unittests.isolated', |
| 433 'mojo_public_environment_unittests.exe', |
| 434 'mojo_public_environment_unittests.isolated', |
| 435 'mojo_public_system_perftests.exe', |
| 436 'mojo_public_system_unittests.exe', |
| 437 'mojo_public_system_unittests.isolated', |
| 438 'mojo_public_utility_unittests.exe', |
| 439 'mojo_public_utility_unittests.isolated', |
| 440 'mojo_system_unittests.exe', |
| 441 'nacl_loader_unittests.exe', |
| 442 'nacl_loader_unittests.isolated', |
| 407 'net_perftests.exe', | 443 'net_perftests.exe', |
| 408 'net_unittests.exe', | 444 'net_unittests.exe', |
| 409 'net_unittests.isolated', | 445 'net_unittests.isolated', |
| 410 'np_test_netscape_plugin.dll', | 446 'np_test_netscape_plugin.dll', |
| 411 'npapi_test_plugin.dll', | 447 'npapi_test_plugin.dll', |
| 448 'pdfium_test.exe', |
| 412 'peerconnection_server.exe', | 449 'peerconnection_server.exe', |
| 413 'performance_browser_tests.exe', | 450 'performance_browser_tests.exe', |
| 451 'ppapi_perftests.exe', |
| 414 'ppapi_unittests.exe', | 452 'ppapi_unittests.exe', |
| 453 'printing_unittests.exe', |
| 454 'printing_unittests.isolated', |
| 415 'remoting_core.dll', | 455 'remoting_core.dll', |
| 456 'remoting_start_host.exe', |
| 457 'remoting_unittests.exe', |
| 458 'remoting_unittests.isolated', |
| 416 'sbox_integration_tests.isolated', | 459 'sbox_integration_tests.isolated', |
| 460 'setup_unittests.exe', |
| 461 'setup_unittests.isolated', |
| 462 'skia_unittests.exe', |
| 417 'skia_unittests.isolated', | 463 'skia_unittests.isolated', |
| 418 'sql_unittests.exe', | 464 'sql_unittests.exe', |
| 419 'sql_unittests.isolated', | 465 'sql_unittests.isolated', |
| 466 'sync_client.exe', |
| 420 'sync_integration_tests.exe', | 467 'sync_integration_tests.exe', |
| 421 'sync_integration_tests.isolated', | 468 'sync_integration_tests.isolated', |
| 422 'sync_performance_tests.exe', | 469 'sync_performance_tests.exe', |
| 423 'sync_unit_tests.exe', | 470 'sync_unit_tests.exe', |
| 424 'sync_unit_tests.isolated', | 471 'sync_unit_tests.isolated', |
| 425 'test_registrar.exe', | 472 'test_registrar.exe', |
| 426 'ui_base_unittests.exe', | 473 'ui_base_unittests.exe', |
| 427 'unit_tests.exe', | 474 'unit_tests.exe', |
| 428 'unit_tests.isolated', | 475 'unit_tests.isolated', |
| 429 'url_unittests.exe', | 476 'url_unittests.exe', |
| 430 'url_unittests.isolated', | 477 'url_unittests.isolated', |
| 431 'views_examples_with_content_exe.exe', | 478 'views_examples_with_content_exe.exe', |
| 432 'views_unittests.exe', | 479 'views_unittests.exe', |
| 433 'webkit_unit_tests.exe', | 480 'webkit_unit_tests.exe', |
| 481 'wtf_unittests.exe', |
| 434 }, | 482 }, |
| 435 }) | 483 }) |
| 436 | 484 |
| 437 def get_files_to_compare(build_dir, recursive=False): | 485 def get_files_to_compare(build_dir, recursive=False): |
| 438 """Get the list of files to compare.""" | 486 """Get the list of files to compare.""" |
| 439 allowed = frozenset( | 487 allowed = frozenset( |
| 440 ('', '.apk', '.app', '.dll', '.dylib', '.exe', '.nexe', '.so')) | 488 ('', '.apk', '.app', '.dll', '.dylib', '.exe', '.nexe', '.so')) |
| 441 non_x_ok_exts = frozenset(('.apk', '.isolated')) | 489 non_x_ok_exts = frozenset(('.apk', '.isolated')) |
| 442 def check(f): | 490 def check(f): |
| 443 if not os.path.isfile(f): | 491 if not os.path.isfile(f): |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 result = 'DIFFERENT (%s): %s' % (tag, result) | 642 result = 'DIFFERENT (%s): %s' % (tag, result) |
| 595 print('%-*s: %s' % (max_filepath_len, f, result)) | 643 print('%-*s: %s' % (max_filepath_len, f, result)) |
| 596 unexpected_diffs.sort() | 644 unexpected_diffs.sort() |
| 597 | 645 |
| 598 print('Equals: %d' % len(equals)) | 646 print('Equals: %d' % len(equals)) |
| 599 print('Expected diffs: %d' % len(expected_diffs)) | 647 print('Expected diffs: %d' % len(expected_diffs)) |
| 600 print('Unexpected diffs: %d' % len(unexpected_diffs)) | 648 print('Unexpected diffs: %d' % len(unexpected_diffs)) |
| 601 if unexpected_diffs: | 649 if unexpected_diffs: |
| 602 print('Unexpected files with diffs:\n') | 650 print('Unexpected files with diffs:\n') |
| 603 for u in unexpected_diffs: | 651 for u in unexpected_diffs: |
| 604 print(' %s\n' % u) | 652 print(' %s' % u) |
| 605 if unexpected_equals: | 653 if unexpected_equals: |
| 606 print('Unexpected files with no diffs:\n') | 654 print('Unexpected files with no diffs:\n') |
| 607 for u in unexpected_equals: | 655 for u in unexpected_equals: |
| 608 print(' %s\n' % u) | 656 print(' %s' % u) |
| 609 | 657 |
| 610 return int(bool(unexpected_diffs)) | 658 return int(bool(unexpected_diffs)) |
| 611 | 659 |
| 612 | 660 |
| 613 def main(): | 661 def main(): |
| 614 parser = optparse.OptionParser(usage='%prog [options]') | 662 parser = optparse.OptionParser(usage='%prog [options]') |
| 615 parser.add_option( | 663 parser.add_option( |
| 616 '-f', '--first-build-dir', help='The first build directory.') | 664 '-f', '--first-build-dir', help='The first build directory.') |
| 617 parser.add_option( | 665 parser.add_option( |
| 618 '-s', '--second-build-dir', help='The second build directory.') | 666 '-s', '--second-build-dir', help='The second build directory.') |
| (...skipping 10 matching lines...) Expand all Loading... |
| 629 parser.error('--target-platform is required') | 677 parser.error('--target-platform is required') |
| 630 | 678 |
| 631 return compare_build_artifacts(os.path.abspath(options.first_build_dir), | 679 return compare_build_artifacts(os.path.abspath(options.first_build_dir), |
| 632 os.path.abspath(options.second_build_dir), | 680 os.path.abspath(options.second_build_dir), |
| 633 options.target_platform, | 681 options.target_platform, |
| 634 options.recursive) | 682 options.recursive) |
| 635 | 683 |
| 636 | 684 |
| 637 if __name__ == '__main__': | 685 if __name__ == '__main__': |
| 638 sys.exit(main()) | 686 sys.exit(main()) |
| OLD | NEW |