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