diff options
Diffstat (limited to 'third_party/python/gyp/test/dependencies')
30 files changed, 586 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/dependencies/a.c b/third_party/python/gyp/test/dependencies/a.c new file mode 100755 index 0000000000..3bba111d24 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/a.c @@ -0,0 +1,9 @@ +/* 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. */ + +extern int funcB(); + +int funcA() { + return funcB(); +} diff --git a/third_party/python/gyp/test/dependencies/adso/all_dependent_settings_order.gyp b/third_party/python/gyp/test/dependencies/adso/all_dependent_settings_order.gyp new file mode 100644 index 0000000000..89817d6bbb --- /dev/null +++ b/third_party/python/gyp/test/dependencies/adso/all_dependent_settings_order.gyp @@ -0,0 +1,45 @@ +{ + 'targets': [ + { + 'target_name': 'a', + 'type': 'none', + 'sources': ['a.cc'], + 'all_dependent_settings': {'sources': ['a.cc']}, + }, + { + 'target_name': 'b', + 'type': 'none', + 'sources': ['b.cc'], + 'all_dependent_settings': {'sources': ['b.cc']}, + 'dependencies': ['a'], + }, + + { + 'target_name': 'c', + 'type': 'none', + 'sources': ['c.cc'], + 'all_dependent_settings': {'sources': ['c.cc']}, + 'dependencies': ['b', 'a'], + }, + { + 'target_name': 'd', + 'type': 'none', + 'sources': ['d.cc'], + 'dependencies': ['c', 'a', 'b'], + 'actions': [ + { + 'action_name': 'write_sources', + 'inputs': ['write_args.py'], + 'outputs': ['<(PRODUCT_DIR)/out.txt'], + 'action': [ + 'python', + 'write_args.py', + '<(PRODUCT_DIR)/out.txt', + '>@(_sources)' + ], + 'msvs_cygwin_shell': 0, + }, + ], + }, + ], +} diff --git a/third_party/python/gyp/test/dependencies/adso/write_args.py b/third_party/python/gyp/test/dependencies/adso/write_args.py new file mode 100755 index 0000000000..5e388b8f70 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/adso/write_args.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +# Copyright 2015 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. + +import sys + +f = open(sys.argv[1], 'w') +f.write(' '.join(sys.argv[2:])) +f.close() diff --git a/third_party/python/gyp/test/dependencies/b/b.c b/third_party/python/gyp/test/dependencies/b/b.c new file mode 100755 index 0000000000..b5e771bcc7 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/b/b.c @@ -0,0 +1,3 @@ +int funcB() { + return 2; +} diff --git a/third_party/python/gyp/test/dependencies/b/b.gyp b/third_party/python/gyp/test/dependencies/b/b.gyp new file mode 100755 index 0000000000..893dc64d65 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/b/b.gyp @@ -0,0 +1,22 @@ +# 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': 'b', + 'type': 'static_library', + 'sources': [ + 'b.c', + ], + }, + { + 'target_name': 'b3', + 'type': 'static_library', + 'sources': [ + 'b3.c', + ], + }, + ], +} diff --git a/third_party/python/gyp/test/dependencies/b/b3.c b/third_party/python/gyp/test/dependencies/b/b3.c new file mode 100755 index 0000000000..287f67ff31 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/b/b3.c @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2011 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. + */ + +int funcB() { + return 3; +} diff --git a/third_party/python/gyp/test/dependencies/c/c.c b/third_party/python/gyp/test/dependencies/c/c.c new file mode 100644 index 0000000000..4949daf3ee --- /dev/null +++ b/third_party/python/gyp/test/dependencies/c/c.c @@ -0,0 +1,4 @@ +int funcC() { + return 3 + // Intentional syntax error. This file should never be compiled, so this + // shouldn't be a problem. diff --git a/third_party/python/gyp/test/dependencies/c/c.gyp b/third_party/python/gyp/test/dependencies/c/c.gyp new file mode 100644 index 0000000000..eabebea9ef --- /dev/null +++ b/third_party/python/gyp/test/dependencies/c/c.gyp @@ -0,0 +1,22 @@ +# 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': 'c_unused', + 'type': 'static_library', + 'sources': [ + 'c.c', + ], + }, + { + 'target_name': 'd', + 'type': 'static_library', + 'sources': [ + 'd.c', + ], + }, + ], +} diff --git a/third_party/python/gyp/test/dependencies/c/d.c b/third_party/python/gyp/test/dependencies/c/d.c new file mode 100644 index 0000000000..05465fc1af --- /dev/null +++ b/third_party/python/gyp/test/dependencies/c/d.c @@ -0,0 +1,3 @@ +int funcD() { + return 4; +} diff --git a/third_party/python/gyp/test/dependencies/double_dependency.gyp b/third_party/python/gyp/test/dependencies/double_dependency.gyp new file mode 100644 index 0000000000..c4a2d00139 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/double_dependency.gyp @@ -0,0 +1,23 @@ +# 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': 'double_dependency', + 'type': 'shared_library', + 'dependencies': [ + 'double_dependent.gyp:double_dependent', + ], + 'conditions': [ + ['1==1', { + 'dependencies': [ + 'double_dependent.gyp:*', + ], + }], + ], + }, + ], +} + diff --git a/third_party/python/gyp/test/dependencies/double_dependent.gyp b/third_party/python/gyp/test/dependencies/double_dependent.gyp new file mode 100644 index 0000000000..334caff723 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/double_dependent.gyp @@ -0,0 +1,12 @@ +# 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': 'double_dependent', + 'type': 'none', + }, + ], +} diff --git a/third_party/python/gyp/test/dependencies/extra_targets.gyp b/third_party/python/gyp/test/dependencies/extra_targets.gyp new file mode 100644 index 0000000000..c1a26de422 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/extra_targets.gyp @@ -0,0 +1,18 @@ +# 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': 'a', + 'type': 'static_library', + 'sources': [ + 'a.c', + ], + # This only depends on the "d" target; other targets in c.gyp + # should not become part of the build (unlike with 'c/c.gyp:*'). + 'dependencies': ['c/c.gyp:d'], + }, + ], +} diff --git a/third_party/python/gyp/test/dependencies/gyptest-all-dependent-settings-order.py b/third_party/python/gyp/test/dependencies/gyptest-all-dependent-settings-order.py new file mode 100644 index 0000000000..715f322f41 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/gyptest-all-dependent-settings-order.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +# Copyright 2015 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 that all_dependent_settings are processed in topological order. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('all_dependent_settings_order.gyp', chdir='adso') +test.build('all_dependent_settings_order.gyp', chdir='adso') +test.built_file_must_match('out.txt', 'd.cc a.cc b.cc c.cc', + chdir='adso') +test.pass_test() diff --git a/third_party/python/gyp/test/dependencies/gyptest-double-dependency.py b/third_party/python/gyp/test/dependencies/gyptest-double-dependency.py new file mode 100644 index 0000000000..7692740c54 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/gyptest-double-dependency.py @@ -0,0 +1,19 @@ +#!/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. + +""" +Verify that pulling in a dependency a second time in a conditional works for +shared_library targets. Regression test for http://crbug.com/122588 +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('double_dependency.gyp') + +# If running gyp worked, all is well. +test.pass_test() diff --git a/third_party/python/gyp/test/dependencies/gyptest-extra-targets.py b/third_party/python/gyp/test/dependencies/gyptest-extra-targets.py new file mode 100755 index 0000000000..09b00d958b --- /dev/null +++ b/third_party/python/gyp/test/dependencies/gyptest-extra-targets.py @@ -0,0 +1,22 @@ +#!/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. + +""" +Verify that dependencies don't pull unused targets into the build. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('extra_targets.gyp', + '-G', 'xcode_ninja_target_pattern=^a$') + +# This should fail if it tries to build 'c_unused' since 'c/c.c' has a syntax +# error and won't compile. +test.build('extra_targets.gyp', test.ALL) + +test.pass_test() diff --git a/third_party/python/gyp/test/dependencies/gyptest-indirect-module-dependency.py b/third_party/python/gyp/test/dependencies/gyptest-indirect-module-dependency.py new file mode 100644 index 0000000000..d001b57e7d --- /dev/null +++ b/third_party/python/gyp/test/dependencies/gyptest-indirect-module-dependency.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Copyright (c) 2015 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. + +""" +Make sure that we cause downstream modules to get built when we depend on the +parent targets. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +CHDIR = 'module-dep' +test.run_gyp('indirect-module-dependency.gyp', chdir=CHDIR) +test.build('indirect-module-dependency.gyp', 'an_exe', chdir=CHDIR) +test.built_file_must_exist( + test.built_file_basename('a_module', test.LOADABLE_MODULE), chdir=CHDIR) + +test.pass_test() diff --git a/third_party/python/gyp/test/dependencies/gyptest-lib-only.py b/third_party/python/gyp/test/dependencies/gyptest-lib-only.py new file mode 100755 index 0000000000..3a99a7f4aa --- /dev/null +++ b/third_party/python/gyp/test/dependencies/gyptest-lib-only.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 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. + +""" +Verify that a link time only dependency will get pulled into the set of built +targets, even if no executable uses it. +""" + +import TestGyp + +import sys + +test = TestGyp.TestGyp() + +test.run_gyp('lib_only.gyp') + +test.build('lib_only.gyp', test.ALL) + +test.built_file_must_exist('a', type=test.STATIC_LIB) + +# TODO(bradnelson/mark): +# On linux and windows a library target will at least pull its link dependencies +# into the generated project, since not doing so confuses users. +# This is not currently implemented on mac, which has the opposite behavior. +if sys.platform == 'darwin': + if test.format == 'xcode': + test.built_file_must_not_exist('b', type=test.STATIC_LIB) + else: + assert test.format in ('make', 'ninja', 'xcode-ninja') + test.built_file_must_exist('b', type=test.STATIC_LIB) +else: + # Make puts the resulting library in a directory matching the input gyp file; + # for the 'b' library, that is in the 'b' subdirectory. + test.built_file_must_exist('b', type=test.STATIC_LIB, subdir='b') + +test.pass_test() diff --git a/third_party/python/gyp/test/dependencies/gyptest-none-traversal.py b/third_party/python/gyp/test/dependencies/gyptest-none-traversal.py new file mode 100755 index 0000000000..c09063dad3 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/gyptest-none-traversal.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 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. + +""" +Verify that static library dependencies don't traverse none targets, unless +explicitly specified. +""" + +import TestGyp + +import sys + +test = TestGyp.TestGyp() + +test.run_gyp('none_traversal.gyp') + +test.build('none_traversal.gyp', test.ALL) + +test.run_built_executable('needs_chain', stdout="2\n") +test.run_built_executable('doesnt_need_chain', stdout="3\n") + +test.pass_test() diff --git a/third_party/python/gyp/test/dependencies/gyptest-sharedlib-linksettings.py b/third_party/python/gyp/test/dependencies/gyptest-sharedlib-linksettings.py new file mode 100644 index 0000000000..87428af459 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/gyptest-sharedlib-linksettings.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +# Copyright (c) 2013 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. + +""" +Verify that link_settings in a shared_library are not propagated to targets +that depend on the shared_library, but are used in the shared_library itself. +""" + +import TestGyp +import sys + +CHDIR='sharedlib-linksettings' + +test = TestGyp.TestGyp() +test.run_gyp('test.gyp', chdir=CHDIR) +test.build('test.gyp', test.ALL, chdir=CHDIR) +test.run_built_executable('program', stdout="1\n2\n", chdir=CHDIR) +test.pass_test() diff --git a/third_party/python/gyp/test/dependencies/lib_only.gyp b/third_party/python/gyp/test/dependencies/lib_only.gyp new file mode 100755 index 0000000000..f6c84dea64 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/lib_only.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': 'a', + 'type': 'static_library', + 'sources': [ + 'a.c', + ], + 'dependencies': ['b/b.gyp:b'], + }, + ], +} diff --git a/third_party/python/gyp/test/dependencies/main.c b/third_party/python/gyp/test/dependencies/main.c new file mode 100644 index 0000000000..185bd482f2 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/main.c @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2011 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> + +extern int funcA(); + +int main() { + printf("%d\n", funcA()); + return 0; +} diff --git a/third_party/python/gyp/test/dependencies/module-dep/a.cc b/third_party/python/gyp/test/dependencies/module-dep/a.cc new file mode 100644 index 0000000000..231fc7a9df --- /dev/null +++ b/third_party/python/gyp/test/dependencies/module-dep/a.cc @@ -0,0 +1,7 @@ +// Copyright (c) 2015 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. + +int some_function() { + return 0; +} diff --git a/third_party/python/gyp/test/dependencies/module-dep/dll.cc b/third_party/python/gyp/test/dependencies/module-dep/dll.cc new file mode 100644 index 0000000000..e1eea0205b --- /dev/null +++ b/third_party/python/gyp/test/dependencies/module-dep/dll.cc @@ -0,0 +1,9 @@ +// Copyright (c) 2015 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. + +#if defined(_MSC_VER) +__declspec(dllexport) +#endif + void SomeFunction() { +} diff --git a/third_party/python/gyp/test/dependencies/module-dep/exe.cc b/third_party/python/gyp/test/dependencies/module-dep/exe.cc new file mode 100644 index 0000000000..b3039ace96 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/module-dep/exe.cc @@ -0,0 +1,7 @@ +// Copyright (c) 2015 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. + +int main() { + return 0; +} diff --git a/third_party/python/gyp/test/dependencies/module-dep/indirect-module-dependency.gyp b/third_party/python/gyp/test/dependencies/module-dep/indirect-module-dependency.gyp new file mode 100644 index 0000000000..f3fb5320fe --- /dev/null +++ b/third_party/python/gyp/test/dependencies/module-dep/indirect-module-dependency.gyp @@ -0,0 +1,37 @@ +# Copyright (c) 2015 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': 'an_exe', + 'type': 'executable', + 'sources': ['exe.cc'], + 'dependencies': [ + 'a_dll', + ], + }, + { + 'target_name': 'a_dll', + 'type': 'shared_library', + 'sources': ['dll.cc'], + 'dependencies': [ + 'a_lib', + ], + }, + { + 'target_name': 'a_lib', + 'type': 'static_library', + 'dependencies': [ + 'a_module', + ], + 'sources': ['a.cc'], + }, + { + 'target_name': 'a_module', + 'type': 'loadable_module', + 'sources': ['a.cc'], + }, + ] +} diff --git a/third_party/python/gyp/test/dependencies/none_traversal.gyp b/third_party/python/gyp/test/dependencies/none_traversal.gyp new file mode 100755 index 0000000000..3d8ab30aff --- /dev/null +++ b/third_party/python/gyp/test/dependencies/none_traversal.gyp @@ -0,0 +1,46 @@ +# 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': 'needs_chain', + 'type': 'executable', + 'sources': [ + 'a.c', + 'main.c', + ], + 'dependencies': ['chain'], + }, + { + 'target_name': 'chain', + 'type': 'none', + 'dependencies': ['b/b.gyp:b'], + }, + { + 'target_name': 'doesnt_need_chain', + 'type': 'executable', + 'sources': [ + 'main.c', + ], + 'dependencies': ['no_chain', 'other_chain'], + }, + { + 'target_name': 'no_chain', + 'type': 'none', + 'sources': [ + ], + 'dependencies': ['b/b.gyp:b'], + 'dependencies_traverse': 0, + }, + { + 'target_name': 'other_chain', + 'type': 'static_library', + 'sources': [ + 'a.c', + ], + 'dependencies': ['b/b.gyp:b3'], + }, + ], +} diff --git a/third_party/python/gyp/test/dependencies/sharedlib-linksettings/program.c b/third_party/python/gyp/test/dependencies/sharedlib-linksettings/program.c new file mode 100644 index 0000000000..b7c15edcd6 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/sharedlib-linksettings/program.c @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2013 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> + +/* + * This will fail to compile if TEST_DEFINE was propagated from sharedlib to + * program. + */ +#ifdef TEST_DEFINE +#error TEST_DEFINE is already defined! +#endif + +#define TEST_DEFINE 2 + +extern int staticLibFunc(); + +int main() { + printf("%d\n", staticLibFunc()); + printf("%d\n", TEST_DEFINE); + return 0; +} diff --git a/third_party/python/gyp/test/dependencies/sharedlib-linksettings/sharedlib.c b/third_party/python/gyp/test/dependencies/sharedlib-linksettings/sharedlib.c new file mode 100644 index 0000000000..3199bccd66 --- /dev/null +++ b/third_party/python/gyp/test/dependencies/sharedlib-linksettings/sharedlib.c @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2013 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. + */ + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int sharedLibFunc() { + /* + * This will fail to compile if TEST_DEFINE was not obtained from sharedlib's + * link_settings. + */ + return TEST_DEFINE; +} diff --git a/third_party/python/gyp/test/dependencies/sharedlib-linksettings/staticlib.c b/third_party/python/gyp/test/dependencies/sharedlib-linksettings/staticlib.c new file mode 100644 index 0000000000..e889b419fd --- /dev/null +++ b/third_party/python/gyp/test/dependencies/sharedlib-linksettings/staticlib.c @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2013 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. + */ + +/* + * This will fail to compile if TEST_DEFINE was propagated from sharedlib to + * staticlib. + */ +#ifdef TEST_DEFINE +#error TEST_DEFINE is defined! +#endif + +#ifdef _WIN32 +__declspec(dllimport) +#else +extern +#endif +int sharedLibFunc(); + +int staticLibFunc() { + return sharedLibFunc(); +} diff --git a/third_party/python/gyp/test/dependencies/sharedlib-linksettings/test.gyp b/third_party/python/gyp/test/dependencies/sharedlib-linksettings/test.gyp new file mode 100644 index 0000000000..830ce3236d --- /dev/null +++ b/third_party/python/gyp/test/dependencies/sharedlib-linksettings/test.gyp @@ -0,0 +1,37 @@ +# Copyright (c) 2013 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': { + 'allow_sharedlib_linksettings_propagation': 0, + }, + 'targets': [ + { + 'target_name': 'sharedlib', + 'type': 'shared_library', + 'sources': [ 'sharedlib.c' ], + 'link_settings': { + 'defines': [ 'TEST_DEFINE=1' ], + }, + 'conditions': [ + ['OS=="linux"', { + # Support 64-bit shared libs (also works fine for 32-bit). + 'cflags': ['-fPIC'], + }], + ], + }, + { + 'target_name': 'staticlib', + 'type': 'static_library', + 'sources': [ 'staticlib.c' ], + 'dependencies': [ 'sharedlib' ], + }, + { + 'target_name': 'program', + 'type': 'executable', + 'sources': [ 'program.c' ], + 'dependencies': [ 'staticlib' ], + }, + ], +} |