summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbradnelson@google.com <bradnelson@google.com@78cadc50-ecff-11dd-a971-7dbc132099af>2009-10-22 00:56:41 +0000
committerbradnelson@google.com <bradnelson@google.com@78cadc50-ecff-11dd-a971-7dbc132099af>2009-10-22 00:56:41 +0000
commita2942fc614cfa7cf267868f91cc71114de72d5cd (patch)
tree64f09068b4c7164be8e28da71749ec3704b302ee
parent3aebc0b95cda686fe72b3fb77f7e5200e0e3ee78 (diff)
downloadgyp-a2942fc614cfa7cf267868f91cc71114de72d5cd.tar.gz
Adding an additional twist to the addtional targets tests.
Fixing a case where make generator wasn't behaving correctly with shared libraries. BUG=None TEST=None TBR=sgk Review URL: http://codereview.chromium.org/306043 git-svn-id: http://gyp.googlecode.com/svn/trunk@720 78cadc50-ecff-11dd-a971-7dbc132099af
-rw-r--r--pylib/gyp/generator/make.py7
-rw-r--r--test/additional-targets/gyptest-additional.py29
-rw-r--r--test/additional-targets/src/dir1/actions.gyp31
-rw-r--r--test/additional-targets/src/dir1/lib1.c6
4 files changed, 69 insertions, 4 deletions
diff --git a/pylib/gyp/generator/make.py b/pylib/gyp/generator/make.py
index fda0af81..99aad118 100644
--- a/pylib/gyp/generator/make.py
+++ b/pylib/gyp/generator/make.py
@@ -770,9 +770,10 @@ class MakefileWriter:
self.WriteMakeRule([self.alias], installable_deps,
comment = 'Short alias for building this %s.' %
file_desc, phony = True)
- self.WriteMakeRule(['all'], [binpath],
- comment = 'Add %s to "all" target.' % file_desc,
- phony = True)
+ if part_of_all:
+ self.WriteMakeRule(['all'], [binpath],
+ comment = 'Add %s to "all" target.' % file_desc,
+ phony = True)
def WriteList(self, list, variable=None, prefix=''):
diff --git a/test/additional-targets/gyptest-additional.py b/test/additional-targets/gyptest-additional.py
index 2bcd4c1d..3864bb51 100644
--- a/test/additional-targets/gyptest-additional.py
+++ b/test/additional-targets/gyptest-additional.py
@@ -14,13 +14,24 @@ test.relocate('src', 'relocate/src')
# Build all.
test.build('all.gyp', chdir='relocate/src')
-# Check that nothing gets emitted from all.
+# Output is as expected.
+file_content = 'Hello from emit.py\n'
if test.format == 'xcode':
test.must_not_exist('relocate/src/dir1/build/Default/out.txt')
+ test.must_match('relocate/src/dir1/build/Default/out2.txt', file_content)
+ test.must_not_exist('relocate/src/dir1/build/Default/lib1.dylib')
elif test.format == 'make':
test.must_not_exist('relocate/src/out/Default/out.txt')
+ test.must_match('relocate/src/out/Default/out2.txt', file_content)
+ test.must_not_exist('relocate/src/out/Default/obj.target/dir1/lib1.so')
+elif test.format == 'scons':
+ test.must_not_exist('relocate/src/dir1/Default/out.txt')
+ test.must_match('relocate/src/Default/out2.txt', file_content)
+ test.must_not_exist('relocate/src/dir1/Default/lib/lib1.so')
else:
test.must_not_exist('relocate/src/dir1/Default/out.txt')
+ test.must_match('relocate/src/Default/out2.txt', file_content)
+ test.must_not_exist('relocate/src/dir1/Default/lib1.dll')
# Build the action explicitly.
if test.format == 'make':
@@ -37,4 +48,20 @@ elif test.format == 'make':
else:
test.must_match('relocate/src/dir1/Default/out.txt', file_content)
+# Build the shared library explicitly.
+if test.format == 'make':
+ test.build('actions.gyp', 'lib1', chdir='relocate/src')
+else:
+ test.build('actions.gyp', 'lib1', chdir='relocate/src/dir1')
+
+# Check that things got run.
+if test.format == 'xcode':
+ test.must_exist('relocate/src/dir1/build/Default/lib1.dylib')
+elif test.format == 'make':
+ test.must_exist('relocate/src/out/Default/obj.target/dir1/lib1.so')
+elif test.format == 'scons':
+ test.must_exist('relocate/src/dir1/Default/lib/lib1.so')
+else:
+ test.must_exist('relocate/src/dir1/Default/lib1.dll')
+
test.pass_test()
diff --git a/test/additional-targets/src/dir1/actions.gyp b/test/additional-targets/src/dir1/actions.gyp
index 000315e6..2c2eaeac 100644
--- a/test/additional-targets/src/dir1/actions.gyp
+++ b/test/additional-targets/src/dir1/actions.gyp
@@ -18,5 +18,36 @@
},
],
},
+ {
+ 'target_name': 'action2_target',
+ 'type': 'none',
+ 'actions': [
+ {
+ 'action_name': 'action2',
+ 'inputs': [
+ 'emit.py',
+ ],
+ 'outputs': [
+ '<(PRODUCT_DIR)/out2.txt',
+ ],
+ 'action': ['python', 'emit.py', '<(PRODUCT_DIR)/out2.txt'],
+ 'msvs_cygwin_shell': 0,
+ },
+ ],
+ },
+ {
+ 'target_name': 'lib1',
+ 'type': 'shared_library',
+ 'suppress_wildcard': 1,
+ 'sources': ['lib1.c'],
+ },
+ ],
+ 'conditions': [
+ ['OS=="linux"', {
+ 'target_defaults': {
+ 'cflags': ['-m32'],
+ 'ldflags': ['-m32'],
+ },
+ }],
],
}
diff --git a/test/additional-targets/src/dir1/lib1.c b/test/additional-targets/src/dir1/lib1.c
new file mode 100644
index 00000000..df4cb10f
--- /dev/null
+++ b/test/additional-targets/src/dir1/lib1.c
@@ -0,0 +1,6 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int func1(void) {
+ return 42;
+}