| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2012 Google Inc. All rights reserved. | 3 # Copyright (c) 2012 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 that when multiple values are supplied for a gyp define, the last one | 8 Verifies that when multiple values are supplied for a gyp define, the last one |
| 9 is used. | 9 is used. |
| 10 """ | 10 """ |
| 11 | 11 |
| 12 import os | 12 import os |
| 13 import TestGyp | 13 import TestGyp |
| 14 | 14 |
| 15 test = TestGyp.TestGyp() | 15 test = TestGyp.TestGyp() |
| 16 | 16 |
| 17 os.environ['GYP_DEFINES'] = 'key=value1 key=value2 key=value3' | 17 os.environ['GYP_DEFINES'] = 'key=value1 key=value2 key=value3' |
| 18 test.run_gyp('defines.gyp') | 18 test.run_gyp('defines.gyp') |
| 19 |
| 19 test.build('defines.gyp') | 20 test.build('defines.gyp') |
| 20 test.must_contain('action.txt', 'value3') | 21 test.must_contain('action.txt', 'value3') |
| 21 | 22 |
| 22 # The last occurrence of a repeated set should take precedence over other | 23 # The last occurrence of a repeated set should take precedence over other |
| 23 # values. | 24 # values. |
| 24 os.environ['GYP_DEFINES'] = 'key=repeated_value key=value1 key=repeated_value' | 25 os.environ['GYP_DEFINES'] = 'key=repeated_value key=value1 key=repeated_value' |
| 25 test.run_gyp('defines.gyp') | 26 test.run_gyp('defines.gyp') |
| 27 |
| 26 if test.format == 'msvs' and not test.uses_msbuild: | 28 if test.format == 'msvs' and not test.uses_msbuild: |
| 27 # msvs versions before 2010 don't detect build rule changes not reflected | 29 # msvs versions before 2010 don't detect build rule changes not reflected |
| 28 # in file system timestamps. Rebuild to see differences. | 30 # in file system timestamps. Rebuild to see differences. |
| 29 test.build('defines.gyp', rebuild=True) | 31 test.build('defines.gyp', rebuild=True) |
| 30 elif test.format == 'android': | 32 elif test.format == 'android': |
| 31 # The Android build system doesn't currently have a way to get files whose | 33 # The Android build system doesn't currently have a way to get files whose |
| 32 # build rules have changed (but whose timestamps haven't) to be rebuilt. | 34 # build rules have changed (but whose timestamps haven't) to be rebuilt. |
| 33 # See bug http://code.google.com/p/gyp/issues/detail?id=308 | 35 # See bug http://code.google.com/p/gyp/issues/detail?id=308 |
| 34 test.unlink('action.txt') | 36 test.unlink('action.txt') |
| 35 test.build('defines.gyp') | 37 test.build('defines.gyp') |
| 36 else: | 38 else: |
| 37 test.build('defines.gyp') | 39 test.build('defines.gyp') |
| 38 test.must_contain('action.txt', 'repeated_value') | 40 test.must_contain('action.txt', 'repeated_value') |
| 39 | 41 |
| 40 test.pass_test() | 42 test.pass_test() |
| OLD | NEW |