summaryrefslogtreecommitdiffstats
path: root/media/webrtc/trunk/tools/gyp/test/include_dirs
diff options
context:
space:
mode:
Diffstat (limited to 'media/webrtc/trunk/tools/gyp/test/include_dirs')
-rwxr-xr-xmedia/webrtc/trunk/tools/gyp/test/include_dirs/gyptest-all.py43
-rwxr-xr-xmedia/webrtc/trunk/tools/gyp/test/include_dirs/gyptest-default.py43
-rw-r--r--media/webrtc/trunk/tools/gyp/test/include_dirs/src/inc.h1
-rw-r--r--media/webrtc/trunk/tools/gyp/test/include_dirs/src/inc1/include1.h1
-rw-r--r--media/webrtc/trunk/tools/gyp/test/include_dirs/src/includes.c19
-rw-r--r--media/webrtc/trunk/tools/gyp/test/include_dirs/src/includes.gyp27
-rw-r--r--media/webrtc/trunk/tools/gyp/test/include_dirs/src/shadow1/shadow.h1
-rw-r--r--media/webrtc/trunk/tools/gyp/test/include_dirs/src/shadow2/shadow.h1
-rw-r--r--media/webrtc/trunk/tools/gyp/test/include_dirs/src/subdir/inc.h1
-rw-r--r--media/webrtc/trunk/tools/gyp/test/include_dirs/src/subdir/inc2/include2.h1
-rw-r--r--media/webrtc/trunk/tools/gyp/test/include_dirs/src/subdir/subdir_includes.c14
-rw-r--r--media/webrtc/trunk/tools/gyp/test/include_dirs/src/subdir/subdir_includes.gyp20
12 files changed, 172 insertions, 0 deletions
diff --git a/media/webrtc/trunk/tools/gyp/test/include_dirs/gyptest-all.py b/media/webrtc/trunk/tools/gyp/test/include_dirs/gyptest-all.py
new file mode 100755
index 000000000..d64bc6a9c
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/include_dirs/gyptest-all.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+
+# 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.
+
+"""
+Verifies use of include_dirs when using an explicit build target of 'all'.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('includes.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+test.build('includes.gyp', test.ALL, chdir='relocate/src')
+
+expect = """\
+Hello from includes.c
+Hello from inc.h
+Hello from include1.h
+Hello from subdir/inc2/include2.h
+Hello from shadow2/shadow.h
+"""
+test.run_built_executable('includes', stdout=expect, chdir='relocate/src')
+
+if test.format == 'xcode':
+ chdir='relocate/src/subdir'
+else:
+ chdir='relocate/src'
+
+expect = """\
+Hello from subdir/subdir_includes.c
+Hello from subdir/inc.h
+Hello from include1.h
+Hello from subdir/inc2/include2.h
+"""
+test.run_built_executable('subdir_includes', stdout=expect, chdir=chdir)
+
+test.pass_test()
diff --git a/media/webrtc/trunk/tools/gyp/test/include_dirs/gyptest-default.py b/media/webrtc/trunk/tools/gyp/test/include_dirs/gyptest-default.py
new file mode 100755
index 000000000..fc6141587
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/include_dirs/gyptest-default.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+
+# 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.
+
+"""
+Verifies use of include_dirs when using the default build target.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('includes.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+test.build('includes.gyp', test.ALL, chdir='relocate/src')
+
+expect = """\
+Hello from includes.c
+Hello from inc.h
+Hello from include1.h
+Hello from subdir/inc2/include2.h
+Hello from shadow2/shadow.h
+"""
+test.run_built_executable('includes', stdout=expect, chdir='relocate/src')
+
+if test.format == 'xcode':
+ chdir='relocate/src/subdir'
+else:
+ chdir='relocate/src'
+
+expect = """\
+Hello from subdir/subdir_includes.c
+Hello from subdir/inc.h
+Hello from include1.h
+Hello from subdir/inc2/include2.h
+"""
+test.run_built_executable('subdir_includes', stdout=expect, chdir=chdir)
+
+test.pass_test()
diff --git a/media/webrtc/trunk/tools/gyp/test/include_dirs/src/inc.h b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/inc.h
new file mode 100644
index 000000000..0398d6915
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/inc.h
@@ -0,0 +1 @@
+#define INC_STRING "inc.h"
diff --git a/media/webrtc/trunk/tools/gyp/test/include_dirs/src/inc1/include1.h b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/inc1/include1.h
new file mode 100644
index 000000000..43356b5f4
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/inc1/include1.h
@@ -0,0 +1 @@
+#define INCLUDE1_STRING "include1.h"
diff --git a/media/webrtc/trunk/tools/gyp/test/include_dirs/src/includes.c b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/includes.c
new file mode 100644
index 000000000..6e2a23cdf
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/includes.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+#include "inc.h"
+#include "include1.h"
+#include "include2.h"
+#include "shadow.h"
+
+int main(void)
+{
+ printf("Hello from includes.c\n");
+ printf("Hello from %s\n", INC_STRING);
+ printf("Hello from %s\n", INCLUDE1_STRING);
+ printf("Hello from %s\n", INCLUDE2_STRING);
+ /* Test that include_dirs happen first: The gyp file has a -Ishadow1
+ cflag and an include_dir of shadow2. Including shadow.h should get
+ the shadow.h from the include_dir. */
+ printf("Hello from %s\n", SHADOW_STRING);
+ return 0;
+}
diff --git a/media/webrtc/trunk/tools/gyp/test/include_dirs/src/includes.gyp b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/includes.gyp
new file mode 100644
index 000000000..359269020
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/includes.gyp
@@ -0,0 +1,27 @@
+# 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': 'includes',
+ 'type': 'executable',
+ 'dependencies': [
+ 'subdir/subdir_includes.gyp:subdir_includes',
+ ],
+ 'cflags': [
+ '-Ishadow1',
+ ],
+ 'include_dirs': [
+ '.',
+ 'inc1',
+ 'shadow2',
+ 'subdir/inc2',
+ ],
+ 'sources': [
+ 'includes.c',
+ ],
+ },
+ ],
+}
diff --git a/media/webrtc/trunk/tools/gyp/test/include_dirs/src/shadow1/shadow.h b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/shadow1/shadow.h
new file mode 100644
index 000000000..80f6de20b
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/shadow1/shadow.h
@@ -0,0 +1 @@
+#define SHADOW_STRING "shadow1/shadow.h"
diff --git a/media/webrtc/trunk/tools/gyp/test/include_dirs/src/shadow2/shadow.h b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/shadow2/shadow.h
new file mode 100644
index 000000000..fad5ccd08
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/shadow2/shadow.h
@@ -0,0 +1 @@
+#define SHADOW_STRING "shadow2/shadow.h"
diff --git a/media/webrtc/trunk/tools/gyp/test/include_dirs/src/subdir/inc.h b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/subdir/inc.h
new file mode 100644
index 000000000..0a68d7b36
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/subdir/inc.h
@@ -0,0 +1 @@
+#define INC_STRING "subdir/inc.h"
diff --git a/media/webrtc/trunk/tools/gyp/test/include_dirs/src/subdir/inc2/include2.h b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/subdir/inc2/include2.h
new file mode 100644
index 000000000..721577eff
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/subdir/inc2/include2.h
@@ -0,0 +1 @@
+#define INCLUDE2_STRING "subdir/inc2/include2.h"
diff --git a/media/webrtc/trunk/tools/gyp/test/include_dirs/src/subdir/subdir_includes.c b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/subdir/subdir_includes.c
new file mode 100644
index 000000000..4623543c4
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/subdir/subdir_includes.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+#include "inc.h"
+#include "include1.h"
+#include "include2.h"
+
+int main(void)
+{
+ printf("Hello from subdir/subdir_includes.c\n");
+ printf("Hello from %s\n", INC_STRING);
+ printf("Hello from %s\n", INCLUDE1_STRING);
+ printf("Hello from %s\n", INCLUDE2_STRING);
+ return 0;
+}
diff --git a/media/webrtc/trunk/tools/gyp/test/include_dirs/src/subdir/subdir_includes.gyp b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/subdir/subdir_includes.gyp
new file mode 100644
index 000000000..257d052c3
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/include_dirs/src/subdir/subdir_includes.gyp
@@ -0,0 +1,20 @@
+# 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': 'subdir_includes',
+ 'type': 'executable',
+ 'include_dirs': [
+ '.',
+ '../inc1',
+ 'inc2',
+ ],
+ 'sources': [
+ 'subdir_includes.c',
+ ],
+ },
+ ],
+}