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 heapcheck_test.py. | 6 ''' Runs various chrome tests through heapcheck_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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 f.close() | 409 f.close() |
411 except IOError, (errno, strerror): | 410 except IOError, (errno, strerror): |
412 logging.error("error writing to file %s (%d, %s)" % (chunk_file, errno, | 411 logging.error("error writing to file %s (%d, %s)" % (chunk_file, errno, |
413 strerror)) | 412 strerror)) |
414 | 413 |
415 # Since we're running small chunks of the layout tests, it's important to | 414 # Since we're running small chunks of the layout tests, it's important to |
416 # mark the ones that have errors in them. These won't be visible in the | 415 # mark the ones that have errors in them. These won't be visible in the |
417 # summary list for long, but will be useful for someone reviewing this bot. | 416 # summary list for long, but will be useful for someone reviewing this bot. |
418 return ret | 417 return ret |
419 | 418 |
420 def _main(_): | 419 |
| 420 def main(): |
| 421 if not sys.platform.startswith('linux'): |
| 422 logging.error("Heap checking works only on Linux at the moment.") |
| 423 return 1 |
421 parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> " | 424 parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> " |
422 "[-t <test> ...]") | 425 "[-t <test> ...]") |
423 parser.disable_interspersed_args() | 426 parser.disable_interspersed_args() |
424 parser.add_option("-b", "--build_dir", | 427 parser.add_option("-b", "--build_dir", |
425 help="the location of the output of the compiler output") | 428 help="the location of the output of the compiler output") |
426 parser.add_option("-t", "--test", action="append", | 429 parser.add_option("-t", "--test", action="append", |
427 help="which test to run") | 430 help="which test to run") |
428 parser.add_option("", "--gtest_filter", | 431 parser.add_option("", "--gtest_filter", |
429 help="additional arguments to --gtest_filter") | 432 help="additional arguments to --gtest_filter") |
430 parser.add_option("", "--gtest_repeat", | 433 parser.add_option("", "--gtest_repeat", |
(...skipping 19 matching lines...) Expand all Loading... |
450 | 453 |
451 for t in options.test: | 454 for t in options.test: |
452 tests = ChromeTests(options, args, t) | 455 tests = ChromeTests(options, args, t) |
453 ret = tests.Run() | 456 ret = tests.Run() |
454 if ret: | 457 if ret: |
455 return ret | 458 return ret |
456 return 0 | 459 return 0 |
457 | 460 |
458 | 461 |
459 if __name__ == "__main__": | 462 if __name__ == "__main__": |
460 if sys.platform.startswith('linux'): | 463 sys.exit(main()) |
461 ret = _main(sys.argv) | |
462 else: | |
463 logging.error("Heap checking works only on Linux at the moment.") | |
464 ret = 1 | |
465 sys.exit(ret) | |
OLD | NEW |