Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: test/cflags/gyptest-cflags.py

Issue 22929009: Ninja on mac and win should also read CFLAGS/CXXFLAGS. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pylib/gyp/generator/ninja.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 build of an executable with C++ define specified by a gyp define, and 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. 9 the use of the environment during regeneration when the gyp file changes.
10 """ 10 """
11 11
12 import os 12 import os
13 import sys 13 import sys
14 import TestGyp 14 import TestGyp
15 15
16 env_stack = [] 16 env_stack = []
17 17
18 18
19 def PushEnv(): 19 def PushEnv():
20 env_copy = os.environ.copy() 20 env_copy = os.environ.copy()
21 env_stack.append(env_copy) 21 env_stack.append(env_copy)
22 22
23 def PopEnv(): 23 def PopEnv():
24 os.environ.clear() 24 os.environ.clear()
25 os.environ.update(env_stack.pop()) 25 os.environ.update(env_stack.pop())
26 26
27 formats = ['make'] 27 formats = ['make', 'ninja']
28 if sys.platform.startswith('linux'):
29 # Only Linux ninja generator supports CFLAGS.
30 formats.append('ninja')
31 28
32 test = TestGyp.TestGyp(formats=formats) 29 test = TestGyp.TestGyp(formats=formats)
33 30
34 try: 31 try:
35 PushEnv() 32 PushEnv()
36 os.environ['CFLAGS'] = '' 33 os.environ['CFLAGS'] = ''
37 os.environ['GYP_CROSSCOMPILE'] = '1' 34 os.environ['GYP_CROSSCOMPILE'] = '1'
38 test.run_gyp('cflags.gyp') 35 test.run_gyp('cflags.gyp')
39 test.build('cflags.gyp') 36 test.build('cflags.gyp')
40 finally: 37 finally:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 # We clear the environ after calling gyp. When the auto-regeneration happens, 95 # We clear the environ after calling gyp. When the auto-regeneration happens,
99 # the same define should be reused anyway. Reset to empty string first in 96 # the same define should be reused anyway. Reset to empty string first in
100 # case the platform doesn't support unsetenv. 97 # case the platform doesn't support unsetenv.
101 PopEnv() 98 PopEnv()
102 99
103 100
104 expect = """FOO defined\n""" 101 expect = """FOO defined\n"""
105 test.run_built_executable('cflags', stdout=expect) 102 test.run_built_executable('cflags', stdout=expect)
106 103
107 test.pass_test() 104 test.pass_test()
OLDNEW
« no previous file with comments | « pylib/gyp/generator/ninja.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698