Revise unittest for 'LD' in 'make_global_settings'

This is a follow up CL for r1937. This is just a revise of a unittest and does not changes existing functionality.

It turned out that we need to specify GYP_CROSSCOMPILE=1 to test 'LD'/'LD.host' properly. Expected results, which are expected to be describing the current behavior, are updated accordingly.

BUG=gyp:434
TEST=unittest
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/338523003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1939 78cadc50-ecff-11dd-a971-7dbc132099af
diff --git a/test/make_global_settings/ld/gyptest-make_global_settings_ld.py b/test/make_global_settings/ld/gyptest-make_global_settings_ld.py
index 4ce38fb..fdea8a8 100644
--- a/test/make_global_settings/ld/gyptest-make_global_settings_ld.py
+++ b/test/make_global_settings/ld/gyptest-make_global_settings_ld.py
@@ -57,13 +57,16 @@
   # Resolve default values
   if ld_expected is None:
     if test.format == 'make':
-      ld_expected = '$(LD)'
+      # 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 == 'ninja':
       if sys.platform == 'win32':
-        # TODO(yukawa): Make sure if this is an expected result or not.
-        ld_expected = 'ld'
-      else:
         ld_expected = '$ld'
+      else:
+        ld_expected = '$cc_host'
   if test.format == 'make':
     test.must_contain('Makefile', 'LD.host ?= %s' % ld_expected)
   elif test.format == 'ninja':
@@ -83,17 +86,26 @@
 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'.
-test.run_gyp('make_global_settings_ld.gyp', '-Dcustom_ld_target=my_ld')
+with TestGyp.LocalEnv({'GYP_CROSSCOMPILE': '1'}):
+  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_ld_target(test, ld='my_ld', rel_path=True)
 
 
 # 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')
+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')
 # TODO(yukawa): Support 'LD'/'LD.host' in Ninja generator
 if test.format == 'make':
   verify_ld_target(test, ld='my_ld_target1', rel_path=True)
@@ -107,7 +119,8 @@
 # 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',
+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':