summaryrefslogtreecommitdiffstats
path: root/third_party/python/gyp/test/configurations/inheritance
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/python/gyp/test/configurations/inheritance')
-rw-r--r--third_party/python/gyp/test/configurations/inheritance/configurations.c21
-rw-r--r--third_party/python/gyp/test/configurations/inheritance/configurations.gyp40
-rw-r--r--third_party/python/gyp/test/configurations/inheritance/duplicates.gyp27
-rw-r--r--third_party/python/gyp/test/configurations/inheritance/duplicates.gypd.golden12
-rwxr-xr-xthird_party/python/gyp/test/configurations/inheritance/gyptest-duplicates.py36
-rwxr-xr-xthird_party/python/gyp/test/configurations/inheritance/gyptest-inheritance.py33
6 files changed, 169 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/configurations/inheritance/configurations.c b/third_party/python/gyp/test/configurations/inheritance/configurations.c
new file mode 100644
index 0000000000..ebb9f8450e
--- /dev/null
+++ b/third_party/python/gyp/test/configurations/inheritance/configurations.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+int main(void)
+{
+#ifdef BASE
+ printf("Base configuration\n");
+#endif
+#ifdef COMMON
+ printf("Common configuration\n");
+#endif
+#ifdef COMMON2
+ printf("Common2 configuration\n");
+#endif
+#ifdef DEBUG
+ printf("Debug configuration\n");
+#endif
+#ifdef RELEASE
+ printf("Release configuration\n");
+#endif
+ return 0;
+}
diff --git a/third_party/python/gyp/test/configurations/inheritance/configurations.gyp b/third_party/python/gyp/test/configurations/inheritance/configurations.gyp
new file mode 100644
index 0000000000..9441376b4d
--- /dev/null
+++ b/third_party/python/gyp/test/configurations/inheritance/configurations.gyp
@@ -0,0 +1,40 @@
+# 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.
+
+{
+ 'target_defaults': {
+ 'configurations': {
+ 'Base': {
+ 'abstract': 1,
+ 'defines': ['BASE'],
+ },
+ 'Common': {
+ 'abstract': 1,
+ 'inherit_from': ['Base'],
+ 'defines': ['COMMON'],
+ },
+ 'Common2': {
+ 'abstract': 1,
+ 'defines': ['COMMON2'],
+ },
+ 'Debug': {
+ 'inherit_from': ['Common', 'Common2'],
+ 'defines': ['DEBUG'],
+ },
+ 'Release': {
+ 'inherit_from': ['Common', 'Common2'],
+ 'defines': ['RELEASE'],
+ },
+ },
+ },
+ 'targets': [
+ {
+ 'target_name': 'configurations',
+ 'type': 'executable',
+ 'sources': [
+ 'configurations.c',
+ ],
+ },
+ ],
+}
diff --git a/third_party/python/gyp/test/configurations/inheritance/duplicates.gyp b/third_party/python/gyp/test/configurations/inheritance/duplicates.gyp
new file mode 100644
index 0000000000..6930ce3b39
--- /dev/null
+++ b/third_party/python/gyp/test/configurations/inheritance/duplicates.gyp
@@ -0,0 +1,27 @@
+# Copyright 2014 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.
+
+{
+ 'target_defaults': {
+ 'default_configuration': 'A',
+ 'configurations': {
+ 'A': {
+ 'defines': ['SOMETHING'],
+ },
+ 'B': {
+ 'inherit_from': ['A'],
+ },
+ },
+ 'cflags': ['-g'],
+ },
+ 'targets': [
+ {
+ 'target_name': 'configurations',
+ 'type': 'executable',
+ 'sources': [
+ 'configurations.c',
+ ],
+ },
+ ],
+}
diff --git a/third_party/python/gyp/test/configurations/inheritance/duplicates.gypd.golden b/third_party/python/gyp/test/configurations/inheritance/duplicates.gypd.golden
new file mode 100644
index 0000000000..719b70861e
--- /dev/null
+++ b/third_party/python/gyp/test/configurations/inheritance/duplicates.gypd.golden
@@ -0,0 +1,12 @@
+{'_DEPTH': '.',
+ 'included_files': ['duplicates.gyp'],
+ 'targets': [{'configurations': {'A': {'cflags': ['-g'],
+ 'defines': ['SOMETHING']},
+ 'B': {'cflags': ['-g'],
+ 'defines': ['SOMETHING'],
+ 'inherit_from': ['A']}},
+ 'default_configuration': 'A',
+ 'sources': ['configurations.c'],
+ 'target_name': 'configurations',
+ 'toolset': 'target',
+ 'type': 'executable'}]}
diff --git a/third_party/python/gyp/test/configurations/inheritance/gyptest-duplicates.py b/third_party/python/gyp/test/configurations/inheritance/gyptest-duplicates.py
new file mode 100755
index 0000000000..f015638b6d
--- /dev/null
+++ b/third_party/python/gyp/test/configurations/inheritance/gyptest-duplicates.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+
+# Copyright 2014 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 configurations do not duplicate other settings.
+"""
+
+from __future__ import print_function
+
+import TestGyp
+
+test = TestGyp.TestGyp(format='gypd')
+
+test.run_gyp('duplicates.gyp')
+
+# Verify the duplicates.gypd against the checked-in expected contents.
+#
+# Normally, we should canonicalize line endings in the expected
+# contents file setting the Subversion svn:eol-style to native,
+# but that would still fail if multiple systems are sharing a single
+# workspace on a network-mounted file system. Consequently, we
+# massage the Windows line endings ('\r\n') in the output to the
+# checked-in UNIX endings ('\n').
+
+contents = test.read('duplicates.gypd').replace(
+ '\r', '').replace('\\\\', '/')
+expect = test.read('duplicates.gypd.golden').replace('\r', '')
+if not test.match(contents, expect):
+ print("Unexpected contents of `duplicates.gypd'")
+ test.diff(expect, contents, 'duplicates.gypd ')
+ test.fail_test()
+
+test.pass_test()
diff --git a/third_party/python/gyp/test/configurations/inheritance/gyptest-inheritance.py b/third_party/python/gyp/test/configurations/inheritance/gyptest-inheritance.py
new file mode 100755
index 0000000000..22c73a3754
--- /dev/null
+++ b/third_party/python/gyp/test/configurations/inheritance/gyptest-inheritance.py
@@ -0,0 +1,33 @@
+#!/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 build of an executable in three different configurations.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('configurations.gyp')
+
+test.set_configuration('Release')
+test.build('configurations.gyp')
+test.run_built_executable('configurations',
+ stdout=('Base configuration\n'
+ 'Common configuration\n'
+ 'Common2 configuration\n'
+ 'Release configuration\n'))
+
+test.set_configuration('Debug')
+test.build('configurations.gyp')
+test.run_built_executable('configurations',
+ stdout=('Base configuration\n'
+ 'Common configuration\n'
+ 'Common2 configuration\n'
+ 'Debug configuration\n'))
+
+test.pass_test()