OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Does one of the following depending on the --mode argument: | 6 """Does one of the following depending on the --mode argument: |
7 check Verifies all the inputs exist, touches the file specified with | 7 check Verifies all the inputs exist, touches the file specified with |
8 --result and exits. | 8 --result and exits. |
9 hashtable Puts a manifest file and hard links each of the inputs into the | 9 hashtable Puts a manifest file and hard links each of the inputs into the |
10 output directory. | 10 output directory. |
| 11 noop Do nothing, used for transition purposes. |
11 remap Stores all the inputs files in a directory without running the | 12 remap Stores all the inputs files in a directory without running the |
12 executable. | 13 executable. |
13 run Recreates a tree with all the inputs files and run the executable | 14 run Recreates a tree with all the inputs files and run the executable |
14 in it. | 15 in it. |
15 trace Runs the executable without remapping it but traces all the files | 16 trace Runs the executable without remapping it but traces all the files |
16 it and its child processes access. | 17 it and its child processes access. |
17 | 18 |
18 See more information at | 19 See more information at |
19 http://dev.chromium.org/developers/testing/isolated-testing | 20 http://dev.chromium.org/developers/testing/isolated-testing |
20 """ | 21 """ |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 logging.debug('processed infiles: %s' % infiles) | 512 logging.debug('processed infiles: %s' % infiles) |
512 return root_dir, infiles, data | 513 return root_dir, infiles, data |
513 | 514 |
514 | 515 |
515 def main(): | 516 def main(): |
516 default_variables = [('OS', trace_inputs.get_flavor())] | 517 default_variables = [('OS', trace_inputs.get_flavor())] |
517 if sys.platform in ('win32', 'cygwin'): | 518 if sys.platform in ('win32', 'cygwin'): |
518 default_variables.append(('EXECUTABLE_SUFFIX', '.exe')) | 519 default_variables.append(('EXECUTABLE_SUFFIX', '.exe')) |
519 else: | 520 else: |
520 default_variables.append(('EXECUTABLE_SUFFIX', '')) | 521 default_variables.append(('EXECUTABLE_SUFFIX', '')) |
521 valid_modes = get_valid_modes() | 522 valid_modes = get_valid_modes() + ['noop'] |
522 parser = optparse.OptionParser( | 523 parser = optparse.OptionParser( |
523 usage='%prog [options] [.isolate file]', | 524 usage='%prog [options] [.isolate file]', |
524 description=sys.modules[__name__].__doc__) | 525 description=sys.modules[__name__].__doc__) |
525 parser.format_description = lambda *_: parser.description | 526 parser.format_description = lambda *_: parser.description |
526 parser.add_option( | 527 parser.add_option( |
527 '-v', '--verbose', | 528 '-v', '--verbose', |
528 action='count', | 529 action='count', |
529 default=int(os.environ.get('ISOLATE_DEBUG', 0)), | 530 default=int(os.environ.get('ISOLATE_DEBUG', 0)), |
530 help='Use multiple times') | 531 help='Use multiple times') |
531 parser.add_option( | 532 parser.add_option( |
(...skipping 24 matching lines...) Expand all Loading... |
556 logging.basicConfig( | 557 logging.basicConfig( |
557 level=level, | 558 level=level, |
558 format='%(levelname)5s %(module)15s(%(lineno)3d): %(message)s') | 559 format='%(levelname)5s %(module)15s(%(lineno)3d): %(message)s') |
559 | 560 |
560 if not options.mode: | 561 if not options.mode: |
561 parser.error('--mode is required') | 562 parser.error('--mode is required') |
562 if len(args) != 1: | 563 if len(args) != 1: |
563 logging.debug('%s' % sys.argv) | 564 logging.debug('%s' % sys.argv) |
564 parser.error('Use only one argument which should be a .isolate file') | 565 parser.error('Use only one argument which should be a .isolate file') |
565 | 566 |
| 567 if options.mode == 'noop': |
| 568 # This undocumented mode is to help transition since some builders do not |
| 569 # have all the test data files checked out. Exit silently. |
| 570 return 0 |
| 571 |
566 root_dir, infiles, data = process_options( | 572 root_dir, infiles, data = process_options( |
567 dict(options.variables), options.result, args[0], parser.error) | 573 dict(options.variables), options.result, args[0], parser.error) |
568 | 574 |
569 try: | 575 try: |
570 resultcode, data = isolate( | 576 resultcode, data = isolate( |
571 options.outdir, | 577 options.outdir, |
572 options.mode, | 578 options.mode, |
573 root_dir, | 579 root_dir, |
574 infiles, | 580 infiles, |
575 data) | 581 data) |
576 except run_test_from_archive.MappingError, e: | 582 except run_test_from_archive.MappingError, e: |
577 print >> sys.stderr, str(e) | 583 print >> sys.stderr, str(e) |
578 return 1 | 584 return 1 |
579 save_results(options.result, data) | 585 save_results(options.result, data) |
580 return resultcode | 586 return resultcode |
581 | 587 |
582 | 588 |
583 if __name__ == '__main__': | 589 if __name__ == '__main__': |
584 sys.exit(main()) | 590 sys.exit(main()) |
OLD | NEW |