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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 return out | 291 return out |
292 | 292 |
293 @classmethod | 293 @classmethod |
294 def load_file(cls, filename): | 294 def load_file(cls, filename): |
295 """Loads the data from a file or return an empty instance.""" | 295 """Loads the data from a file or return an empty instance.""" |
296 out = cls() | 296 out = cls() |
297 try: | 297 try: |
298 with open(filename, 'r') as f: | 298 with open(filename, 'r') as f: |
299 out = cls.load(json.load(f)) | 299 out = cls.load(json.load(f)) |
300 logging.debug('Loaded %s(%s)' % (cls.__name__, filename)) | 300 logging.debug('Loaded %s(%s)' % (cls.__name__, filename)) |
301 except IOError: | 301 except (IOError, ValueError): |
302 pass | 302 logging.warn('Failed to load %s' % filename) |
303 return out | 303 return out |
304 | 304 |
305 | 305 |
306 class Result(Flattenable): | 306 class Result(Flattenable): |
307 """Describes the content of a .result file. | 307 """Describes the content of a .result file. |
308 | 308 |
309 This file is used by run_test_from_archive.py so its content is strictly only | 309 This file is used by run_test_from_archive.py so its content is strictly only |
310 what is necessary to run the test outside of a checkout. | 310 what is necessary to run the test outside of a checkout. |
311 """ | 311 """ |
312 MEMBERS = ( | 312 MEMBERS = ( |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 result_file, | 748 result_file, |
749 input_file, | 749 input_file, |
750 options.mode, | 750 options.mode, |
751 variables, | 751 variables, |
752 out_dir, | 752 out_dir, |
753 parser.error) | 753 parser.error) |
754 | 754 |
755 | 755 |
756 if __name__ == '__main__': | 756 if __name__ == '__main__': |
757 sys.exit(main()) | 757 sys.exit(main()) |
OLD | NEW |