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. |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 # 'C:\' and state.root_dir on another one like 'D:\'. | 578 # 'C:\' and state.root_dir on another one like 'D:\'. |
579 product_dir = None | 579 product_dir = None |
580 if not state.result.command: | 580 if not state.result.command: |
581 print 'No command to run' | 581 print 'No command to run' |
582 return 1 | 582 return 1 |
583 api = trace_inputs.get_api() | 583 api = trace_inputs.get_api() |
584 logfile = state.result_file + '.log' | 584 logfile = state.result_file + '.log' |
585 try: | 585 try: |
586 result = 0 | 586 result = 0 |
587 if not os.path.isfile(logfile): | 587 if not os.path.isfile(logfile): |
588 result, _ = api.get_tracer().trace( | 588 with api.get_tracer(logfile) as tracer: |
589 state.result.command, | 589 result, _ = tracer.trace( |
590 os.path.join(state.root_dir, state.result.relative_cwd), | 590 state.result.command, |
591 logfile, | 591 os.path.join(state.root_dir, state.result.relative_cwd), |
592 True) | 592 'default', |
| 593 True) |
593 | 594 |
594 results = trace_inputs.load_trace(logfile, state.root_dir, api) | 595 results = trace_inputs.load_trace(logfile, state.root_dir, api) |
595 simplified = trace_inputs.extract_directories(state.root_dir, results.files) | 596 simplified = trace_inputs.extract_directories(state.root_dir, results.files) |
596 variables = isolate_common.generate_dict( | 597 variables = isolate_common.generate_dict( |
597 (f.path for f in simplified), | 598 (f.path for f in simplified), |
598 state.result.relative_cwd, | 599 state.result.relative_cwd, |
599 product_dir) | 600 product_dir) |
600 # Outputs in a way that is easy to merge with merge_isolate.py. | 601 # Outputs in a way that is easy to merge with merge_isolate.py. |
601 value = { | 602 value = { |
602 'conditions': [ | 603 'conditions': [ |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 result_file, | 766 result_file, |
766 input_file, | 767 input_file, |
767 options.mode, | 768 options.mode, |
768 variables, | 769 variables, |
769 out_dir, | 770 out_dir, |
770 parser.error) | 771 parser.error) |
771 | 772 |
772 | 773 |
773 if __name__ == '__main__': | 774 if __name__ == '__main__': |
774 sys.exit(main()) | 775 sys.exit(main()) |
OLD | NEW |