| 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 the use of the environment during regeneration when the gyp file | 8 Verifies the use of the environment during regeneration when the gyp file |
| 9 changes, specifically via build of an executable with C++ flags specified by | 9 changes, specifically via build of an executable with C++ flags specified by |
| 10 CXXFLAGS. | 10 CXXFLAGS. |
| 11 | 11 |
| 12 In this test, gyp happens within a local environment, but build outside of it. | 12 In this test, gyp happens within a local environment, but build outside of it. |
| 13 """ | 13 """ |
| 14 | 14 |
| 15 import TestGyp | 15 import TestGyp |
| 16 | 16 |
| 17 FORMATS = ('ninja',) | 17 FORMATS = ('ninja',) |
| 18 | 18 |
| 19 test = TestGyp.TestGyp(formats=FORMATS) | 19 test = TestGyp.TestGyp(formats=FORMATS) |
| 20 | 20 |
| 21 # We reset the environ after calling gyp. When the auto-regeneration happens, | 21 # We reset the environ after calling gyp. When the auto-regeneration happens, |
| 22 # the same define should be reused anyway. | 22 # the same define should be reused anyway. |
| 23 with TestGyp.LocalEnv({'CXXFLAGS': '-O0'}): | 23 with TestGyp.LocalEnv({'CXXFLAGS': ''}): |
| 24 test.run_gyp('cxxflags.gyp') | 24 test.run_gyp('cxxflags.gyp') |
| 25 | 25 |
| 26 test.build('cxxflags.gyp') | 26 test.build('cxxflags.gyp') |
| 27 | 27 |
| 28 expect = """\ | 28 expect = """\ |
| 29 Using no optimization flag | 29 No define |
| 30 """ | 30 """ |
| 31 test.run_built_executable('cxxflags', stdout=expect) | 31 test.run_built_executable('cxxflags', stdout=expect) |
| 32 | 32 |
| 33 test.sleep() | 33 test.sleep() |
| 34 | 34 |
| 35 with TestGyp.LocalEnv({'CXXFLAGS': '-O2'}): | 35 with TestGyp.LocalEnv({'CXXFLAGS': '-DABC'}): |
| 36 test.run_gyp('cxxflags.gyp') | 36 test.run_gyp('cxxflags.gyp') |
| 37 | 37 |
| 38 test.build('cxxflags.gyp') | 38 test.build('cxxflags.gyp') |
| 39 | 39 |
| 40 expect = """\ | 40 expect = """\ |
| 41 Using an optimization flag | 41 With define |
| 42 """ | 42 """ |
| 43 test.run_built_executable('cxxflags', stdout=expect) | 43 test.run_built_executable('cxxflags', stdout=expect) |
| 44 | 44 |
| 45 test.pass_test() | 45 test.pass_test() |
| OLD | NEW |