| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Runs all the native unit tests. | 7 """Runs all the native unit tests. |
| 8 | 8 |
| 9 1. Copy over test binary to /data/local on device. | 9 1. Copy over test binary to /data/local on device. |
| 10 2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak) | 10 2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 $ cat gtest_filter/base_unittests_disabled | 42 $ cat gtest_filter/base_unittests_disabled |
| 43 DataPackTest.Load | 43 DataPackTest.Load |
| 44 ReadOnlyFileUtilTest.ContentsEqual | 44 ReadOnlyFileUtilTest.ContentsEqual |
| 45 | 45 |
| 46 This file is generated by the tests running on devices. If running on emulator, | 46 This file is generated by the tests running on devices. If running on emulator, |
| 47 additonal filter file which lists the tests only failed in emulator will be | 47 additonal filter file which lists the tests only failed in emulator will be |
| 48 loaded. We don't care about the rare testcases which succeeded on emuatlor, but | 48 loaded. We don't care about the rare testcases which succeeded on emuatlor, but |
| 49 failed on device. | 49 failed on device. |
| 50 """ | 50 """ |
| 51 | 51 |
| 52 import copy |
| 52 import fnmatch | 53 import fnmatch |
| 53 import logging | 54 import logging |
| 54 import optparse | 55 import optparse |
| 55 import os | 56 import os |
| 56 import signal | 57 import signal |
| 57 import subprocess | 58 import subprocess |
| 58 import sys | 59 import sys |
| 59 import time | 60 import time |
| 60 | 61 |
| 61 from pylib import android_commands | 62 from pylib import android_commands |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 return 0 | 356 return 0 |
| 356 | 357 |
| 357 if options.use_xvfb: | 358 if options.use_xvfb: |
| 358 xvfb = Xvfb() | 359 xvfb = Xvfb() |
| 359 xvfb.Start() | 360 xvfb.Start() |
| 360 | 361 |
| 361 all_test_suites = FullyQualifiedTestSuites(options.exe, options.test_suite, | 362 all_test_suites = FullyQualifiedTestSuites(options.exe, options.test_suite, |
| 362 options.build_type) | 363 options.build_type) |
| 363 failures = 0 | 364 failures = 0 |
| 364 for suite in all_test_suites: | 365 for suite in all_test_suites: |
| 365 options.test_suite = suite | 366 # Give each test suite its own copy of options. |
| 366 failures += _RunATestSuite(options) | 367 test_options = copy.deepcopy(options) |
| 368 test_options.test_suite = suite |
| 369 failures += _RunATestSuite(test_options) |
| 367 | 370 |
| 368 if options.use_xvfb: | 371 if options.use_xvfb: |
| 369 xvfb.Stop() | 372 xvfb.Stop() |
| 370 return failures | 373 return failures |
| 371 | 374 |
| 372 | 375 |
| 373 def ListTestSuites(): | 376 def ListTestSuites(): |
| 374 """Display a list of available test suites.""" | 377 """Display a list of available test suites.""" |
| 375 print 'Available test suites are:' | 378 print 'Available test suites are:' |
| 376 for test_suite in _TEST_SUITES: | 379 for test_suite in _TEST_SUITES: |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 # the batch (this happens because the exit status is a sum of all failures | 446 # the batch (this happens because the exit status is a sum of all failures |
| 444 # from all suites, but the buildbot associates the exit status only with the | 447 # from all suites, but the buildbot associates the exit status only with the |
| 445 # most recent step). | 448 # most recent step). |
| 446 if options.exit_code: | 449 if options.exit_code: |
| 447 return failed_tests_count | 450 return failed_tests_count |
| 448 return 0 | 451 return 0 |
| 449 | 452 |
| 450 | 453 |
| 451 if __name__ == '__main__': | 454 if __name__ == '__main__': |
| 452 sys.exit(main(sys.argv)) | 455 sys.exit(main(sys.argv)) |
| OLD | NEW |