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

Unified Diff: test/compiler-override/gyptest-compiler.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.py
diff --git a/test/compiler-override/gyptest-compiler.py b/test/compiler-override/gyptest-compiler.py
new file mode 100755
index 0000000000000000000000000000000000000000..4ad8d5532a93dd7ec7acda32d9b829ebeb4136f2
--- /dev/null
+++ b/test/compiler-override/gyptest-compiler.py
@@ -0,0 +1,54 @@
+#!/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 the user can override the compiler and linker using LD_target
+and CC_target.
+"""
+
+import TestGyp
+import os
+import copy
+
+here = os.path.dirname(os.path.abspath(__file__))
+
+test = TestGyp.TestGyp(formats=['ninja', 'make'])
+
+def CheckCompiler(test, gypfile, check_for):
+ test.run_gyp(gypfile)
+ test.build(gypfile)
+
+ # We can't test to presence of my_ld.py in the output since
+ # ninja will use CXX_target as the linker regardless
+ test.must_contain_all_lines(test.stdout(), check_for)
+
+oldenv = os.environ.copy()
+try:
+ # Check that CC, CXX and LD set target compiler
+ os.environ['CC'] = 'python %s/my_cc.py FOO' % here
+ os.environ['CXX'] = 'python %s/my_cxx.py FOO' % here
+ os.environ['LD'] = 'python %s/my_ld.py FOO' % here
+ CheckCompiler(test, 'compiler.gyp', ['my_cc.py', 'my_cxx.py', 'FOO'])
+
+ # Check that the old behaviour of setting CC_target still
+ # overrides CC as target compiler
+ os.environ['CC_target'] = 'python %s/my_cc.py BAR' % here
+ os.environ['CXX_target'] = 'python %s/my_cxx.py BAR' % here
+ os.environ['LD_target'] = 'python %s/my_ld.py BAR' % here
+ CheckCompiler(test, 'compiler.gyp', ['my_cc.py', 'my_cxx.py', 'BAR'])
+finally:
+ os.environ.clear()
+ os.environ.update(oldenv)
+
+try:
+ # Check that CC_host sets host compilee
+ os.environ['CC_host'] = 'python %s/my_cc.py HOST' % here
+ os.environ['CXX_host'] = 'python %s/my_cxx.py HOST' % here
+ os.environ['LD_host'] = 'python %s/my_ld.py HOST' % here
+ CheckCompiler(test, 'compiler-host.gyp', ['my_cc.py', 'my_cxx.py', 'HOST'])
+finally:
+ os.environ.clear()
+ os.environ.update(oldenv)
+
+test.pass_test()

Powered by Google App Engine
This is Rietveld 408576698