summaryrefslogtreecommitdiff
path: root/deps/gyp/test/make_global_settings
diff options
context:
space:
mode:
authorMike Morris <michael.patrick.morris@gmail.com>2015-12-04 13:29:51 -0500
committerMike Morris <michael.patrick.morris@gmail.com>2015-12-07 15:48:34 -0800
commitd467ae6e7867044b8d7b466776fb37089292c52b (patch)
tree730ee0656e6bf9f0dff33346f07acd800e83ab25 /deps/gyp/test/make_global_settings
parent59ef8da69549cf6308078c6f656affba96e9439e (diff)
downloadqtlocation-mapboxgl-d467ae6e7867044b8d7b466776fb37089292c52b.tar.gz
[core] upgrade gyp to git commit 6fb8bd8
https://chromium.googlesource.com/external/gyp/+/6fb8bd829f0ca8fd432fd85ede788b6881c4f09f
Diffstat (limited to 'deps/gyp/test/make_global_settings')
-rw-r--r--deps/gyp/test/make_global_settings/ar/gyptest-make_global_settings_ar.py126
-rw-r--r--deps/gyp/test/make_global_settings/ar/make_global_settings_ar.gyp29
-rw-r--r--deps/gyp/test/make_global_settings/basics/gyptest-make_global_settings.py46
-rw-r--r--deps/gyp/test/make_global_settings/basics/make_global_settings.gyp17
-rw-r--r--deps/gyp/test/make_global_settings/env-wrapper/gyptest-wrapper.py46
-rw-r--r--deps/gyp/test/make_global_settings/env-wrapper/wrapper.gyp17
-rw-r--r--deps/gyp/test/make_global_settings/full-toolchain/bar.cc1
-rw-r--r--deps/gyp/test/make_global_settings/full-toolchain/foo.c1
-rw-r--r--deps/gyp/test/make_global_settings/full-toolchain/gyptest-make_global_settings.py48
-rw-r--r--deps/gyp/test/make_global_settings/full-toolchain/make_global_settings.gyp22
-rwxr-xr-xdeps/gyp/test/make_global_settings/full-toolchain/my_nm.py8
-rwxr-xr-xdeps/gyp/test/make_global_settings/full-toolchain/my_readelf.py8
-rw-r--r--deps/gyp/test/make_global_settings/ld/gyptest-make_global_settings_ld.py130
-rw-r--r--deps/gyp/test/make_global_settings/ld/make_global_settings_ld.gyp29
-rw-r--r--deps/gyp/test/make_global_settings/wrapper/gyptest-wrapper.py47
-rw-r--r--deps/gyp/test/make_global_settings/wrapper/wrapper.gyp21
16 files changed, 596 insertions, 0 deletions
diff --git a/deps/gyp/test/make_global_settings/ar/gyptest-make_global_settings_ar.py b/deps/gyp/test/make_global_settings/ar/gyptest-make_global_settings_ar.py
new file mode 100644
index 0000000000..e6676de6bd
--- /dev/null
+++ b/deps/gyp/test/make_global_settings/ar/gyptest-make_global_settings_ar.py
@@ -0,0 +1,126 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2014 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 'AR' in make_global_settings.
+"""
+
+import os
+import sys
+import TestGyp
+
+def resolve_path(test, path):
+ if path is None:
+ return None
+ elif test.format == 'make':
+ return '$(abspath %s)' % path
+ elif test.format in ['ninja', 'xcode-ninja']:
+ return os.path.join('..', '..', path)
+ else:
+ test.fail_test()
+
+
+def verify_ar_target(test, ar=None, rel_path=False):
+ if rel_path:
+ ar_expected = resolve_path(test, ar)
+ else:
+ ar_expected = ar
+ # Resolve default values
+ if ar_expected is None:
+ if test.format == 'make':
+ # Make generator hasn't set the default value for AR.
+ # You can remove the following assertion as long as it doesn't
+ # break existing projects.
+ test.must_not_contain('Makefile', 'AR ?= ')
+ return
+ elif test.format in ['ninja', 'xcode-ninja']:
+ if sys.platform == 'win32':
+ ar_expected = 'lib.exe'
+ else:
+ ar_expected = 'ar'
+ if test.format == 'make':
+ test.must_contain('Makefile', 'AR ?= %s' % ar_expected)
+ elif test.format in ['ninja', 'xcode-ninja']:
+ test.must_contain('out/Default/build.ninja', 'ar = %s' % ar_expected)
+ else:
+ test.fail_test()
+
+
+def verify_ar_host(test, ar=None, rel_path=False):
+ if rel_path:
+ ar_expected = resolve_path(test, ar)
+ else:
+ ar_expected = ar
+ # Resolve default values
+ if ar_expected is None:
+ if sys.platform == 'win32':
+ ar_expected = 'lib.exe'
+ else:
+ ar_expected = 'ar'
+ if test.format == 'make':
+ test.must_contain('Makefile', 'AR.host ?= %s' % ar_expected)
+ elif test.format in ['ninja', 'xcode-ninja']:
+ test.must_contain('out/Default/build.ninja', 'ar_host = %s' % ar_expected)
+ else:
+ test.fail_test()
+
+
+test_format = ['ninja']
+if sys.platform in ('linux2', 'darwin'):
+ test_format += ['make']
+
+test = TestGyp.TestGyp(formats=test_format)
+
+# Check default values
+test.run_gyp('make_global_settings_ar.gyp')
+verify_ar_target(test)
+
+
+# Check default values with GYP_CROSSCOMPILE enabled.
+with TestGyp.LocalEnv({'GYP_CROSSCOMPILE': '1'}):
+ test.run_gyp('make_global_settings_ar.gyp')
+verify_ar_target(test)
+verify_ar_host(test)
+
+
+# Test 'AR' in 'make_global_settings'.
+with TestGyp.LocalEnv({'GYP_CROSSCOMPILE': '1'}):
+ test.run_gyp('make_global_settings_ar.gyp', '-Dcustom_ar_target=my_ar')
+verify_ar_target(test, ar='my_ar', rel_path=True)
+
+
+# Test 'AR'/'AR.host' in 'make_global_settings'.
+with TestGyp.LocalEnv({'GYP_CROSSCOMPILE': '1'}):
+ test.run_gyp('make_global_settings_ar.gyp',
+ '-Dcustom_ar_target=my_ar_target1',
+ '-Dcustom_ar_host=my_ar_host1')
+verify_ar_target(test, ar='my_ar_target1', rel_path=True)
+verify_ar_host(test, ar='my_ar_host1', rel_path=True)
+
+
+# Test $AR and $AR_host environment variables.
+with TestGyp.LocalEnv({'AR': 'my_ar_target2',
+ 'AR_host': 'my_ar_host2'}):
+ test.run_gyp('make_global_settings_ar.gyp')
+# Ninja generator resolves $AR in gyp phase. Make generator doesn't.
+if test.format == 'ninja':
+ if sys.platform == 'win32':
+ # TODO(yukawa): Make sure if this is an expected result or not.
+ verify_ar_target(test, ar='lib.exe', rel_path=False)
+ else:
+ verify_ar_target(test, ar='my_ar_target2', rel_path=False)
+verify_ar_host(test, ar='my_ar_host2', rel_path=False)
+
+
+# Test 'AR' in 'make_global_settings' with $AR_host environment variable.
+with TestGyp.LocalEnv({'AR_host': 'my_ar_host3'}):
+ test.run_gyp('make_global_settings_ar.gyp',
+ '-Dcustom_ar_target=my_ar_target3')
+verify_ar_target(test, ar='my_ar_target3', rel_path=True)
+verify_ar_host(test, ar='my_ar_host3', rel_path=False)
+
+
+test.pass_test()
diff --git a/deps/gyp/test/make_global_settings/ar/make_global_settings_ar.gyp b/deps/gyp/test/make_global_settings/ar/make_global_settings_ar.gyp
new file mode 100644
index 0000000000..3430d82a51
--- /dev/null
+++ b/deps/gyp/test/make_global_settings/ar/make_global_settings_ar.gyp
@@ -0,0 +1,29 @@
+# Copyright (c) 2014 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style licence that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ 'custom_ar_target%': '',
+ 'custom_ar_host%': '',
+ },
+ 'conditions': [
+ ['"<(custom_ar_target)"!=""', {
+ 'make_global_settings': [
+ ['AR', '<(custom_ar_target)'],
+ ],
+ }],
+ ['"<(custom_ar_host)"!=""', {
+ 'make_global_settings': [
+ ['AR.host', '<(custom_ar_host)'],
+ ],
+ }],
+ ],
+ 'targets': [
+ {
+ 'target_name': 'make_global_settings_ar_test',
+ 'type': 'static_library',
+ 'sources': [ 'foo.c' ],
+ },
+ ],
+}
diff --git a/deps/gyp/test/make_global_settings/basics/gyptest-make_global_settings.py b/deps/gyp/test/make_global_settings/basics/gyptest-make_global_settings.py
new file mode 100644
index 0000000000..63d1d0af90
--- /dev/null
+++ b/deps/gyp/test/make_global_settings/basics/gyptest-make_global_settings.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2013 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 make_global_settings.
+"""
+
+import os
+import sys
+import TestGyp
+
+test_format = ['ninja']
+if sys.platform in ('linux2', 'darwin'):
+ test_format += ['make']
+
+test = TestGyp.TestGyp(formats=test_format)
+
+test.run_gyp('make_global_settings.gyp')
+
+if test.format == 'make':
+ cc_expected = """ifneq (,$(filter $(origin CC), undefined default))
+ CC = $(abspath clang)
+endif
+"""
+ if sys.platform == 'linux2':
+ link_expected = """
+LINK ?= $(abspath clang)
+"""
+ elif sys.platform == 'darwin':
+ link_expected = """
+LINK ?= $(abspath clang)
+"""
+ test.must_contain('Makefile', cc_expected)
+ test.must_contain('Makefile', link_expected)
+if test.format == 'ninja':
+ cc_expected = 'cc = ' + os.path.join('..', '..', 'clang')
+ ld_expected = 'ld = $cc'
+ if sys.platform == 'win32':
+ ld_expected = 'link.exe'
+ test.must_contain('out/Default/build.ninja', cc_expected)
+ test.must_contain('out/Default/build.ninja', ld_expected)
+
+test.pass_test()
diff --git a/deps/gyp/test/make_global_settings/basics/make_global_settings.gyp b/deps/gyp/test/make_global_settings/basics/make_global_settings.gyp
new file mode 100644
index 0000000000..47dbc8570f
--- /dev/null
+++ b/deps/gyp/test/make_global_settings/basics/make_global_settings.gyp
@@ -0,0 +1,17 @@
+# Copyright (c) 2013 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style licence that can be
+# found in the LICENSE file.
+
+{
+ 'make_global_settings': [
+ ['CC', 'clang'],
+ ['LINK', 'clang'],
+ ],
+ 'targets': [
+ {
+ 'target_name': 'test',
+ 'type': 'static_library',
+ 'sources': [ 'foo.c' ],
+ },
+ ],
+}
diff --git a/deps/gyp/test/make_global_settings/env-wrapper/gyptest-wrapper.py b/deps/gyp/test/make_global_settings/env-wrapper/gyptest-wrapper.py
new file mode 100644
index 0000000000..70d6906cca
--- /dev/null
+++ b/deps/gyp/test/make_global_settings/env-wrapper/gyptest-wrapper.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2013 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 *_wrapper in environment.
+"""
+
+import os
+import sys
+import TestGyp
+
+test_format = ['ninja']
+
+os.environ['CC_wrapper'] = 'distcc'
+os.environ['LINK_wrapper'] = 'distlink'
+os.environ['CC.host_wrapper'] = 'ccache'
+
+test = TestGyp.TestGyp(formats=test_format)
+
+old_env = dict(os.environ)
+os.environ['GYP_CROSSCOMPILE'] = '1'
+test.run_gyp('wrapper.gyp')
+os.environ.clear()
+os.environ.update(old_env)
+
+if test.format == 'ninja':
+ cc_expected = ('cc = ' + os.path.join('..', '..', 'distcc') + ' ' +
+ os.path.join('..', '..', 'clang'))
+ cc_host_expected = ('cc_host = ' + os.path.join('..', '..', 'ccache') + ' ' +
+ os.path.join('..', '..', 'clang'))
+ ld_expected = 'ld = ../../distlink $cc'
+ if sys.platform != 'win32':
+ ldxx_expected = 'ldxx = ../../distlink $cxx'
+
+ if sys.platform == 'win32':
+ ld_expected = 'link.exe'
+ test.must_contain('out/Default/build.ninja', cc_expected)
+ test.must_contain('out/Default/build.ninja', cc_host_expected)
+ test.must_contain('out/Default/build.ninja', ld_expected)
+ if sys.platform != 'win32':
+ test.must_contain('out/Default/build.ninja', ldxx_expected)
+
+test.pass_test()
diff --git a/deps/gyp/test/make_global_settings/env-wrapper/wrapper.gyp b/deps/gyp/test/make_global_settings/env-wrapper/wrapper.gyp
new file mode 100644
index 0000000000..1698d71dd4
--- /dev/null
+++ b/deps/gyp/test/make_global_settings/env-wrapper/wrapper.gyp
@@ -0,0 +1,17 @@
+# Copyright (c) 2013 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.
+
+{
+ 'make_global_settings': [
+ ['CC', 'clang'],
+ ['CC.host', 'clang'],
+ ],
+ 'targets': [
+ {
+ 'target_name': 'test',
+ 'type': 'static_library',
+ 'sources': [ 'foo.c' ],
+ },
+ ],
+}
diff --git a/deps/gyp/test/make_global_settings/full-toolchain/bar.cc b/deps/gyp/test/make_global_settings/full-toolchain/bar.cc
new file mode 100644
index 0000000000..afb422ba1a
--- /dev/null
+++ b/deps/gyp/test/make_global_settings/full-toolchain/bar.cc
@@ -0,0 +1 @@
+#error Not a real source file
diff --git a/deps/gyp/test/make_global_settings/full-toolchain/foo.c b/deps/gyp/test/make_global_settings/full-toolchain/foo.c
new file mode 100644
index 0000000000..afb422ba1a
--- /dev/null
+++ b/deps/gyp/test/make_global_settings/full-toolchain/foo.c
@@ -0,0 +1 @@
+#error Not a real source file
diff --git a/deps/gyp/test/make_global_settings/full-toolchain/gyptest-make_global_settings.py b/deps/gyp/test/make_global_settings/full-toolchain/gyptest-make_global_settings.py
new file mode 100644
index 0000000000..eebda7d497
--- /dev/null
+++ b/deps/gyp/test/make_global_settings/full-toolchain/gyptest-make_global_settings.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2014 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 make_global_settings works with the full toolchain.
+"""
+
+import os
+import sys
+import TestGyp
+
+if sys.platform == 'win32':
+ # cross compiling not supported by ninja on windows
+ # and make not supported on windows at all.
+ sys.exit(0)
+
+test = TestGyp.TestGyp(formats=['ninja'])
+# Must set the test format to something with a flavor (the part after the '-')
+# in order to test the desired behavior. Since we want to run a non-host
+# toolchain, we have to set the flavor to something that the ninja generator
+# doesn't know about, so it doesn't default to the host-specific tools (e.g.,
+# 'otool' on mac to generate the .TOC).
+#
+# Note that we can't just pass format=['ninja-some_toolchain'] to the
+# constructor above, because then this test wouldn't be recognized as a ninja
+# format test.
+test.formats = ['ninja-my_flavor' if f == 'ninja' else f for f in test.formats]
+
+gyp_file = 'make_global_settings.gyp'
+
+test.run_gyp(gyp_file,
+ # Teach the .gyp file about the location of my_nm.py and
+ # my_readelf.py, and the python executable.
+ '-Dworkdir=%s' % test.workdir,
+ '-Dpython=%s' % sys.executable)
+test.build(gyp_file,
+ arguments=['-v'] if test.format == 'ninja-my_flavor' else [])
+
+expected = ['MY_CC', 'MY_CXX']
+test.must_contain_all_lines(test.stdout(), expected)
+
+test.must_contain(test.built_file_path('RAN_MY_NM'), 'RAN_MY_NM')
+test.must_contain(test.built_file_path('RAN_MY_READELF'), 'RAN_MY_READELF')
+
+test.pass_test()
diff --git a/deps/gyp/test/make_global_settings/full-toolchain/make_global_settings.gyp b/deps/gyp/test/make_global_settings/full-toolchain/make_global_settings.gyp
new file mode 100644
index 0000000000..2c3266322d
--- /dev/null
+++ b/deps/gyp/test/make_global_settings/full-toolchain/make_global_settings.gyp
@@ -0,0 +1,22 @@
+# Copyright (c) 2013 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style licence that can be
+# found in the LICENSE file.
+
+{
+ 'make_global_settings': [
+ ['CC', '/bin/echo MY_CC'],
+ ['CXX', '/bin/echo MY_CXX'],
+ ['NM', '<(python) <(workdir)/my_nm.py'],
+ ['READELF', '<(python) <(workdir)/my_readelf.py'],
+ ],
+ 'targets': [
+ {
+ 'target_name': 'test',
+ 'type': 'shared_library',
+ 'sources': [
+ 'foo.c',
+ 'bar.cc',
+ ],
+ },
+ ],
+}
diff --git a/deps/gyp/test/make_global_settings/full-toolchain/my_nm.py b/deps/gyp/test/make_global_settings/full-toolchain/my_nm.py
new file mode 100755
index 0000000000..f0f1efcf73
--- /dev/null
+++ b/deps/gyp/test/make_global_settings/full-toolchain/my_nm.py
@@ -0,0 +1,8 @@
+#!/usr/bin/env python
+# Copyright (c) 2014 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.
+import sys
+print sys.argv
+with open('RAN_MY_NM', 'w') as f:
+ f.write('RAN_MY_NM')
diff --git a/deps/gyp/test/make_global_settings/full-toolchain/my_readelf.py b/deps/gyp/test/make_global_settings/full-toolchain/my_readelf.py
new file mode 100755
index 0000000000..40e303cd76
--- /dev/null
+++ b/deps/gyp/test/make_global_settings/full-toolchain/my_readelf.py
@@ -0,0 +1,8 @@
+#!/usr/bin/env python
+# Copyright (c) 2014 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.
+import sys
+print sys.argv
+with open('RAN_MY_READELF', 'w') as f:
+ f.write('RAN_MY_READELF')
diff --git a/deps/gyp/test/make_global_settings/ld/gyptest-make_global_settings_ld.py b/deps/gyp/test/make_global_settings/ld/gyptest-make_global_settings_ld.py
new file mode 100644
index 0000000000..c5a2e96422
--- /dev/null
+++ b/deps/gyp/test/make_global_settings/ld/gyptest-make_global_settings_ld.py
@@ -0,0 +1,130 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2014 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 'LD' in make_global_settings.
+"""
+
+import os
+import sys
+import TestGyp
+
+def resolve_path(test, path):
+ if path is None:
+ return None
+ elif test.format == 'make':
+ return '$(abspath %s)' % path
+ elif test.format in ['ninja', 'xcode-ninja']:
+ return os.path.join('..', '..', path)
+ else:
+ test.fail_test()
+
+
+def verify_ld_target(test, ld=None, rel_path=False):
+ if rel_path:
+ ld_expected = resolve_path(test, ld)
+ else:
+ ld_expected = ld
+ # Resolve default values
+ if ld_expected is None:
+ if test.format == 'make':
+ # Make generator hasn't set the default value for LD.
+ # You can remove the following assertion as long as it doesn't
+ # break existing projects.
+ test.must_not_contain('Makefile', 'LD ?= ')
+ return
+ elif test.format in ['ninja', 'xcode-ninja']:
+ if sys.platform == 'win32':
+ ld_expected = 'link.exe'
+ else:
+ ld_expected = '$cc'
+ if test.format == 'make':
+ test.must_contain('Makefile', 'LD ?= %s' % ld_expected)
+ elif test.format in ['ninja', 'xcode-ninja']:
+ test.must_contain('out/Default/build.ninja', 'ld = %s' % ld_expected)
+ else:
+ test.fail_test()
+
+
+def verify_ld_host(test, ld=None, rel_path=False):
+ if rel_path:
+ ld_expected = resolve_path(test, ld)
+ else:
+ ld_expected = ld
+ # Resolve default values
+ if ld_expected is None:
+ if test.format == 'make':
+ # Make generator hasn't set the default value for LD.host.
+ # You can remove the following assertion as long as it doesn't
+ # break existing projects.
+ test.must_not_contain('Makefile', 'LD.host ?= ')
+ return
+ elif test.format in ['ninja', 'xcode-ninja']:
+ if sys.platform == 'win32':
+ ld_expected = '$ld'
+ else:
+ ld_expected = '$cc_host'
+ if test.format == 'make':
+ test.must_contain('Makefile', 'LD.host ?= %s' % ld_expected)
+ elif test.format in ['ninja', 'xcode-ninja']:
+ test.must_contain('out/Default/build.ninja', 'ld_host = %s' % ld_expected)
+ else:
+ test.fail_test()
+
+
+test_format = ['ninja']
+if sys.platform in ('linux2', 'darwin'):
+ test_format += ['make']
+
+test = TestGyp.TestGyp(formats=test_format)
+
+# Check default values
+test.run_gyp('make_global_settings_ld.gyp')
+verify_ld_target(test)
+
+
+# Check default values with GYP_CROSSCOMPILE enabled.
+with TestGyp.LocalEnv({'GYP_CROSSCOMPILE': '1'}):
+ test.run_gyp('make_global_settings_ld.gyp')
+verify_ld_target(test)
+verify_ld_host(test)
+
+
+# Test 'LD' in 'make_global_settings'.
+with TestGyp.LocalEnv({'GYP_CROSSCOMPILE': '1'}):
+ test.run_gyp('make_global_settings_ld.gyp', '-Dcustom_ld_target=my_ld')
+verify_ld_target(test, ld='my_ld', rel_path=True)
+
+
+# Test 'LD'/'LD.host' in 'make_global_settings'.
+with TestGyp.LocalEnv({'GYP_CROSSCOMPILE': '1'}):
+ test.run_gyp('make_global_settings_ld.gyp',
+ '-Dcustom_ld_target=my_ld_target1',
+ '-Dcustom_ld_host=my_ld_host1')
+verify_ld_target(test, ld='my_ld_target1', rel_path=True)
+verify_ld_host(test, ld='my_ld_host1', rel_path=True)
+
+
+# Unlike other environment variables such as $AR/$AR_host, $CC/$CC_host,
+# and $CXX/$CXX_host, neither Make generator nor Ninja generator recognizes
+# $LD/$LD_host environment variables as of r1935. This may or may not be
+# intentional, but here we leave a test case to verify this behavior just for
+# the record.
+# If you want to support $LD/$LD_host, please revise the following test case as
+# well as the generator.
+with TestGyp.LocalEnv({'GYP_CROSSCOMPILE': '1',
+ 'LD': 'my_ld_target2',
+ 'LD_host': 'my_ld_host2'}):
+ test.run_gyp('make_global_settings_ld.gyp')
+if test.format == 'make':
+ test.must_not_contain('Makefile', 'my_ld_target2')
+ test.must_not_contain('Makefile', 'my_ld_host2')
+elif test.format == 'ninja':
+ test.must_not_contain('out/Default/build.ninja', 'my_ld_target2')
+ test.must_not_contain('out/Default/build.ninja', 'my_ld_host2')
+
+
+test.pass_test()
diff --git a/deps/gyp/test/make_global_settings/ld/make_global_settings_ld.gyp b/deps/gyp/test/make_global_settings/ld/make_global_settings_ld.gyp
new file mode 100644
index 0000000000..6837c77326
--- /dev/null
+++ b/deps/gyp/test/make_global_settings/ld/make_global_settings_ld.gyp
@@ -0,0 +1,29 @@
+# Copyright (c) 2014 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style licence that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ 'custom_ld_target%': '',
+ 'custom_ld_host%': '',
+ },
+ 'conditions': [
+ ['"<(custom_ld_target)"!=""', {
+ 'make_global_settings': [
+ ['LD', '<(custom_ld_target)'],
+ ],
+ }],
+ ['"<(custom_ld_host)"!=""', {
+ 'make_global_settings': [
+ ['LD.host', '<(custom_ld_host)'],
+ ],
+ }],
+ ],
+ 'targets': [
+ {
+ 'target_name': 'make_global_settings_ld_test',
+ 'type': 'static_library',
+ 'sources': [ 'foo.c' ],
+ },
+ ],
+}
diff --git a/deps/gyp/test/make_global_settings/wrapper/gyptest-wrapper.py b/deps/gyp/test/make_global_settings/wrapper/gyptest-wrapper.py
new file mode 100644
index 0000000000..eb1ebfd5a9
--- /dev/null
+++ b/deps/gyp/test/make_global_settings/wrapper/gyptest-wrapper.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2013 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 *_wrapper in make_global_settings.
+"""
+
+import os
+import sys
+import TestGyp
+
+test_format = ['ninja']
+if sys.platform in ('linux2', 'darwin'):
+ test_format += ['make']
+
+test = TestGyp.TestGyp(formats=test_format)
+
+old_env = dict(os.environ)
+os.environ['GYP_CROSSCOMPILE'] = '1'
+test.run_gyp('wrapper.gyp')
+os.environ.clear()
+os.environ.update(old_env)
+
+if test.format == 'make':
+ cc_expected = """ifneq (,$(filter $(origin CC), undefined default))
+ CC = $(abspath distcc) $(abspath clang)
+endif
+"""
+ link_expected = 'LINK ?= $(abspath distlink) $(abspath clang++)'
+ test.must_contain('Makefile', cc_expected)
+ test.must_contain('Makefile', link_expected)
+if test.format == 'ninja':
+ cc_expected = ('cc = ' + os.path.join('..', '..', 'distcc') + ' ' +
+ os.path.join('..', '..', 'clang'))
+ cc_host_expected = ('cc_host = ' + os.path.join('..', '..', 'ccache') + ' ' +
+ os.path.join('..', '..', 'clang'))
+ ld_expected = 'ld = ../../distlink $cc'
+ if sys.platform == 'win32':
+ ld_expected = 'link.exe'
+ test.must_contain('out/Default/build.ninja', cc_expected)
+ test.must_contain('out/Default/build.ninja', cc_host_expected)
+ test.must_contain('out/Default/build.ninja', ld_expected)
+
+test.pass_test()
diff --git a/deps/gyp/test/make_global_settings/wrapper/wrapper.gyp b/deps/gyp/test/make_global_settings/wrapper/wrapper.gyp
new file mode 100644
index 0000000000..3d4cd04b16
--- /dev/null
+++ b/deps/gyp/test/make_global_settings/wrapper/wrapper.gyp
@@ -0,0 +1,21 @@
+# Copyright (c) 2013 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.
+
+{
+ 'make_global_settings': [
+ ['CC', 'clang'],
+ ['CC_wrapper', 'distcc'],
+ ['LINK', 'clang++'],
+ ['LINK_wrapper', 'distlink'],
+ ['CC.host', 'clang'],
+ ['CC.host_wrapper', 'ccache'],
+ ],
+ 'targets': [
+ {
+ 'target_name': 'test',
+ 'type': 'static_library',
+ 'sources': [ 'foo.c' ],
+ },
+ ],
+}