| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/env python |
| 2 | |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 4 # 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 |
| 5 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 6 | 5 |
| 7 ''' Runs various chrome tests through asan_test.py. | 6 ''' Runs various chrome tests through asan_test.py. |
| 8 | 7 |
| 9 Most of this code is copied from ../valgrind/chrome_tests.py. | 8 Most of this code is copied from ../valgrind/chrome_tests.py. |
| 10 TODO(glider): put common functions to a standalone module. | 9 TODO(glider): put common functions to a standalone module. |
| 11 ''' | 10 ''' |
| 12 | 11 |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 f.close() | 408 f.close() |
| 410 except IOError, (errno, strerror): | 409 except IOError, (errno, strerror): |
| 411 logging.error("error writing to file %s (%d, %s)" % (chunk_file, errno, | 410 logging.error("error writing to file %s (%d, %s)" % (chunk_file, errno, |
| 412 strerror)) | 411 strerror)) |
| 413 | 412 |
| 414 # Since we're running small chunks of the layout tests, it's important to | 413 # Since we're running small chunks of the layout tests, it's important to |
| 415 # mark the ones that have errors in them. These won't be visible in the | 414 # mark the ones that have errors in them. These won't be visible in the |
| 416 # summary list for long, but will be useful for someone reviewing this bot. | 415 # summary list for long, but will be useful for someone reviewing this bot. |
| 417 return ret | 416 return ret |
| 418 | 417 |
| 419 def _main(_): | 418 |
| 419 def main(): |
| 420 if not sys.platform.startswith(('linux', 'darwin')): |
| 421 logging.error("AddressSanitizer works only on Linux and Mac OS " |
| 422 "at the moment.") |
| 423 return 1 |
| 420 parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> " | 424 parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> " |
| 421 "[-t <test> ...]") | 425 "[-t <test> ...]") |
| 422 parser.disable_interspersed_args() | 426 parser.disable_interspersed_args() |
| 423 parser.add_option("-b", "--build_dir", | 427 parser.add_option("-b", "--build_dir", |
| 424 help="the location of the output of the compiler output") | 428 help="the location of the output of the compiler output") |
| 425 parser.add_option("-t", "--test", action="append", | 429 parser.add_option("-t", "--test", action="append", |
| 426 help="which test to run") | 430 help="which test to run") |
| 427 parser.add_option("", "--gtest_filter", | 431 parser.add_option("", "--gtest_filter", |
| 428 help="additional arguments to --gtest_filter") | 432 help="additional arguments to --gtest_filter") |
| 429 parser.add_option("", "--gtest_repeat", | 433 parser.add_option("", "--gtest_repeat", |
| (...skipping 19 matching lines...) Expand all Loading... |
| 449 | 453 |
| 450 for t in options.test: | 454 for t in options.test: |
| 451 tests = ChromeTests(options, args, t) | 455 tests = ChromeTests(options, args, t) |
| 452 ret = tests.Run() | 456 ret = tests.Run() |
| 453 if ret: | 457 if ret: |
| 454 return ret | 458 return ret |
| 455 return 0 | 459 return 0 |
| 456 | 460 |
| 457 | 461 |
| 458 if __name__ == "__main__": | 462 if __name__ == "__main__": |
| 459 if sys.platform.startswith('linux'): | 463 sys.exit(main()) |
| 460 ret = _main(sys.argv) | |
| 461 elif sys.platform.startswith('darwin'): | |
| 462 ret = _main(sys.argv) | |
| 463 else: | |
| 464 logging.error("AddressSanitizer works only on Linux and Mac OS " | |
| 465 "at the moment.") | |
| 466 ret = 1 | |
| 467 sys.exit(ret) | |
| OLD | NEW |