Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 1 | #!/usr/bin/env python |
| 2 | |
| 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 |
| 5 | # found in the LICENSE file. |
| 6 | |
| 7 | """ |
| 8 | Verifies builds are the same even with different PYTHONHASHSEEDs. |
| 9 | Tests needed_variables. |
| 10 | """ |
| 11 | |
| 12 | import os |
| 13 | import sys |
| 14 | import TestGyp |
| 15 | |
| 16 | test = TestGyp.TestGyp() |
| 17 | if test.format == 'ninja': |
| 18 | os.environ["PYTHONHASHSEED"] = "1" |
| 19 | test.run_gyp('needed-variables.gyp') |
| 20 | base = open(test.built_file_path('test.ninja', subdir='obj')).read() |
| 21 | |
| 22 | for i in range(1,5): |
| 23 | os.environ["PYTHONHASHSEED"] = str(i) |
| 24 | test.run_gyp('needed-variables.gyp') |
| 25 | contents = open(test.built_file_path('test.ninja', subdir='obj')).read() |
| 26 | if base != contents: |
| 27 | test.fail_test() |
| 28 | |
| 29 | del os.environ["PYTHONHASHSEED"] |
| 30 | test.pass_test() |