summaryrefslogtreecommitdiffstats
path: root/third_party/python/gyp/test/make
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/python/gyp/test/make')
-rw-r--r--third_party/python/gyp/test/make/dependencies.gyp15
-rwxr-xr-xthird_party/python/gyp/test/make/gyptest-dependencies.py26
-rwxr-xr-xthird_party/python/gyp/test/make/gyptest-noload.py57
-rw-r--r--third_party/python/gyp/test/make/main.cc12
-rw-r--r--third_party/python/gyp/test/make/main.h0
-rw-r--r--third_party/python/gyp/test/make/noload/all.gyp18
-rw-r--r--third_party/python/gyp/test/make/noload/lib/shared.c3
-rw-r--r--third_party/python/gyp/test/make/noload/lib/shared.gyp16
-rw-r--r--third_party/python/gyp/test/make/noload/lib/shared.h1
-rw-r--r--third_party/python/gyp/test/make/noload/main.c9
10 files changed, 157 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/make/dependencies.gyp b/third_party/python/gyp/test/make/dependencies.gyp
new file mode 100644
index 0000000000..e2bee24fce
--- /dev/null
+++ b/third_party/python/gyp/test/make/dependencies.gyp
@@ -0,0 +1,15 @@
+# Copyright (c) 2009 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.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'main',
+ 'type': 'executable',
+ 'sources': [
+ 'main.cc',
+ ],
+ },
+ ],
+}
diff --git a/third_party/python/gyp/test/make/gyptest-dependencies.py b/third_party/python/gyp/test/make/gyptest-dependencies.py
new file mode 100755
index 0000000000..d215f76782
--- /dev/null
+++ b/third_party/python/gyp/test/make/gyptest-dependencies.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2012 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 that .d files and all.deps are properly generated.
+"""
+
+import TestGyp
+
+# .d files are only used by the make build.
+test = TestGyp.TestGyp(formats=['make'])
+
+test.run_gyp('dependencies.gyp')
+
+test.build('dependencies.gyp', test.ALL)
+
+deps_file = test.built_file_path(".deps/out/Default/obj.target/main/main.o.d")
+test.must_contain(deps_file, "main.h")
+
+# Build a second time to make sure we generate all.deps.
+test.build('dependencies.gyp', test.ALL)
+
+test.pass_test()
diff --git a/third_party/python/gyp/test/make/gyptest-noload.py b/third_party/python/gyp/test/make/gyptest-noload.py
new file mode 100755
index 0000000000..1f5103315c
--- /dev/null
+++ b/third_party/python/gyp/test/make/gyptest-noload.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2010 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.
+
+"""
+Tests the use of the NO_LOAD flag which makes loading sub .mk files
+optional.
+"""
+
+# Python 2.5 needs this for the with statement.
+from __future__ import with_statement
+
+import os
+import TestGyp
+
+test = TestGyp.TestGyp(formats=['make'])
+
+test.run_gyp('all.gyp', chdir='noload')
+
+test.relocate('noload', 'relocate/noload')
+
+test.build('build/all.gyp', test.ALL, chdir='relocate/noload')
+test.run_built_executable('exe', chdir='relocate/noload',
+ stdout='Hello from shared.c.\n')
+
+# Just sanity test that NO_LOAD=lib doesn't break anything.
+test.build('build/all.gyp', test.ALL, chdir='relocate/noload',
+ arguments=['NO_LOAD=lib'])
+test.run_built_executable('exe', chdir='relocate/noload',
+ stdout='Hello from shared.c.\n')
+test.build('build/all.gyp', test.ALL, chdir='relocate/noload',
+ arguments=['NO_LOAD=z'])
+test.run_built_executable('exe', chdir='relocate/noload',
+ stdout='Hello from shared.c.\n')
+
+# Make sure we can rebuild without reloading the sub .mk file.
+with open('relocate/noload/main.c', 'a') as src_file:
+ src_file.write("\n")
+test.build('build/all.gyp', test.ALL, chdir='relocate/noload',
+ arguments=['NO_LOAD=lib'])
+test.run_built_executable('exe', chdir='relocate/noload',
+ stdout='Hello from shared.c.\n')
+
+# Change shared.c, but verify that it doesn't get rebuild if we don't load it.
+with open('relocate/noload/lib/shared.c', 'w') as shared_file:
+ shared_file.write(
+ '#include "shared.h"\n'
+ 'const char kSharedStr[] = "modified";\n'
+ )
+test.build('build/all.gyp', test.ALL, chdir='relocate/noload',
+ arguments=['NO_LOAD=lib'])
+test.run_built_executable('exe', chdir='relocate/noload',
+ stdout='Hello from shared.c.\n')
+
+test.pass_test()
diff --git a/third_party/python/gyp/test/make/main.cc b/third_party/python/gyp/test/make/main.cc
new file mode 100644
index 0000000000..3b9a705c24
--- /dev/null
+++ b/third_party/python/gyp/test/make/main.cc
@@ -0,0 +1,12 @@
+/* Copyright (c) 2009 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. */
+
+#include <stdio.h>
+
+#include "main.h"
+
+int main(void) {
+ printf("hello world\n");
+ return 0;
+}
diff --git a/third_party/python/gyp/test/make/main.h b/third_party/python/gyp/test/make/main.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/third_party/python/gyp/test/make/main.h
diff --git a/third_party/python/gyp/test/make/noload/all.gyp b/third_party/python/gyp/test/make/noload/all.gyp
new file mode 100644
index 0000000000..1617a9e97c
--- /dev/null
+++ b/third_party/python/gyp/test/make/noload/all.gyp
@@ -0,0 +1,18 @@
+# Copyright (c) 2010 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.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'exe',
+ 'type': 'executable',
+ 'sources': [
+ 'main.c',
+ ],
+ 'dependencies': [
+ 'lib/shared.gyp:shared',
+ ],
+ },
+ ],
+}
diff --git a/third_party/python/gyp/test/make/noload/lib/shared.c b/third_party/python/gyp/test/make/noload/lib/shared.c
new file mode 100644
index 0000000000..51776c5acf
--- /dev/null
+++ b/third_party/python/gyp/test/make/noload/lib/shared.c
@@ -0,0 +1,3 @@
+#include "shared.h"
+
+const char kSharedStr[] = "shared.c";
diff --git a/third_party/python/gyp/test/make/noload/lib/shared.gyp b/third_party/python/gyp/test/make/noload/lib/shared.gyp
new file mode 100644
index 0000000000..8a8841b3a0
--- /dev/null
+++ b/third_party/python/gyp/test/make/noload/lib/shared.gyp
@@ -0,0 +1,16 @@
+# Copyright (c) 2009 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.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'shared',
+ 'type': 'shared_library',
+ 'sources': [
+ 'shared.c',
+ 'shared.h',
+ ],
+ },
+ ],
+}
diff --git a/third_party/python/gyp/test/make/noload/lib/shared.h b/third_party/python/gyp/test/make/noload/lib/shared.h
new file mode 100644
index 0000000000..a21da7538b
--- /dev/null
+++ b/third_party/python/gyp/test/make/noload/lib/shared.h
@@ -0,0 +1 @@
+extern const char kSharedStr[];
diff --git a/third_party/python/gyp/test/make/noload/main.c b/third_party/python/gyp/test/make/noload/main.c
new file mode 100644
index 0000000000..26ec1889ad
--- /dev/null
+++ b/third_party/python/gyp/test/make/noload/main.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+#include "lib/shared.h"
+
+int main(void)
+{
+ printf("Hello from %s.\n", kSharedStr);
+ return 0;
+}