Index: test/make_global_settings/ld/gyptest-make_global_settings_ld.py |
diff --git a/test/make_global_settings/ar/gyptest-make_global_settings_ar.py b/test/make_global_settings/ld/gyptest-make_global_settings_ld.py |
similarity index 36% |
copy from test/make_global_settings/ar/gyptest-make_global_settings_ar.py |
copy to test/make_global_settings/ld/gyptest-make_global_settings_ld.py |
index a90baad94e485d32e9720e1244914b3829a0d86e..4ce38fbbd3277609dfc8bd590975929983b8ef36 100644 |
--- a/test/make_global_settings/ar/gyptest-make_global_settings_ar.py |
+++ b/test/make_global_settings/ld/gyptest-make_global_settings_ld.py |
@@ -5,7 +5,7 @@ |
# found in the LICENSE file. |
""" |
-Verifies 'AR' in make_global_settings. |
+Verifies 'LD' in make_global_settings. |
""" |
import os |
@@ -23,51 +23,51 @@ def resolve_path(test, path): |
test.fail_test() |
-def verify_ar_target(test, ar=None, rel_path=False): |
+def verify_ld_target(test, ld=None, rel_path=False): |
if rel_path: |
- ar_expected = resolve_path(test, ar) |
+ ld_expected = resolve_path(test, ld) |
else: |
- ar_expected = ar |
+ ld_expected = ld |
# Resolve default values |
- if ar_expected is None: |
+ if ld_expected is None: |
if test.format == 'make': |
- # Make generator hasn't set the default value for AR. |
+ # 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', 'AR ?= ') |
+ test.must_not_contain('Makefile', 'LD ?= ') |
return |
elif test.format == 'ninja': |
if sys.platform == 'win32': |
- ar_expected = 'lib.exe' |
+ ld_expected = 'link.exe' |
else: |
- ar_expected = 'ar' |
+ ld_expected = '$cc' |
if test.format == 'make': |
- test.must_contain('Makefile', 'AR ?= %s' % ar_expected) |
+ test.must_contain('Makefile', 'LD ?= %s' % ld_expected) |
elif test.format == 'ninja': |
- test.must_contain('out/Default/build.ninja', 'ar = %s' % ar_expected) |
+ test.must_contain('out/Default/build.ninja', 'ld = %s' % ld_expected) |
else: |
test.fail_test() |
-def verify_ar_host(test, ar=None, rel_path=False): |
+def verify_ld_host(test, ld=None, rel_path=False): |
if rel_path: |
- ar_expected = resolve_path(test, ar) |
+ ld_expected = resolve_path(test, ld) |
else: |
- ar_expected = ar |
+ ld_expected = ld |
# Resolve default values |
- if ar_expected is None: |
+ if ld_expected is None: |
if test.format == 'make': |
- ar_expected = '$(AR)' |
+ ld_expected = '$(LD)' |
elif test.format == 'ninja': |
if sys.platform == 'win32': |
# TODO(yukawa): Make sure if this is an expected result or not. |
- ar_expected = 'ar' |
+ ld_expected = 'ld' |
else: |
- ar_expected = '$ar' |
+ ld_expected = '$ld' |
if test.format == 'make': |
- test.must_contain('Makefile', 'AR.host ?= %s' % ar_expected) |
+ test.must_contain('Makefile', 'LD.host ?= %s' % ld_expected) |
elif test.format == 'ninja': |
- test.must_contain('out/Default/build.ninja', 'ar_host = %s' % ar_expected) |
+ test.must_contain('out/Default/build.ninja', 'ld_host = %s' % ld_expected) |
else: |
test.fail_test() |
@@ -79,45 +79,43 @@ if sys.platform in ('linux2', 'darwin'): |
test = TestGyp.TestGyp(formats=test_format) |
# Check default values |
-test.run_gyp('make_global_settings_ar.gyp') |
-verify_ar_target(test) |
+test.run_gyp('make_global_settings_ld.gyp') |
+verify_ld_target(test) |
-# Test 'AR' in 'make_global_settings'. |
-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'. |
-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) |
-# TODO(yukawa): Support 'AR.host' in Ninja generator |
+# Test 'LD' in 'make_global_settings'. |
+test.run_gyp('make_global_settings_ld.gyp', '-Dcustom_ld_target=my_ld') |
+# TODO(yukawa): Support 'LD' in Ninja generator |
if test.format == 'make': |
- 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) |
+ verify_ld_target(test, ld='my_ld', rel_path=True) |
-# 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 'LD'/'LD.host' in 'make_global_settings'. |
+test.run_gyp('make_global_settings_ld.gyp', |
+ '-Dcustom_ld_target=my_ld_target1', |
+ '-Dcustom_ld_host=my_ld_host1') |
+# TODO(yukawa): Support 'LD'/'LD.host' in Ninja generator |
+if test.format == 'make': |
+ 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({'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() |