summaryrefslogtreecommitdiff
path: root/deps/gyp/test/make_global_settings/full-toolchain
diff options
context:
space:
mode:
Diffstat (limited to 'deps/gyp/test/make_global_settings/full-toolchain')
-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
6 files changed, 88 insertions, 0 deletions
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')