summaryrefslogtreecommitdiff
path: root/test/toolsets
diff options
context:
space:
mode:
authorbradnelson@google.com <bradnelson@google.com@78cadc50-ecff-11dd-a971-7dbc132099af>2009-10-20 00:22:52 +0000
committerbradnelson@google.com <bradnelson@google.com@78cadc50-ecff-11dd-a971-7dbc132099af>2009-10-20 00:22:52 +0000
commitf6affe1df80f8e59a0e17f2077182ba6c337004f (patch)
tree849b8420b8f29b87afa2e15971efc87e99567fbb /test/toolsets
parent631d527848120f9f3ba8ebc1e216d1f9cd6f38e1 (diff)
downloadgyp-f6affe1df80f8e59a0e17f2077182ba6c337004f.tar.gz
Adding in missing tests from 297006 (incorrectly cloned from 271019).
Oops, forgot to add new files. BUG=None TEST=None TBR=piman Review URL: http://codereview.chromium.org/304010 git-svn-id: http://gyp.googlecode.com/svn/trunk@711 78cadc50-ecff-11dd-a971-7dbc132099af
Diffstat (limited to 'test/toolsets')
-rw-r--r--test/toolsets/gyptest-toolsets.py19
-rw-r--r--test/toolsets/main.cc7
-rw-r--r--test/toolsets/toolsets.cc7
-rw-r--r--test/toolsets/toolsets.gyp34
4 files changed, 67 insertions, 0 deletions
diff --git a/test/toolsets/gyptest-toolsets.py b/test/toolsets/gyptest-toolsets.py
new file mode 100644
index 00000000..4d74a117
--- /dev/null
+++ b/test/toolsets/gyptest-toolsets.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+"""
+Verifies that toolsets are correctly applied
+"""
+
+import TestGyp
+
+# Multiple toolsets are currently only supported by the make generator.
+test = TestGyp.TestGyp(formats=['make'])
+
+test.run_gyp('toolsets.gyp')
+
+test.build_all('toolsets.gyp')
+
+test.run_built_executable('host-main', stdout="Host\n")
+test.run_built_executable('target-main', stdout="Target\n")
+
+test.pass_test()
diff --git a/test/toolsets/main.cc b/test/toolsets/main.cc
new file mode 100644
index 00000000..25a53f2d
--- /dev/null
+++ b/test/toolsets/main.cc
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+const char *GetToolset();
+
+int main(int argc, char *argv[]) {
+ printf("%s\n", GetToolset());
+}
diff --git a/test/toolsets/toolsets.cc b/test/toolsets/toolsets.cc
new file mode 100644
index 00000000..0a21e99f
--- /dev/null
+++ b/test/toolsets/toolsets.cc
@@ -0,0 +1,7 @@
+const char *GetToolset() {
+#ifdef TARGET
+ return "Target";
+#else
+ return "Host";
+#endif
+}
diff --git a/test/toolsets/toolsets.gyp b/test/toolsets/toolsets.gyp
new file mode 100644
index 00000000..c709fb10
--- /dev/null
+++ b/test/toolsets/toolsets.gyp
@@ -0,0 +1,34 @@
+{
+ 'target_defaults': {
+ 'target_conditions': [
+ ['_toolset=="target"', {'defines': ['TARGET']}]
+ ]
+ },
+ 'targets': [
+ {
+ 'target_name': 'toolsets',
+ 'type': 'static_library',
+ 'toolsets': ['target', 'host'],
+ 'sources': [
+ 'toolsets.cc',
+ ],
+ },
+ {
+ 'target_name': 'host-main',
+ 'type': 'executable',
+ 'toolsets': ['host'],
+ 'dependencies': ['toolsets'],
+ 'sources': [
+ 'main.cc',
+ ],
+ },
+ {
+ 'target_name': 'target-main',
+ 'type': 'executable',
+ 'dependencies': ['toolsets'],
+ 'sources': [
+ 'main.cc',
+ ],
+ },
+ ],
+}