summaryrefslogtreecommitdiff
path: root/test/multiple-targets
diff options
context:
space:
mode:
authorsgk@chromium.org <sgk@chromium.org@78cadc50-ecff-11dd-a971-7dbc132099af>2009-08-29 04:00:50 +0000
committersgk@chromium.org <sgk@chromium.org@78cadc50-ecff-11dd-a971-7dbc132099af>2009-08-29 04:00:50 +0000
commit534b95848f8fb3bc7ced4590d81d5f85ffc92f03 (patch)
tree7c691abd77c07dbabfe25ac402e75cdb80a5c9b5 /test/multiple-targets
parent290f730423379bf9bb19da21c64771664c7ec8d8 (diff)
downloadgyp-534b95848f8fb3bc7ced4590d81d5f85ffc92f03.tar.gz
Capture a simple test configuration of multiple targets
defined in a single .gyp file. Review URL: http://codereview.chromium.org/179033 git-svn-id: http://gyp.googlecode.com/svn/trunk@619 78cadc50-ecff-11dd-a971-7dbc132099af
Diffstat (limited to 'test/multiple-targets')
-rw-r--r--test/multiple-targets/gyptest-all.py34
-rw-r--r--test/multiple-targets/gyptest-default.py34
-rw-r--r--test/multiple-targets/src/common.c7
-rw-r--r--test/multiple-targets/src/multiple.gyp20
-rw-r--r--test/multiple-targets/src/prog1.c10
-rw-r--r--test/multiple-targets/src/prog2.c10
6 files changed, 115 insertions, 0 deletions
diff --git a/test/multiple-targets/gyptest-all.py b/test/multiple-targets/gyptest-all.py
new file mode 100644
index 00000000..f2355343
--- /dev/null
+++ b/test/multiple-targets/gyptest-all.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+
+"""
+"""
+
+import os
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('multiple.gyp', chdir='src')
+
+test.subdir('relocate')
+os.rename('src', 'relocate/src')
+
+# TODO(sgk): remove stderr=None when the --generator-output= support
+# gets rid of the scons warning
+test.build_all('multiple.gyp', chdir='relocate/src', stderr=None)
+
+expect1 = """\
+hello from prog1.c
+hello from common.c
+"""
+
+expect2 = """\
+hello from prog2.c
+hello from common.c
+"""
+
+test.run_built_executable('prog1', stdout=expect1, chdir='relocate/src')
+test.run_built_executable('prog2', stdout=expect2, chdir='relocate/src')
+
+test.pass_test()
diff --git a/test/multiple-targets/gyptest-default.py b/test/multiple-targets/gyptest-default.py
new file mode 100644
index 00000000..c5b3c0f7
--- /dev/null
+++ b/test/multiple-targets/gyptest-default.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+
+"""
+"""
+
+import os
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('multiple.gyp', chdir='src')
+
+test.subdir('relocate')
+os.rename('src', 'relocate/src')
+
+# TODO(sgk): remove stderr=None when the --generator-output= support
+# gets rid of the scons warning
+test.build_default('multiple.gyp', chdir='relocate/src', stderr=None)
+
+expect1 = """\
+hello from prog1.c
+hello from common.c
+"""
+
+expect2 = """\
+hello from prog2.c
+hello from common.c
+"""
+
+test.run_built_executable('prog1', stdout=expect1, chdir='relocate/src')
+test.run_built_executable('prog2', stdout=expect2, chdir='relocate/src')
+
+test.pass_test()
diff --git a/test/multiple-targets/src/common.c b/test/multiple-targets/src/common.c
new file mode 100644
index 00000000..f1df7c14
--- /dev/null
+++ b/test/multiple-targets/src/common.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+void common(void)
+{
+ printf("hello from common.c\n");
+ return;
+}
diff --git a/test/multiple-targets/src/multiple.gyp b/test/multiple-targets/src/multiple.gyp
new file mode 100644
index 00000000..4d2a3d13
--- /dev/null
+++ b/test/multiple-targets/src/multiple.gyp
@@ -0,0 +1,20 @@
+{
+ 'targets': [
+ {
+ 'target_name': 'prog1',
+ 'type': 'executable',
+ 'sources': [
+ 'prog1.c',
+ 'common.c',
+ ],
+ },
+ {
+ 'target_name': 'prog2',
+ 'type': 'executable',
+ 'sources': [
+ 'prog2.c',
+ 'common.c',
+ ],
+ },
+ ],
+}
diff --git a/test/multiple-targets/src/prog1.c b/test/multiple-targets/src/prog1.c
new file mode 100644
index 00000000..d55f8af1
--- /dev/null
+++ b/test/multiple-targets/src/prog1.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+extern void common(void);
+
+int main(int argc, char *argv[])
+{
+ printf("hello from prog1.c\n");
+ common();
+ return 0;
+}
diff --git a/test/multiple-targets/src/prog2.c b/test/multiple-targets/src/prog2.c
new file mode 100644
index 00000000..760590eb
--- /dev/null
+++ b/test/multiple-targets/src/prog2.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+extern void common(void);
+
+int main(int argc, char *argv[])
+{
+ printf("hello from prog2.c\n");
+ common();
+ return 0;
+}