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

Unified Diff: test/compiler-override/gyptest-compiler-global-settings.py

Issue 10833021: Honor $CC/$CC_host and friends in make generator. (Closed) Base URL: http://git.chromium.org/external/gyp.git@master
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: test/compiler-override/gyptest-compiler-global-settings.py
diff --git a/test/compiler-override/gyptest-compiler-global-settings.py b/test/compiler-override/gyptest-compiler-global-settings.py
new file mode 100755
index 0000000000000000000000000000000000000000..f4980f991d33ed190c7a87e9747ae779ffa523af
--- /dev/null
+++ b/test/compiler-override/gyptest-compiler-global-settings.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+"""
+Verifies that make_global_settings can be used to override the
+compiler settings.
+"""
+
+import TestGyp
+import os
+import copy
+from string import Template
+
+test = TestGyp.TestGyp(formats=['ninja', 'make'])
+
+gypfile = 'compiler-global-settings.gyp'
+
+# TODO: test that the linker really is overridden corroectly. Currnetly the
Nico 2012/08/13 23:14:07 typos corroectly, Currnetly
Sam Clegg 2012/08/14 21:10:32 Done.
+# ninja generator will always use CXX for the linker
Nico 2012/08/13 23:14:07 For the host linker? (nit: trailing '.')
Sam Clegg 2012/08/14 21:10:32 Done.
+
+replacements = { 'PYTHON': '/usr/bin/python', 'PWD': os.getcwd()}
+
+# process the .in gyp file to produce the final gyp file
+# since we need to include absolute paths in the make_global_settings
+# section
+replacements['TOOLSET'] = 'target'
+s = Template(open(gypfile + '.in').read())
+output = open(gypfile, 'w')
+output.write(s.substitute(replacements))
+output.close()
+
+test.run_gyp(gypfile)
+test.build(gypfile)
+test.must_contain_all_lines(test.stdout(), ['my_cc.py', 'my_cxx.py', 'FOO'])
+
+# Same again but with the host toolset
Nico 2012/08/13 23:14:07 .
Sam Clegg 2012/08/14 21:10:32 Done.
+replacements['TOOLSET'] = 'host'
+s = Template(open(gypfile + '.in').read())
+output = open(gypfile, 'w')
+output.write(s.substitute(replacements))
+output.close()
+
+test.run_gyp(gypfile)
+test.build(gypfile)
+test.must_contain_all_lines(test.stdout(), ['my_cc.py', 'my_cxx.py', 'BAR'])
+
+test.pass_test()

Powered by Google App Engine
This is Rietveld 408576698