| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2015 Google Inc. All rights reserved. | 3 # Copyright (c) 2015 Google Inc. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """ | 7 """ |
| 8 Verifies builds are the same even with different PYTHONHASHSEEDs. | 8 Verifies builds are the same even with different PYTHONHASHSEEDs. |
| 9 Tests all_targets, implicit_deps and solibs. | 9 Tests all_targets, implicit_deps and solibs. |
| 10 """ | 10 """ |
| 11 | 11 |
| 12 from __future__ import print_function |
| 13 |
| 12 import os | 14 import os |
| 13 import sys | 15 import sys |
| 14 import TestGyp | 16 import TestGyp |
| 15 | 17 |
| 16 test = TestGyp.TestGyp() | 18 test = TestGyp.TestGyp() |
| 17 if test.format == 'ninja': | 19 if test.format == 'ninja': |
| 18 os.environ["PYTHONHASHSEED"] = "1" | 20 os.environ["PYTHONHASHSEED"] = "1" |
| 19 test.run_gyp('solibs.gyp') | 21 test.run_gyp('solibs.gyp') |
| 20 base1 = open(test.built_file_path('c.ninja', subdir='obj')).read() | 22 base1 = open(test.built_file_path('c.ninja', subdir='obj')).read() |
| 21 base2 = open(test.built_file_path('build.ninja')).read() | 23 base2 = open(test.built_file_path('build.ninja')).read() |
| 22 | 24 |
| 23 for i in range(1,5): | 25 for i in range(1,5): |
| 24 os.environ["PYTHONHASHSEED"] = str(i) | 26 os.environ["PYTHONHASHSEED"] = str(i) |
| 25 test.run_gyp('solibs.gyp') | 27 test.run_gyp('solibs.gyp') |
| 26 contents1 = open(test.built_file_path('c.ninja', subdir='obj')).read() | 28 contents1 = open(test.built_file_path('c.ninja', subdir='obj')).read() |
| 27 contents2 = open(test.built_file_path('build.ninja')).read() | 29 contents2 = open(test.built_file_path('build.ninja')).read() |
| 28 if base1 != contents1: | 30 if base1 != contents1: |
| 29 test.fail_test() | 31 test.fail_test() |
| 30 if base2 != contents2: | 32 if base2 != contents2: |
| 31 print base2 | 33 print(base2) |
| 32 test.fail_test() | 34 test.fail_test() |
| 33 | 35 |
| 34 del os.environ["PYTHONHASHSEED"] | 36 del os.environ["PYTHONHASHSEED"] |
| 35 test.pass_test() | 37 test.pass_test() |
| OLD | NEW |