| Index: test/cxxflags/gyptest-cxxflags.py
|
| diff --git a/test/cxxflags/gyptest-cxxflags.py b/test/cxxflags/gyptest-cxxflags.py
|
| index 70142e7cedadcac595b239e1b889c4aa3865a20b..b8bed7f9c2c5a6c102e1ea2a70adf46f08ef309a 100755
|
| --- a/test/cxxflags/gyptest-cxxflags.py
|
| +++ b/test/cxxflags/gyptest-cxxflags.py
|
| @@ -5,36 +5,23 @@
|
| # found in the LICENSE file.
|
|
|
| """
|
| -Verifies build of an executable with C++ define specified by a gyp define, and
|
| -the use of the environment during regeneration when the gyp file changes.
|
| +Verifies the use of the environment during regeneration when the gyp file
|
| +changes, specifically via build of an executable with C++ flags specified by
|
| +CXXFLAGS.
|
| +
|
| +In this test, gyp happens within a local environment, but build outside of it.
|
| """
|
|
|
| -import os
|
| import TestGyp
|
|
|
| -env_stack = []
|
| -
|
| -
|
| -def PushEnv():
|
| - env_copy = os.environ.copy()
|
| - env_stack.append(env_copy)
|
| -
|
| -def PopEnv():
|
| - os.eniron=env_stack.pop()
|
| +FORMATS = ('ninja',)
|
|
|
| -# Regenerating build files when a gyp file changes is currently only supported
|
| -# by the make generator.
|
| -test = TestGyp.TestGyp(formats=['make'])
|
| +test = TestGyp.TestGyp(formats=FORMATS)
|
|
|
| -try:
|
| - PushEnv()
|
| - os.environ['CXXFLAGS'] = '-O0'
|
| +# We reset the environ after calling gyp. When the auto-regeneration happens,
|
| +# the same define should be reused anyway.
|
| +with TestGyp.LocalEnv({'CXXFLAGS': '-O0'}):
|
| test.run_gyp('cxxflags.gyp')
|
| -finally:
|
| - # We clear the environ after calling gyp. When the auto-regeneration happens,
|
| - # the same define should be reused anyway. Reset to empty string first in
|
| - # case the platform doesn't support unsetenv.
|
| - PopEnv()
|
|
|
| test.build('cxxflags.gyp')
|
|
|
| @@ -45,15 +32,8 @@ test.run_built_executable('cxxflags', stdout=expect)
|
|
|
| test.sleep()
|
|
|
| -try:
|
| - PushEnv()
|
| - os.environ['CXXFLAGS'] = '-O2'
|
| +with TestGyp.LocalEnv({'CXXFLAGS': '-O2'}):
|
| test.run_gyp('cxxflags.gyp')
|
| -finally:
|
| - # We clear the environ after calling gyp. When the auto-regeneration happens,
|
| - # the same define should be reused anyway. Reset to empty string first in
|
| - # case the platform doesn't support unsetenv.
|
| - PopEnv()
|
|
|
| test.build('cxxflags.gyp')
|
|
|
|
|