diff options
Diffstat (limited to 'third_party/python/gyp/test/configurations')
29 files changed, 671 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/configurations/basics/configurations.c b/third_party/python/gyp/test/configurations/basics/configurations.c new file mode 100644 index 0000000000..39e13c9c83 --- /dev/null +++ b/third_party/python/gyp/test/configurations/basics/configurations.c @@ -0,0 +1,15 @@ +#include <stdio.h> + +int main(void) +{ +#ifdef FOO + printf("Foo 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/basics/configurations.gyp b/third_party/python/gyp/test/configurations/basics/configurations.gyp new file mode 100644 index 0000000000..93f1d8d5c7 --- /dev/null +++ b/third_party/python/gyp/test/configurations/basics/configurations.gyp @@ -0,0 +1,32 @@ +# 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': 'configurations', + 'type': 'executable', + 'sources': [ + 'configurations.c', + ], + 'configurations': { + 'Debug': { + 'defines': [ + 'DEBUG', + ], + }, + 'Release': { + 'defines': [ + 'RELEASE', + ], + }, + 'Foo': { + 'defines': [ + 'FOO', + ], + }, + } + }, + ], +} diff --git a/third_party/python/gyp/test/configurations/basics/gyptest-configurations.py b/third_party/python/gyp/test/configurations/basics/gyptest-configurations.py new file mode 100755 index 0000000000..27cd2e87d2 --- /dev/null +++ b/third_party/python/gyp/test/configurations/basics/gyptest-configurations.py @@ -0,0 +1,29 @@ +#!/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="Release configuration\n") + +test.set_configuration('Debug') +test.build('configurations.gyp') +test.run_built_executable('configurations', stdout="Debug configuration\n") + +test.set_configuration('Foo') +test.build('configurations.gyp') +test.run_built_executable('configurations', stdout="Foo configuration\n") + +test.pass_test() 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() diff --git a/third_party/python/gyp/test/configurations/invalid/actions.gyp b/third_party/python/gyp/test/configurations/invalid/actions.gyp new file mode 100644 index 0000000000..a6e42089eb --- /dev/null +++ b/third_party/python/gyp/test/configurations/invalid/actions.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': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'actions': [ + ], + }, + } + }, + ], +} diff --git a/third_party/python/gyp/test/configurations/invalid/all_dependent_settings.gyp b/third_party/python/gyp/test/configurations/invalid/all_dependent_settings.gyp new file mode 100644 index 0000000000..b16a245df5 --- /dev/null +++ b/third_party/python/gyp/test/configurations/invalid/all_dependent_settings.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': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'all_dependent_settings': [ + ], + }, + } + }, + ], +} diff --git a/third_party/python/gyp/test/configurations/invalid/configurations.gyp b/third_party/python/gyp/test/configurations/invalid/configurations.gyp new file mode 100644 index 0000000000..2cfc960049 --- /dev/null +++ b/third_party/python/gyp/test/configurations/invalid/configurations.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': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'configurations': [ + ], + }, + } + }, + ], +} diff --git a/third_party/python/gyp/test/configurations/invalid/dependencies.gyp b/third_party/python/gyp/test/configurations/invalid/dependencies.gyp new file mode 100644 index 0000000000..74633f3f11 --- /dev/null +++ b/third_party/python/gyp/test/configurations/invalid/dependencies.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': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'dependencies': [ + ], + }, + } + }, + ], +} diff --git a/third_party/python/gyp/test/configurations/invalid/direct_dependent_settings.gyp b/third_party/python/gyp/test/configurations/invalid/direct_dependent_settings.gyp new file mode 100644 index 0000000000..8a0f2e95ea --- /dev/null +++ b/third_party/python/gyp/test/configurations/invalid/direct_dependent_settings.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': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'direct_dependent_settings': [ + ], + }, + } + }, + ], +} diff --git a/third_party/python/gyp/test/configurations/invalid/gyptest-configurations.py b/third_party/python/gyp/test/configurations/invalid/gyptest-configurations.py new file mode 100755 index 0000000000..bd844b95dd --- /dev/null +++ b/third_party/python/gyp/test/configurations/invalid/gyptest-configurations.py @@ -0,0 +1,36 @@ +#!/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. + +""" +Verifies build of an executable in three different configurations. +""" + +import TestGyp + +# Keys that do not belong inside a configuration dictionary. +invalid_configuration_keys = [ + 'actions', + 'all_dependent_settings', + 'configurations', + 'dependencies', + 'direct_dependent_settings', + 'libraries', + 'link_settings', + 'sources', + 'standalone_static_library', + 'target_name', + 'type', +] + +test = TestGyp.TestGyp() + +for test_key in invalid_configuration_keys: + test.run_gyp('%s.gyp' % test_key, status=1, stderr=None) + expect = ['%s not allowed in the Debug configuration, found in target ' + '%s.gyp:configurations#target' % (test_key, test_key)] + test.must_contain_all_lines(test.stderr(), expect) + +test.pass_test() diff --git a/third_party/python/gyp/test/configurations/invalid/libraries.gyp b/third_party/python/gyp/test/configurations/invalid/libraries.gyp new file mode 100644 index 0000000000..c4014ed406 --- /dev/null +++ b/third_party/python/gyp/test/configurations/invalid/libraries.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': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'libraries': [ + ], + }, + } + }, + ], +} diff --git a/third_party/python/gyp/test/configurations/invalid/link_settings.gyp b/third_party/python/gyp/test/configurations/invalid/link_settings.gyp new file mode 100644 index 0000000000..2f0e1c46f5 --- /dev/null +++ b/third_party/python/gyp/test/configurations/invalid/link_settings.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': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'link_settings': [ + ], + }, + } + }, + ], +} diff --git a/third_party/python/gyp/test/configurations/invalid/sources.gyp b/third_party/python/gyp/test/configurations/invalid/sources.gyp new file mode 100644 index 0000000000..b38cca0381 --- /dev/null +++ b/third_party/python/gyp/test/configurations/invalid/sources.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': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'sources': [ + ], + }, + } + }, + ], +} diff --git a/third_party/python/gyp/test/configurations/invalid/standalone_static_library.gyp b/third_party/python/gyp/test/configurations/invalid/standalone_static_library.gyp new file mode 100644 index 0000000000..2edb9febd6 --- /dev/null +++ b/third_party/python/gyp/test/configurations/invalid/standalone_static_library.gyp @@ -0,0 +1,17 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'standalone_static_library': 1, + }, + } + }, + ], +} diff --git a/third_party/python/gyp/test/configurations/invalid/target_name.gyp b/third_party/python/gyp/test/configurations/invalid/target_name.gyp new file mode 100644 index 0000000000..83baad95d6 --- /dev/null +++ b/third_party/python/gyp/test/configurations/invalid/target_name.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': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'target_name': [ + ], + }, + } + }, + ], +} diff --git a/third_party/python/gyp/test/configurations/invalid/type.gyp b/third_party/python/gyp/test/configurations/invalid/type.gyp new file mode 100644 index 0000000000..bc55898b89 --- /dev/null +++ b/third_party/python/gyp/test/configurations/invalid/type.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': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'type': [ + ], + }, + } + }, + ], +} diff --git a/third_party/python/gyp/test/configurations/target_platform/configurations.gyp b/third_party/python/gyp/test/configurations/target_platform/configurations.gyp new file mode 100644 index 0000000000..d15429f4e5 --- /dev/null +++ b/third_party/python/gyp/test/configurations/target_platform/configurations.gyp @@ -0,0 +1,58 @@ +# 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': { + 'Debug_Win32': { + 'msvs_configuration_platform': 'Win32', + }, + 'Debug_x64': { + 'msvs_configuration_platform': 'x64', + }, + }, + }, + 'targets': [ + { + 'target_name': 'left', + 'type': 'static_library', + 'sources': [ + 'left.c', + ], + 'configurations': { + 'Debug_Win32': { + 'msvs_target_platform': 'x64', + }, + }, + }, + { + 'target_name': 'right', + 'type': 'static_library', + 'sources': [ + 'right.c', + ], + }, + { + 'target_name': 'front_left', + 'type': 'executable', + 'dependencies': ['left'], + 'sources': [ + 'front.c', + ], + 'configurations': { + 'Debug_Win32': { + 'msvs_target_platform': 'x64', + }, + }, + }, + { + 'target_name': 'front_right', + 'type': 'executable', + 'dependencies': ['right'], + 'sources': [ + 'front.c', + ], + }, + ], +} diff --git a/third_party/python/gyp/test/configurations/target_platform/front.c b/third_party/python/gyp/test/configurations/target_platform/front.c new file mode 100644 index 0000000000..7a91689ff5 --- /dev/null +++ b/third_party/python/gyp/test/configurations/target_platform/front.c @@ -0,0 +1,8 @@ +#include <stdio.h> + +const char *message(void); + +int main(void) { + printf("%s\n", message()); + return 0; +} diff --git a/third_party/python/gyp/test/configurations/target_platform/gyptest-target_platform.py b/third_party/python/gyp/test/configurations/target_platform/gyptest-target_platform.py new file mode 100755 index 0000000000..1645d6ec08 --- /dev/null +++ b/third_party/python/gyp/test/configurations/target_platform/gyptest-target_platform.py @@ -0,0 +1,40 @@ +#!/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. + +""" +Tests the msvs specific msvs_target_platform option. +""" + +import TestGyp +import TestCommon + + +def RunX64(exe, stdout): + try: + test.run_built_executable(exe, stdout=stdout) + except WindowsError as e: + # Assume the exe is 64-bit if it can't load on 32-bit systems. + # Both versions of the error are required because different versions + # of python seem to return different errors for invalid exe type. + if e.errno != 193 and '[Error 193]' not in str(e): + raise + + +test = TestGyp.TestGyp(formats=['msvs']) + +test.run_gyp('configurations.gyp') + +test.set_configuration('Debug|x64') +test.build('configurations.gyp', rebuild=True) +RunX64('front_left', stdout=('left\n')) +RunX64('front_right', stdout=('right\n')) + +test.set_configuration('Debug|Win32') +test.build('configurations.gyp', rebuild=True) +RunX64('front_left', stdout=('left\n')) +test.run_built_executable('front_right', stdout=('right\n')) + +test.pass_test() diff --git a/third_party/python/gyp/test/configurations/target_platform/left.c b/third_party/python/gyp/test/configurations/target_platform/left.c new file mode 100644 index 0000000000..1ce2ea1227 --- /dev/null +++ b/third_party/python/gyp/test/configurations/target_platform/left.c @@ -0,0 +1,3 @@ +const char *message(void) { + return "left"; +} diff --git a/third_party/python/gyp/test/configurations/target_platform/right.c b/third_party/python/gyp/test/configurations/target_platform/right.c new file mode 100644 index 0000000000..b1578492fe --- /dev/null +++ b/third_party/python/gyp/test/configurations/target_platform/right.c @@ -0,0 +1,3 @@ +const char *message(void) { + return "right"; +} diff --git a/third_party/python/gyp/test/configurations/x64/configurations.c b/third_party/python/gyp/test/configurations/x64/configurations.c new file mode 100644 index 0000000000..37018438fc --- /dev/null +++ b/third_party/python/gyp/test/configurations/x64/configurations.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +int main(void) { + if (sizeof(void*) == 4) { + printf("Running Win32\n"); + } else if (sizeof(void*) == 8) { + printf("Running x64\n"); + } else { + printf("Unexpected platform\n"); + } + return 0; +} diff --git a/third_party/python/gyp/test/configurations/x64/configurations.gyp b/third_party/python/gyp/test/configurations/x64/configurations.gyp new file mode 100644 index 0000000000..8b0139f141 --- /dev/null +++ b/third_party/python/gyp/test/configurations/x64/configurations.gyp @@ -0,0 +1,38 @@ +# 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': { + 'Debug': { + 'msvs_configuration_platform': 'Win32', + }, + 'Debug_x64': { + 'inherit_from': ['Debug'], + 'msvs_configuration_platform': 'x64', + }, + }, + }, + 'targets': [ + { + 'target_name': 'configurations', + 'type': 'executable', + 'sources': [ + 'configurations.c', + ], + }, + { + 'target_name': 'configurations64', + 'type': 'executable', + 'sources': [ + 'configurations.c', + ], + 'configurations': { + 'Debug': { + 'msvs_target_platform': 'x64', + }, + }, + }, + ], +} diff --git a/third_party/python/gyp/test/configurations/x64/gyptest-x86.py b/third_party/python/gyp/test/configurations/x64/gyptest-x86.py new file mode 100755 index 0000000000..8675d8f7e7 --- /dev/null +++ b/third_party/python/gyp/test/configurations/x64/gyptest-x86.py @@ -0,0 +1,31 @@ +#!/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 build of an executable in three different configurations. +""" + +import TestGyp + +import sys + +formats = ['msvs'] +if sys.platform == 'win32': + formats += ['ninja'] +test = TestGyp.TestGyp(formats=formats) + +test.run_gyp('configurations.gyp') +test.set_configuration('Debug|Win32') +test.build('configurations.gyp', test.ALL) + +for machine, suffix in [('14C machine (x86)', ''), + ('8664 machine (x64)', '64')]: + output = test.run_dumpbin( + '/headers', test.built_file_path('configurations%s.exe' % suffix)) + if machine not in output: + test.fail_test() + +test.pass_test() |