| 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 """Regenerates all the .isolated test data files. | 6 """Regenerates all the .isolated test data files. |
| 7 | 7 |
| 8 Keep in sync with ../run_isolated_smoke_test.py. | 8 Keep in sync with ../run_isolated_smoke_test.py. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import glob | 11 import glob |
| 12 import hashlib | 12 import hashlib |
| 13 import json | 13 import json |
| 14 import os | 14 import os |
| 15 import sys | 15 import sys |
| 16 | 16 |
| 17 ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) | 17 ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 18 | 18 |
| 19 | 19 |
| 20 # Ordering is important to keep this script simple. | 20 # Ordering is important to keep this script simple. |
| 21 INCLUDES_TO_FIX = [ | 21 INCLUDES_TO_FIX = [ |
| 22 ('manifest2.isolated', ['manifest1.isolated']), | 22 ('manifest2.isolated', ['manifest1.isolated']), |
| 23 ('check_files.isolated', ['gtest_fake.isolated', 'manifest2.isolated']), | 23 ('check_files.isolated', ['manifest2.isolated', 'repeated_files.isolated']), |
| 24 ] | 24 ] |
| 25 | 25 |
| 26 | 26 |
| 27 def sha1(filename): | 27 def sha1(filename): |
| 28 with open(filename, 'rb') as f: | 28 with open(filename, 'rb') as f: |
| 29 return hashlib.sha1(f.read()).hexdigest() | 29 return hashlib.sha1(f.read()).hexdigest() |
| 30 | 30 |
| 31 | 31 |
| 32 def load(filename): | 32 def load(filename): |
| 33 with open(filename, 'r') as f: | 33 with open(filename, 'r') as f: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 58 # Then update the SHA-1s. | 58 # Then update the SHA-1s. |
| 59 for manifest, includes in INCLUDES_TO_FIX: | 59 for manifest, includes in INCLUDES_TO_FIX: |
| 60 data = load(manifest) | 60 data = load(manifest) |
| 61 data['includes'] = [sha1(f) for f in includes] | 61 data['includes'] = [sha1(f) for f in includes] |
| 62 save(manifest, data) | 62 save(manifest, data) |
| 63 return 0 | 63 return 0 |
| 64 | 64 |
| 65 | 65 |
| 66 if __name__ == '__main__': | 66 if __name__ == '__main__': |
| 67 sys.exit(main()) | 67 sys.exit(main()) |
| OLD | NEW |