3
# Copyright (c) 2009 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.
15
# Regenerating build files when a gyp file changes is currently only supported
16
# by the make generator.
17
test = TestGyp.TestGyp(formats=['make'])
20
os.environ['GYP_DEFINES'] = 'value=50'
21
test.run_gyp('defines.gyp')
23
# We clear the environ after calling gyp. When the auto-regeneration happens,
24
# the same define should be reused anyway. Reset to empty string first in
25
# case the platform doesn't support unsetenv.
26
os.environ['GYP_DEFINES'] = ''
27
del os.environ['GYP_DEFINES']
29
test.build('defines.gyp')
35
test.run_built_executable('defines', stdout=expect)
37
# Sleep so that the changed gyp file will have a newer timestamp than the
38
# previously generated build files.
40
test.write('defines.gyp', test.read('defines-env.gyp'))
42
test.build('defines.gyp', test.ALL)
47
test.run_built_executable('defines', stdout=expect)