3
# Copyright (c) 2010 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.
8
Verifies build of an executable with C++ define specified by a gyp define, and
9
the use of the environment during regeneration when the gyp file changes.
19
env_copy = os.environ.copy()
20
env_stack.append(env_copy)
23
os.eniron=env_stack.pop()
25
# Regenerating build files when a gyp file changes is currently only supported
26
# by the make generator.
27
test = TestGyp.TestGyp(formats=['make'])
31
os.environ['CXXFLAGS'] = '-O0'
32
test.run_gyp('cxxflags.gyp')
34
# We clear the environ after calling gyp. When the auto-regeneration happens,
35
# the same define should be reused anyway. Reset to empty string first in
36
# case the platform doesn't support unsetenv.
39
test.build('cxxflags.gyp')
42
Using no optimization flag
44
test.run_built_executable('cxxflags', stdout=expect)
50
os.environ['CXXFLAGS'] = '-O2'
51
test.run_gyp('cxxflags.gyp')
53
# We clear the environ after calling gyp. When the auto-regeneration happens,
54
# the same define should be reused anyway. Reset to empty string first in
55
# case the platform doesn't support unsetenv.
58
test.build('cxxflags.gyp')
61
Using an optimization flag
63
test.run_built_executable('cxxflags', stdout=expect)