From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../gyp/test/msvs/buildevents/buildevents.gyp | 14 +++++ .../gyptest-msbuild-supports-prepostbuild.py | 24 ++++++++ .../msvs/buildevents/gyptest-ninja-warnings.py | 29 +++++++++ .../python/gyp/test/msvs/buildevents/main.cc | 5 ++ .../test/msvs/config_attrs/gyptest-config_attrs.py | 41 +++++++++++++ .../python/gyp/test/msvs/config_attrs/hello.c | 11 ++++ .../python/gyp/test/msvs/config_attrs/hello.gyp | 21 +++++++ .../python/gyp/test/msvs/express/base/base.gyp | 22 +++++++ .../python/gyp/test/msvs/express/express.gyp | 19 ++++++ .../gyp/test/msvs/express/gyptest-express.py | 29 +++++++++ .../gyp/test/msvs/external_builder/external.gyp | 68 ++++++++++++++++++++++ .../test/msvs/external_builder/external_builder.py | 9 +++ .../gyp/test/msvs/external_builder/gyptest-all.py | 59 +++++++++++++++++++ .../gyp/test/msvs/external_builder/hello.cpp | 10 ++++ .../python/gyp/test/msvs/external_builder/hello.z | 6 ++ .../test/msvs/external_builder/msbuild_action.py | 9 +++ .../gyp/test/msvs/external_builder/msbuild_rule.py | 11 ++++ .../python/gyp/test/msvs/filters/filters.gyp | 47 +++++++++++++++ .../gyp/test/msvs/filters/gyptest-filters-2008.py | 68 ++++++++++++++++++++++ .../gyp/test/msvs/filters/gyptest-filters-2010.py | 57 ++++++++++++++++++ .../gyp/test/msvs/list_excluded/gyptest-all.py | 51 ++++++++++++++++ .../python/gyp/test/msvs/list_excluded/hello.cpp | 10 ++++ .../gyp/test/msvs/list_excluded/hello_exclude.gyp | 19 ++++++ .../gyp/test/msvs/list_excluded/hello_mac.cpp | 10 ++++ .../test/msvs/missing_sources/gyptest-missing.py | 43 ++++++++++++++ .../test/msvs/missing_sources/hello_missing.gyp | 15 +++++ .../multiple_actions_error_handling/action_fail.py | 7 +++ .../action_succeed.py | 7 +++ .../multiple_actions_error_handling/actions.gyp | 40 +++++++++++++ .../multiple_actions_error_handling/gyptest.py | 26 +++++++++ .../python/gyp/test/msvs/props/AppName.props | 14 +++++ .../python/gyp/test/msvs/props/AppName.vsprops | 11 ++++ .../python/gyp/test/msvs/props/gyptest-props.py | 22 +++++++ third_party/python/gyp/test/msvs/props/hello.c | 11 ++++ third_party/python/gyp/test/msvs/props/hello.gyp | 22 +++++++ .../gyp/test/msvs/rules_stdout_stderr/dummy.bar | 5 ++ .../gyp/test/msvs/rules_stdout_stderr/dummy.foo | 5 ++ .../gyptest-rules-stdout-stderr.py | 29 +++++++++ .../test/msvs/rules_stdout_stderr/rule_stderr.py | 8 +++ .../test/msvs/rules_stdout_stderr/rule_stdout.py | 7 +++ .../rules_stdout_stderr/rules-stdout-stderr.gyp | 52 +++++++++++++++++ .../python/gyp/test/msvs/shared_output/common.gypi | 17 ++++++ .../msvs/shared_output/gyptest-shared_output.py | 41 +++++++++++++ .../python/gyp/test/msvs/shared_output/hello.c | 12 ++++ .../python/gyp/test/msvs/shared_output/hello.gyp | 21 +++++++ .../gyp/test/msvs/shared_output/there/there.c | 12 ++++ .../gyp/test/msvs/shared_output/there/there.gyp | 16 +++++ .../python/gyp/test/msvs/uldi2010/gyptest-all.py | 20 +++++++ third_party/python/gyp/test/msvs/uldi2010/hello.c | 13 +++++ .../python/gyp/test/msvs/uldi2010/hello.gyp | 26 +++++++++ third_party/python/gyp/test/msvs/uldi2010/hello2.c | 10 ++++ 51 files changed, 1161 insertions(+) create mode 100644 third_party/python/gyp/test/msvs/buildevents/buildevents.gyp create mode 100755 third_party/python/gyp/test/msvs/buildevents/gyptest-msbuild-supports-prepostbuild.py create mode 100755 third_party/python/gyp/test/msvs/buildevents/gyptest-ninja-warnings.py create mode 100644 third_party/python/gyp/test/msvs/buildevents/main.cc create mode 100644 third_party/python/gyp/test/msvs/config_attrs/gyptest-config_attrs.py create mode 100644 third_party/python/gyp/test/msvs/config_attrs/hello.c create mode 100644 third_party/python/gyp/test/msvs/config_attrs/hello.gyp create mode 100644 third_party/python/gyp/test/msvs/express/base/base.gyp create mode 100644 third_party/python/gyp/test/msvs/express/express.gyp create mode 100755 third_party/python/gyp/test/msvs/express/gyptest-express.py create mode 100644 third_party/python/gyp/test/msvs/external_builder/external.gyp create mode 100644 third_party/python/gyp/test/msvs/external_builder/external_builder.py create mode 100644 third_party/python/gyp/test/msvs/external_builder/gyptest-all.py create mode 100644 third_party/python/gyp/test/msvs/external_builder/hello.cpp create mode 100644 third_party/python/gyp/test/msvs/external_builder/hello.z create mode 100644 third_party/python/gyp/test/msvs/external_builder/msbuild_action.py create mode 100644 third_party/python/gyp/test/msvs/external_builder/msbuild_rule.py create mode 100644 third_party/python/gyp/test/msvs/filters/filters.gyp create mode 100644 third_party/python/gyp/test/msvs/filters/gyptest-filters-2008.py create mode 100644 third_party/python/gyp/test/msvs/filters/gyptest-filters-2010.py create mode 100644 third_party/python/gyp/test/msvs/list_excluded/gyptest-all.py create mode 100644 third_party/python/gyp/test/msvs/list_excluded/hello.cpp create mode 100644 third_party/python/gyp/test/msvs/list_excluded/hello_exclude.gyp create mode 100644 third_party/python/gyp/test/msvs/list_excluded/hello_mac.cpp create mode 100644 third_party/python/gyp/test/msvs/missing_sources/gyptest-missing.py create mode 100644 third_party/python/gyp/test/msvs/missing_sources/hello_missing.gyp create mode 100644 third_party/python/gyp/test/msvs/multiple_actions_error_handling/action_fail.py create mode 100644 third_party/python/gyp/test/msvs/multiple_actions_error_handling/action_succeed.py create mode 100644 third_party/python/gyp/test/msvs/multiple_actions_error_handling/actions.gyp create mode 100644 third_party/python/gyp/test/msvs/multiple_actions_error_handling/gyptest.py create mode 100644 third_party/python/gyp/test/msvs/props/AppName.props create mode 100644 third_party/python/gyp/test/msvs/props/AppName.vsprops create mode 100644 third_party/python/gyp/test/msvs/props/gyptest-props.py create mode 100644 third_party/python/gyp/test/msvs/props/hello.c create mode 100644 third_party/python/gyp/test/msvs/props/hello.gyp create mode 100644 third_party/python/gyp/test/msvs/rules_stdout_stderr/dummy.bar create mode 100644 third_party/python/gyp/test/msvs/rules_stdout_stderr/dummy.foo create mode 100644 third_party/python/gyp/test/msvs/rules_stdout_stderr/gyptest-rules-stdout-stderr.py create mode 100644 third_party/python/gyp/test/msvs/rules_stdout_stderr/rule_stderr.py create mode 100644 third_party/python/gyp/test/msvs/rules_stdout_stderr/rule_stdout.py create mode 100644 third_party/python/gyp/test/msvs/rules_stdout_stderr/rules-stdout-stderr.gyp create mode 100644 third_party/python/gyp/test/msvs/shared_output/common.gypi create mode 100644 third_party/python/gyp/test/msvs/shared_output/gyptest-shared_output.py create mode 100644 third_party/python/gyp/test/msvs/shared_output/hello.c create mode 100644 third_party/python/gyp/test/msvs/shared_output/hello.gyp create mode 100644 third_party/python/gyp/test/msvs/shared_output/there/there.c create mode 100644 third_party/python/gyp/test/msvs/shared_output/there/there.gyp create mode 100644 third_party/python/gyp/test/msvs/uldi2010/gyptest-all.py create mode 100644 third_party/python/gyp/test/msvs/uldi2010/hello.c create mode 100644 third_party/python/gyp/test/msvs/uldi2010/hello.gyp create mode 100644 third_party/python/gyp/test/msvs/uldi2010/hello2.c (limited to 'third_party/python/gyp/test/msvs') diff --git a/third_party/python/gyp/test/msvs/buildevents/buildevents.gyp b/third_party/python/gyp/test/msvs/buildevents/buildevents.gyp new file mode 100644 index 0000000000..e0304dd5c6 --- /dev/null +++ b/third_party/python/gyp/test/msvs/buildevents/buildevents.gyp @@ -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. +{ + 'targets': [ + { + 'target_name': 'main', + 'type': 'executable', + 'sources': [ 'main.cc', ], + 'msvs_prebuild': r'echo starting', + 'msvs_postbuild': r'echo finished', + }, + ], +} diff --git a/third_party/python/gyp/test/msvs/buildevents/gyptest-msbuild-supports-prepostbuild.py b/third_party/python/gyp/test/msvs/buildevents/gyptest-msbuild-supports-prepostbuild.py new file mode 100755 index 0000000000..208f434560 --- /dev/null +++ b/third_party/python/gyp/test/msvs/buildevents/gyptest-msbuild-supports-prepostbuild.py @@ -0,0 +1,24 @@ +#!/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. + +""" +Verifies that msvs_prebuild and msvs_postbuild can be specified in both +VS 2008 and 2010. +""" + +import TestGyp + +test = TestGyp.TestGyp(formats=['msvs'], workdir='workarea_all') + +test.run_gyp('buildevents.gyp', '-G', 'msvs_version=2008') +test.must_contain('main.vcproj', 'Name="VCPreBuildEventTool"') +test.must_contain('main.vcproj', 'Name="VCPostBuildEventTool"') + +test.run_gyp('buildevents.gyp', '-G', 'msvs_version=2010') +test.must_contain('main.vcxproj', '') +test.must_contain('main.vcxproj', '') + +test.pass_test() diff --git a/third_party/python/gyp/test/msvs/buildevents/gyptest-ninja-warnings.py b/third_party/python/gyp/test/msvs/buildevents/gyptest-ninja-warnings.py new file mode 100755 index 0000000000..be4ec9921a --- /dev/null +++ b/third_party/python/gyp/test/msvs/buildevents/gyptest-ninja-warnings.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +# Copyright (c) 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 ninja errors out when encountering msvs_prebuild/msvs_postbuild. +""" + +import sys +import TestCmd +import TestGyp + + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['ninja']) + + test.run_gyp('buildevents.gyp', + status=1, + stderr=r'.*msvs_prebuild not supported \(target main\).*', + match=TestCmd.match_re_dotall) + + test.run_gyp('buildevents.gyp', + status=1, + stderr=r'.*msvs_postbuild not supported \(target main\).*', + match=TestCmd.match_re_dotall) + + test.pass_test() diff --git a/third_party/python/gyp/test/msvs/buildevents/main.cc b/third_party/python/gyp/test/msvs/buildevents/main.cc new file mode 100644 index 0000000000..03c0285a6c --- /dev/null +++ b/third_party/python/gyp/test/msvs/buildevents/main.cc @@ -0,0 +1,5 @@ +// Copyright (c) 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. + +int main() {} diff --git a/third_party/python/gyp/test/msvs/config_attrs/gyptest-config_attrs.py b/third_party/python/gyp/test/msvs/config_attrs/gyptest-config_attrs.py new file mode 100644 index 0000000000..29a8022bd4 --- /dev/null +++ b/third_party/python/gyp/test/msvs/config_attrs/gyptest-config_attrs.py @@ -0,0 +1,41 @@ +#!/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 msvs_configuration_attributes and +msbuild_configuration_attributes are applied by using +them to set the OutputDirectory. +""" + +from __future__ import print_function + +import TestGyp +import os + +import sys + +if sys.platform == 'win32': + print("This test is currently disabled: https://crbug.com/483696.") + sys.exit(0) + + + +test = TestGyp.TestGyp(workdir='workarea_all',formats=['msvs']) + +vc_version = 'VC90' + +if os.getenv('GYP_MSVS_VERSION'): + vc_version = ['VC90','VC100'][int(os.getenv('GYP_MSVS_VERSION')) >= 2010] + +expected_exe_file = os.path.join(test.workdir, vc_version, 'hello.exe') + +test.run_gyp('hello.gyp') + +test.build('hello.gyp') + +test.must_exist(expected_exe_file) + +test.pass_test() diff --git a/third_party/python/gyp/test/msvs/config_attrs/hello.c b/third_party/python/gyp/test/msvs/config_attrs/hello.c new file mode 100644 index 0000000000..faadc75e2c --- /dev/null +++ b/third_party/python/gyp/test/msvs/config_attrs/hello.c @@ -0,0 +1,11 @@ +/* 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. */ + +#include + +int main(void) +{ + printf("Hello, world!\n"); + return 0; +} diff --git a/third_party/python/gyp/test/msvs/config_attrs/hello.gyp b/third_party/python/gyp/test/msvs/config_attrs/hello.gyp new file mode 100644 index 0000000000..810a80edd8 --- /dev/null +++ b/third_party/python/gyp/test/msvs/config_attrs/hello.gyp @@ -0,0 +1,21 @@ +# 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': 'hello', + 'type': 'executable', + 'sources': [ + 'hello.c', + ], + 'msvs_configuration_attributes': { + 'OutputDirectory':'$(SolutionDir)VC90/' + }, + 'msbuild_configuration_attributes': { + 'OutputDirectory':'$(SolutionDir)VC100/', + }, + }, + ], +} diff --git a/third_party/python/gyp/test/msvs/express/base/base.gyp b/third_party/python/gyp/test/msvs/express/base/base.gyp new file mode 100644 index 0000000000..b7c9fc6d81 --- /dev/null +++ b/third_party/python/gyp/test/msvs/express/base/base.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': 'a', + 'type': 'static_library', + 'sources': [ + 'a.c', + ], + }, + { + 'target_name': 'b', + 'type': 'static_library', + 'sources': [ + 'b.c', + ], + }, + ], +} diff --git a/third_party/python/gyp/test/msvs/express/express.gyp b/third_party/python/gyp/test/msvs/express/express.gyp new file mode 100644 index 0000000000..917abe2cc0 --- /dev/null +++ b/third_party/python/gyp/test/msvs/express/express.gyp @@ -0,0 +1,19 @@ +# 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': 'express', + 'type': 'executable', + 'dependencies': [ + 'base/base.gyp:a', + 'base/base.gyp:b', + ], + 'sources': [ + 'main.c', + ], + }, + ], +} diff --git a/third_party/python/gyp/test/msvs/express/gyptest-express.py b/third_party/python/gyp/test/msvs/express/gyptest-express.py new file mode 100755 index 0000000000..54c06f664a --- /dev/null +++ b/third_party/python/gyp/test/msvs/express/gyptest-express.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 that flat solutions get generated for Express versions of +Visual Studio. +""" + +import TestGyp + +test = TestGyp.TestGyp(formats=['msvs']) + +test.run_gyp('express.gyp', '-G', 'msvs_version=2005') +test.must_contain('express.sln', '(base)') + +test.run_gyp('express.gyp', '-G', 'msvs_version=2008') +test.must_contain('express.sln', '(base)') + +test.run_gyp('express.gyp', '-G', 'msvs_version=2005e') +test.must_not_contain('express.sln', '(base)') + +test.run_gyp('express.gyp', '-G', 'msvs_version=2008e') +test.must_not_contain('express.sln', '(base)') + + +test.pass_test() diff --git a/third_party/python/gyp/test/msvs/external_builder/external.gyp b/third_party/python/gyp/test/msvs/external_builder/external.gyp new file mode 100644 index 0000000000..abe5b5889c --- /dev/null +++ b/third_party/python/gyp/test/msvs/external_builder/external.gyp @@ -0,0 +1,68 @@ +# 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. + +{ + 'variables': { + # the test driver switches this flag when testing external builder + 'use_external_builder%': 0, + }, + 'targets': [ + { + 'target_name': 'external', + 'type': 'executable', + 'sources': [ + 'hello.cpp', + 'hello.z', + ], + 'rules': [ + { + 'rule_name': 'test_rule', + 'extension': 'z', + 'outputs': [ + 'msbuild_rule.out', + ], + 'action': [ + 'python', + 'msbuild_rule.py', + '<(RULE_INPUT_PATH)', + 'a', 'b', 'c', + ], + 'msvs_cygwin_shell': 0, + }, + ], + 'actions': [ + { + 'action_name': 'test action', + 'inputs': [ + 'msbuild_action.py', + ], + 'outputs': [ + 'msbuild_action.out', + ], + 'action': [ + 'python', + '<@(_inputs)', + 'x', 'y', 'z', + ], + 'msvs_cygwin_shell': 0, + }, + ], + 'conditions': [ + ['use_external_builder==1', { + 'msvs_external_builder': 'test', + 'msvs_external_builder_build_cmd': [ + 'python', + 'external_builder.py', + 'build', '1', '2', '3', + ], + 'msvs_external_builder_clean_cmd': [ + 'python', + 'external_builder.py', + 'clean', '4', '5', + ], + }], + ], + }, + ], +} diff --git a/third_party/python/gyp/test/msvs/external_builder/external_builder.py b/third_party/python/gyp/test/msvs/external_builder/external_builder.py new file mode 100644 index 0000000000..ddfc1e5e33 --- /dev/null +++ b/third_party/python/gyp/test/msvs/external_builder/external_builder.py @@ -0,0 +1,9 @@ +# 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. + +import sys + +with open('external_builder.out', 'w') as f: + f.write(' '.join(sys.argv)) + diff --git a/third_party/python/gyp/test/msvs/external_builder/gyptest-all.py b/third_party/python/gyp/test/msvs/external_builder/gyptest-all.py new file mode 100644 index 0000000000..72faa7ab7f --- /dev/null +++ b/third_party/python/gyp/test/msvs/external_builder/gyptest-all.py @@ -0,0 +1,59 @@ +#!/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. + +""" +Verifies that msvs_external_builder being set will invoke the provided +msvs_external_builder_build_cmd and msvs_external_builder_clean_cmd, and will +not invoke MSBuild actions and rules. +""" + +import os +import sys +import TestGyp + +if int(os.environ.get('GYP_MSVS_VERSION', 0)) < 2010: + sys.exit(0) + +test = TestGyp.TestGyp(formats=['msvs'], workdir='workarea_all') + +# without the flag set +test.run_gyp('external.gyp') +test.build('external.gyp', target='external') +test.must_not_exist('external_builder.out') +test.must_exist('msbuild_rule.out') +test.must_exist('msbuild_action.out') +test.must_match('msbuild_rule.out', 'msbuild_rule.py hello.z a b c') +test.must_match('msbuild_action.out', 'msbuild_action.py x y z') +os.remove('msbuild_rule.out') +os.remove('msbuild_action.out') + +# with the flag set, using Build +try: + os.environ['GYP_DEFINES'] = 'use_external_builder=1' + test.run_gyp('external.gyp') + test.build('external.gyp', target='external') +finally: + del os.environ['GYP_DEFINES'] +test.must_not_exist('msbuild_rule.out') +test.must_not_exist('msbuild_action.out') +test.must_exist('external_builder.out') +test.must_match('external_builder.out', 'external_builder.py build 1 2 3') +os.remove('external_builder.out') + +# with the flag set, using Clean +try: + os.environ['GYP_DEFINES'] = 'use_external_builder=1' + test.run_gyp('external.gyp') + test.build('external.gyp', target='external', clean=True) +finally: + del os.environ['GYP_DEFINES'] +test.must_not_exist('msbuild_rule.out') +test.must_not_exist('msbuild_action.out') +test.must_exist('external_builder.out') +test.must_match('external_builder.out', 'external_builder.py clean 4 5') +os.remove('external_builder.out') + +test.pass_test() diff --git a/third_party/python/gyp/test/msvs/external_builder/hello.cpp b/third_party/python/gyp/test/msvs/external_builder/hello.cpp new file mode 100644 index 0000000000..bc0c0265b5 --- /dev/null +++ b/third_party/python/gyp/test/msvs/external_builder/hello.cpp @@ -0,0 +1,10 @@ +// 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. + +#include + +int main(void) { + printf("Hello, world!\n"); + return 0; +} diff --git a/third_party/python/gyp/test/msvs/external_builder/hello.z b/third_party/python/gyp/test/msvs/external_builder/hello.z new file mode 100644 index 0000000000..aa478827b5 --- /dev/null +++ b/third_party/python/gyp/test/msvs/external_builder/hello.z @@ -0,0 +1,6 @@ +# 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 file will be passed to the test rule. + diff --git a/third_party/python/gyp/test/msvs/external_builder/msbuild_action.py b/third_party/python/gyp/test/msvs/external_builder/msbuild_action.py new file mode 100644 index 0000000000..632d786922 --- /dev/null +++ b/third_party/python/gyp/test/msvs/external_builder/msbuild_action.py @@ -0,0 +1,9 @@ +# 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. + +import sys + +with open('msbuild_action.out', 'w') as f: + f.write(' '.join(sys.argv)) + diff --git a/third_party/python/gyp/test/msvs/external_builder/msbuild_rule.py b/third_party/python/gyp/test/msvs/external_builder/msbuild_rule.py new file mode 100644 index 0000000000..0d6e315775 --- /dev/null +++ b/third_party/python/gyp/test/msvs/external_builder/msbuild_rule.py @@ -0,0 +1,11 @@ +# 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. + +import sys, os.path + +sys.argv[1] = os.path.basename(sys.argv[1]) + +with open('msbuild_rule.out', 'w') as f: + f.write(' '.join(sys.argv)) + diff --git a/third_party/python/gyp/test/msvs/filters/filters.gyp b/third_party/python/gyp/test/msvs/filters/filters.gyp new file mode 100644 index 0000000000..a4106dc8eb --- /dev/null +++ b/third_party/python/gyp/test/msvs/filters/filters.gyp @@ -0,0 +1,47 @@ +# Copyright (c) 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. + +{ + 'targets': [ + { + 'target_name': 'no_source_files', + 'type': 'none', + 'sources': [ ], + }, + { + 'target_name': 'one_source_file', + 'type': 'executable', + 'sources': [ + '../folder/a.c', + ], + }, + { + 'target_name': 'two_source_files', + 'type': 'executable', + 'sources': [ + '../folder/a.c', + '../folder/b.c', + ], + }, + { + 'target_name': 'three_files_in_two_folders', + 'type': 'executable', + 'sources': [ + '../folder1/a.c', + '../folder1/b.c', + '../folder2/c.c', + ], + }, + { + 'target_name': 'nested_folders', + 'type': 'executable', + 'sources': [ + '../folder1/nested/a.c', + '../folder2/d.c', + '../folder1/nested/b.c', + '../folder1/other/c.c', + ], + }, + ], +} diff --git a/third_party/python/gyp/test/msvs/filters/gyptest-filters-2008.py b/third_party/python/gyp/test/msvs/filters/gyptest-filters-2008.py new file mode 100644 index 0000000000..41ca085823 --- /dev/null +++ b/third_party/python/gyp/test/msvs/filters/gyptest-filters-2008.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +# Copyright (c) 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 extra filters are pruned correctly for Visual Studio 2008. +""" + +import re +import TestGyp + + +def strip_ws(str): + return re.sub('^ +', '', str, flags=re.M).replace('\n', '') + + +test = TestGyp.TestGyp(formats=['msvs']) + +test.run_gyp('filters.gyp', '-G', 'standalone', '-G', 'msvs_version=2008') + +test.must_contain('no_source_files.vcproj', '') + +test.must_contain('one_source_file.vcproj', strip_ws('''\ + + + +''')) + +test.must_contain('two_source_files.vcproj', strip_ws('''\ + + + + +''')) + +test.must_contain('three_files_in_two_folders.vcproj', strip_ws('''\ + + + + + + + + + +''')) + +test.must_contain('nested_folders.vcproj', strip_ws('''\ + + + + + + + + + + + + + + +''')) + + +test.pass_test() diff --git a/third_party/python/gyp/test/msvs/filters/gyptest-filters-2010.py b/third_party/python/gyp/test/msvs/filters/gyptest-filters-2010.py new file mode 100644 index 0000000000..d8131d5d7b --- /dev/null +++ b/third_party/python/gyp/test/msvs/filters/gyptest-filters-2010.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python + +# Copyright (c) 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 extra filters are pruned correctly for Visual Studio 2010 +and later. +""" + +import TestGyp + + +test = TestGyp.TestGyp(formats=['msvs']) + +test.run_gyp('filters.gyp', '-G', 'standalone', '-G', 'msvs_version=2010') + +test.must_not_exist('no_source_files.vcxproj.filters') + +test.must_not_exist('one_source_file.vcxproj.filters') + +test.must_not_exist('two_source_files.vcxproj.filters') + +test.must_contain('three_files_in_two_folders.vcxproj.filters', '''\ + + + folder1 + + + folder1 + + + folder2 + + +'''.replace('\n', '\r\n')) + +test.must_contain('nested_folders.vcxproj.filters', '''\ + + + folder1\\nested + + + folder2 + + + folder1\\nested + + + folder1\\other + + +'''.replace('\n', '\r\n')) + + +test.pass_test() diff --git a/third_party/python/gyp/test/msvs/list_excluded/gyptest-all.py b/third_party/python/gyp/test/msvs/list_excluded/gyptest-all.py new file mode 100644 index 0000000000..5a370f6b47 --- /dev/null +++ b/third_party/python/gyp/test/msvs/list_excluded/gyptest-all.py @@ -0,0 +1,51 @@ +#!/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 msvs_list_excluded_files=0 doesn't list files that would +normally be in _excluded_files, and that if that flag is not set, then they +are still listed. +""" + +import os +import TestGyp + +test = TestGyp.TestGyp(formats=['msvs'], workdir='workarea_all') + + +# with the flag set to 0 +try: + os.environ['GYP_GENERATOR_FLAGS'] = 'msvs_list_excluded_files=0' + test.run_gyp('hello_exclude.gyp') +finally: + del os.environ['GYP_GENERATOR_FLAGS'] +if test.uses_msbuild: + test.must_not_contain('hello.vcxproj', 'hello_mac') +else: + test.must_not_contain('hello.vcproj', 'hello_mac') + + +# with the flag not set +test.run_gyp('hello_exclude.gyp') +if test.uses_msbuild: + test.must_contain('hello.vcxproj', 'hello_mac') +else: + test.must_contain('hello.vcproj', 'hello_mac') + + +# with the flag explicitly set to 1 +try: + os.environ['GYP_GENERATOR_FLAGS'] = 'msvs_list_excluded_files=1' + test.run_gyp('hello_exclude.gyp') +finally: + del os.environ['GYP_GENERATOR_FLAGS'] +if test.uses_msbuild: + test.must_contain('hello.vcxproj', 'hello_mac') +else: + test.must_contain('hello.vcproj', 'hello_mac') + + +test.pass_test() diff --git a/third_party/python/gyp/test/msvs/list_excluded/hello.cpp b/third_party/python/gyp/test/msvs/list_excluded/hello.cpp new file mode 100644 index 0000000000..bc0c0265b5 --- /dev/null +++ b/third_party/python/gyp/test/msvs/list_excluded/hello.cpp @@ -0,0 +1,10 @@ +// 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. + +#include + +int main(void) { + printf("Hello, world!\n"); + return 0; +} diff --git a/third_party/python/gyp/test/msvs/list_excluded/hello_exclude.gyp b/third_party/python/gyp/test/msvs/list_excluded/hello_exclude.gyp new file mode 100644 index 0000000000..aa160f2367 --- /dev/null +++ b/third_party/python/gyp/test/msvs/list_excluded/hello_exclude.gyp @@ -0,0 +1,19 @@ +# 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': 'hello', + 'type': 'executable', + 'sources': [ + 'hello.cpp', + 'hello_mac.cpp', + ], + 'conditions': [ + ['OS!="mac"', {'sources!': ['hello_mac.cpp']}], + ] + }, + ], +} diff --git a/third_party/python/gyp/test/msvs/list_excluded/hello_mac.cpp b/third_party/python/gyp/test/msvs/list_excluded/hello_mac.cpp new file mode 100644 index 0000000000..b9f6242c4b --- /dev/null +++ b/third_party/python/gyp/test/msvs/list_excluded/hello_mac.cpp @@ -0,0 +1,10 @@ +// 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. + +#include + +int hello2() { + printf("Hello, two!\n"); + return 0; +} diff --git a/third_party/python/gyp/test/msvs/missing_sources/gyptest-missing.py b/third_party/python/gyp/test/msvs/missing_sources/gyptest-missing.py new file mode 100644 index 0000000000..62a99ef0f1 --- /dev/null +++ b/third_party/python/gyp/test/msvs/missing_sources/gyptest-missing.py @@ -0,0 +1,43 @@ +#!/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 missing 'sources' files are treated as fatal errors when the +the generator flag 'msvs_error_on_missing_sources' is set. +""" + +import TestGyp +import os +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja'], workdir='workarea_all') + + # With the flag not set + test.run_gyp('hello_missing.gyp') + + # With the flag explicitly set to 0 + try: + os.environ['GYP_GENERATOR_FLAGS'] = 'msvs_error_on_missing_sources=0' + test.run_gyp('hello_missing.gyp') + finally: + del os.environ['GYP_GENERATOR_FLAGS'] + + # With the flag explicitly set to 1 + try: + os.environ['GYP_GENERATOR_FLAGS'] = 'msvs_error_on_missing_sources=1' + # Test to make sure GYP raises an exception (exit status 1). Since this will + # also print a backtrace, ensure that TestGyp is not checking that stderr is + # empty by specifying None, which means do not perform any checking. + # Instead, stderr is checked below to ensure it contains the expected + # output. + test.run_gyp('hello_missing.gyp', status=1, stderr=None) + finally: + del os.environ['GYP_GENERATOR_FLAGS'] + test.must_contain_any_line(test.stderr(), + ["Missing input files:"]) + + test.pass_test() diff --git a/third_party/python/gyp/test/msvs/missing_sources/hello_missing.gyp b/third_party/python/gyp/test/msvs/missing_sources/hello_missing.gyp new file mode 100644 index 0000000000..c08926bbff --- /dev/null +++ b/third_party/python/gyp/test/msvs/missing_sources/hello_missing.gyp @@ -0,0 +1,15 @@ +# 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': 'hello', + 'type': 'executable', + 'sources': [ + 'hello_missing.cpp', + ], + }, + ], +} diff --git a/third_party/python/gyp/test/msvs/multiple_actions_error_handling/action_fail.py b/third_party/python/gyp/test/msvs/multiple_actions_error_handling/action_fail.py new file mode 100644 index 0000000000..286fc4e132 --- /dev/null +++ b/third_party/python/gyp/test/msvs/multiple_actions_error_handling/action_fail.py @@ -0,0 +1,7 @@ +# Copyright (c) 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. + +import sys + +sys.exit(1) diff --git a/third_party/python/gyp/test/msvs/multiple_actions_error_handling/action_succeed.py b/third_party/python/gyp/test/msvs/multiple_actions_error_handling/action_succeed.py new file mode 100644 index 0000000000..3554373197 --- /dev/null +++ b/third_party/python/gyp/test/msvs/multiple_actions_error_handling/action_succeed.py @@ -0,0 +1,7 @@ +# Copyright (c) 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. + +import sys + +sys.exit(0) diff --git a/third_party/python/gyp/test/msvs/multiple_actions_error_handling/actions.gyp b/third_party/python/gyp/test/msvs/multiple_actions_error_handling/actions.gyp new file mode 100644 index 0000000000..ab99e929e2 --- /dev/null +++ b/third_party/python/gyp/test/msvs/multiple_actions_error_handling/actions.gyp @@ -0,0 +1,40 @@ +# Copyright (c) 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. + +{ + 'targets': [ + { + 'target_name': 'actions-test', + 'type': 'none', + 'actions': [ + { + 'action_name': 'first action (fails)', + 'inputs': [ + 'action_fail.py', + ], + 'outputs': [ + 'ALWAYS_OUT_OF_DATE', + ], + 'action': [ + 'python', '<@(_inputs)' + ], + 'msvs_cygwin_shell': 0, + }, + { + 'action_name': 'second action (succeeds)', + 'inputs': [ + 'action_succeed.py', + ], + 'outputs': [ + 'ALWAYS_OUT_OF_DATE', + ], + 'action': [ + 'python', '<@(_inputs)' + ], + 'msvs_cygwin_shell': 0, + }, + ], + }, + ], +} diff --git a/third_party/python/gyp/test/msvs/multiple_actions_error_handling/gyptest.py b/third_party/python/gyp/test/msvs/multiple_actions_error_handling/gyptest.py new file mode 100644 index 0000000000..3aa6b8fdb2 --- /dev/null +++ b/third_party/python/gyp/test/msvs/multiple_actions_error_handling/gyptest.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +# Copyright (c) 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 failing actions make the build fail reliably, even when there +are multiple actions in one project. +""" + +import os +import sys +import TestGyp +import TestCmd + +test = TestGyp.TestGyp(formats=['msvs'], workdir='workarea_all') + +test.run_gyp('actions.gyp') +test.build('actions.gyp', + target='actions-test', + status=1, + stdout=r'.*"cmd\.exe" exited with code 1\..*', + match=TestCmd.match_re_dotall) + +test.pass_test() diff --git a/third_party/python/gyp/test/msvs/props/AppName.props b/third_party/python/gyp/test/msvs/props/AppName.props new file mode 100644 index 0000000000..b688f663d5 --- /dev/null +++ b/third_party/python/gyp/test/msvs/props/AppName.props @@ -0,0 +1,14 @@ + + + + Greet + + + <_ProjectFileVersion>10.0.40219.1 + + + + $(AppName) + + + diff --git a/third_party/python/gyp/test/msvs/props/AppName.vsprops b/third_party/python/gyp/test/msvs/props/AppName.vsprops new file mode 100644 index 0000000000..84b9af3800 --- /dev/null +++ b/third_party/python/gyp/test/msvs/props/AppName.vsprops @@ -0,0 +1,11 @@ + + + + diff --git a/third_party/python/gyp/test/msvs/props/gyptest-props.py b/third_party/python/gyp/test/msvs/props/gyptest-props.py new file mode 100644 index 0000000000..abd4df2241 --- /dev/null +++ b/third_party/python/gyp/test/msvs/props/gyptest-props.py @@ -0,0 +1,22 @@ +#!/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 props files are added by using a +props file to set the name of the built executable. +""" + +import TestGyp + +test = TestGyp.TestGyp(workdir='workarea_all', formats=['msvs']) + +test.run_gyp('hello.gyp') + +test.build('hello.gyp') + +test.built_file_must_exist('Greet.exe') + +test.pass_test() diff --git a/third_party/python/gyp/test/msvs/props/hello.c b/third_party/python/gyp/test/msvs/props/hello.c new file mode 100644 index 0000000000..faadc75e2c --- /dev/null +++ b/third_party/python/gyp/test/msvs/props/hello.c @@ -0,0 +1,11 @@ +/* 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. */ + +#include + +int main(void) +{ + printf("Hello, world!\n"); + return 0; +} diff --git a/third_party/python/gyp/test/msvs/props/hello.gyp b/third_party/python/gyp/test/msvs/props/hello.gyp new file mode 100644 index 0000000000..5a58317fa7 --- /dev/null +++ b/third_party/python/gyp/test/msvs/props/hello.gyp @@ -0,0 +1,22 @@ +# 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': 'hello', + 'product_name': '$(AppName)', + 'type': 'executable', + 'sources': [ + 'hello.c', + ], + 'msvs_props': [ + '$(SolutionDir)AppName.vsprops' + ], + 'msbuild_props': [ + '$(SolutionDir)AppName.props' + ], + }, + ], +} + diff --git a/third_party/python/gyp/test/msvs/rules_stdout_stderr/dummy.bar b/third_party/python/gyp/test/msvs/rules_stdout_stderr/dummy.bar new file mode 100644 index 0000000000..25178696d2 --- /dev/null +++ b/third_party/python/gyp/test/msvs/rules_stdout_stderr/dummy.bar @@ -0,0 +1,5 @@ +# 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. + +A dummy file with the .bar extension (used for stderr rule). diff --git a/third_party/python/gyp/test/msvs/rules_stdout_stderr/dummy.foo b/third_party/python/gyp/test/msvs/rules_stdout_stderr/dummy.foo new file mode 100644 index 0000000000..6a7990bb98 --- /dev/null +++ b/third_party/python/gyp/test/msvs/rules_stdout_stderr/dummy.foo @@ -0,0 +1,5 @@ +# 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. + +A dummy file with the .foo extension (used for stdout rule). diff --git a/third_party/python/gyp/test/msvs/rules_stdout_stderr/gyptest-rules-stdout-stderr.py b/third_party/python/gyp/test/msvs/rules_stdout_stderr/gyptest-rules-stdout-stderr.py new file mode 100644 index 0000000000..804505a23d --- /dev/null +++ b/third_party/python/gyp/test/msvs/rules_stdout_stderr/gyptest-rules-stdout-stderr.py @@ -0,0 +1,29 @@ +#!/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. + +""" Verifies that stdout and stderr from rules get logged in the build's +stdout.""" + +import sys +import TestGyp + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs']) + + test.run_gyp('rules-stdout-stderr.gyp') + test.build('rules-stdout-stderr.gyp', test.ALL) + + expected_stdout_lines = [ + 'testing stdout', + 'This will go to stdout', + + # Note: stderr output from rules will go to the build's stdout. + 'testing stderr', + 'This will go to stderr', + ] + test.must_contain_all_lines(test.stdout(), expected_stdout_lines) + + test.pass_test() diff --git a/third_party/python/gyp/test/msvs/rules_stdout_stderr/rule_stderr.py b/third_party/python/gyp/test/msvs/rules_stdout_stderr/rule_stderr.py new file mode 100644 index 0000000000..2081513ec8 --- /dev/null +++ b/third_party/python/gyp/test/msvs/rules_stdout_stderr/rule_stderr.py @@ -0,0 +1,8 @@ +#!/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. + +from __future__ import print_function +import sys +print("This will go to stderr", file=sys.stderr) diff --git a/third_party/python/gyp/test/msvs/rules_stdout_stderr/rule_stdout.py b/third_party/python/gyp/test/msvs/rules_stdout_stderr/rule_stdout.py new file mode 100644 index 0000000000..4c073ebc45 --- /dev/null +++ b/third_party/python/gyp/test/msvs/rules_stdout_stderr/rule_stdout.py @@ -0,0 +1,7 @@ +#!/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. + +from __future__ import print_function +print("This will go to stdout") diff --git a/third_party/python/gyp/test/msvs/rules_stdout_stderr/rules-stdout-stderr.gyp b/third_party/python/gyp/test/msvs/rules_stdout_stderr/rules-stdout-stderr.gyp new file mode 100644 index 0000000000..ce93643f8e --- /dev/null +++ b/third_party/python/gyp/test/msvs/rules_stdout_stderr/rules-stdout-stderr.gyp @@ -0,0 +1,52 @@ +# 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': 'test', + 'type': 'none', + 'sources': [ + 'dummy.foo', + 'dummy.bar', + ], + 'rules': [ + { + 'rule_name': 'test_stdout', + 'extension': 'foo', + 'message': 'testing stdout', + 'msvs_cygwin_shell': 0, + 'inputs': [ + 'rule_stdout.py', + ], + 'outputs': [ + 'dummy.foo_output', + ], + 'action': [ + 'python', + 'rule_stdout.py', + '<(RULE_INPUT_PATH)', + ], + }, + { + 'rule_name': 'test_stderr', + 'extension': 'bar', + 'message': 'testing stderr', + 'msvs_cygwin_shell': 0, + 'inputs': [ + 'rule_stderr.py', + ], + 'outputs': [ + 'dummy.bar_output', + ], + 'action': [ + 'python', + 'rule_stderr.py', + '<(RULE_INPUT_PATH)', + ], + }, + ], + }, + ], +} diff --git a/third_party/python/gyp/test/msvs/shared_output/common.gypi b/third_party/python/gyp/test/msvs/shared_output/common.gypi new file mode 100644 index 0000000000..c6fa341d68 --- /dev/null +++ b/third_party/python/gyp/test/msvs/shared_output/common.gypi @@ -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. + +{ + 'target_defaults': { + 'default_configuration': 'Baz', + 'configurations': { + 'Baz': { + 'msvs_configuration_attributes': { + 'OutputDirectory': '<(DEPTH)/foo', + 'IntermediateDirectory': '$(OutDir)/bar', + }, + }, + }, + }, +} diff --git a/third_party/python/gyp/test/msvs/shared_output/gyptest-shared_output.py b/third_party/python/gyp/test/msvs/shared_output/gyptest-shared_output.py new file mode 100644 index 0000000000..270b280e6b --- /dev/null +++ b/third_party/python/gyp/test/msvs/shared_output/gyptest-shared_output.py @@ -0,0 +1,41 @@ +#!/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. + +""" +Test checking that IntermediateDirectory can be defined in terms of +OutputDirectory. We previously had emitted the definition of +IntermediateDirectory before the definition of OutputDirectory. +This is required so that $(IntDir) can be based on $(OutDir). +""" + +import TestGyp +import os + +# NOTE: This test really is vcbuild/msbuild specific (not applicable to windows +# ninja), as it is testing the msvs output location when opening an .sln +# other than all.sln. +test = TestGyp.TestGyp(workdir='workarea_shared_output', formats=['msvs']) + +test.run_gyp('hello.gyp') +test.set_configuration('Baz') + +test.build('there/there.gyp', test.ALL) +test.must_exist(os.path.join(test.workdir, 'foo', 'there.exe')) +test.must_exist(os.path.join(test.workdir, 'foo', 'bar', 'there.obj')) + +test.build('hello.gyp', test.ALL) +test.must_exist(os.path.join(test.workdir, 'foo', 'hello.exe')) +test.must_exist(os.path.join(test.workdir, 'foo', 'bar', 'hello.obj')) + +if test.format == 'msvs': + if test.uses_msbuild: + test.must_contain('pull_in_there.vcxproj', + '$(OutDir)bar\\') + else: + test.must_contain('pull_in_there.vcproj', + 'IntermediateDirectory="$(OutDir)bar\\"') + +test.pass_test() diff --git a/third_party/python/gyp/test/msvs/shared_output/hello.c b/third_party/python/gyp/test/msvs/shared_output/hello.c new file mode 100644 index 0000000000..698e4fd36c --- /dev/null +++ b/third_party/python/gyp/test/msvs/shared_output/hello.c @@ -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. + */ + +#include + +int main(void) { + printf("Hello, world!\n"); + return 0; +} diff --git a/third_party/python/gyp/test/msvs/shared_output/hello.gyp b/third_party/python/gyp/test/msvs/shared_output/hello.gyp new file mode 100644 index 0000000000..f80e5cfca1 --- /dev/null +++ b/third_party/python/gyp/test/msvs/shared_output/hello.gyp @@ -0,0 +1,21 @@ +# 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. + +{ + 'includes': ['common.gypi'], + 'targets': [ + { + 'target_name': 'pull_in_there', + 'type': 'none', + 'dependencies': ['there/there.gyp:*'], + }, + { + 'target_name': 'hello', + 'type': 'executable', + 'sources': [ + 'hello.c', + ], + }, + ], +} diff --git a/third_party/python/gyp/test/msvs/shared_output/there/there.c b/third_party/python/gyp/test/msvs/shared_output/there/there.c new file mode 100644 index 0000000000..698e4fd36c --- /dev/null +++ b/third_party/python/gyp/test/msvs/shared_output/there/there.c @@ -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. + */ + +#include + +int main(void) { + printf("Hello, world!\n"); + return 0; +} diff --git a/third_party/python/gyp/test/msvs/shared_output/there/there.gyp b/third_party/python/gyp/test/msvs/shared_output/there/there.gyp new file mode 100644 index 0000000000..56feff326c --- /dev/null +++ b/third_party/python/gyp/test/msvs/shared_output/there/there.gyp @@ -0,0 +1,16 @@ +# 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. + +{ + 'includes': ['../common.gypi'], + 'targets': [ + { + 'target_name': 'there', + 'type': 'executable', + 'sources': [ + 'there.c', + ], + }, + ], +} diff --git a/third_party/python/gyp/test/msvs/uldi2010/gyptest-all.py b/third_party/python/gyp/test/msvs/uldi2010/gyptest-all.py new file mode 100644 index 0000000000..cc248fbd63 --- /dev/null +++ b/third_party/python/gyp/test/msvs/uldi2010/gyptest-all.py @@ -0,0 +1,20 @@ +#!/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 uldi can be disabled on a per-project-reference basis in vs2010. +""" + +import TestGyp + +test = TestGyp.TestGyp(formats=['msvs'], workdir='workarea_all') + +test.run_gyp('hello.gyp') + +if test.uses_msbuild: + test.must_contain('hello.vcxproj', 'false') + +test.pass_test() diff --git a/third_party/python/gyp/test/msvs/uldi2010/hello.c b/third_party/python/gyp/test/msvs/uldi2010/hello.c new file mode 100644 index 0000000000..06e6a02905 --- /dev/null +++ b/third_party/python/gyp/test/msvs/uldi2010/hello.c @@ -0,0 +1,13 @@ +/* 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. */ + +#include + +extern int hello2(); + +int main(void) { + printf("Hello, world!\n"); + hello2(); + return 0; +} diff --git a/third_party/python/gyp/test/msvs/uldi2010/hello.gyp b/third_party/python/gyp/test/msvs/uldi2010/hello.gyp new file mode 100644 index 0000000000..a2bf2badb1 --- /dev/null +++ b/third_party/python/gyp/test/msvs/uldi2010/hello.gyp @@ -0,0 +1,26 @@ +# 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': 'hello', + 'type': 'executable', + 'sources': [ + 'hello.c', + ], + 'dependencies': [ + 'hellolib', + ] + }, + { + 'target_name': 'hellolib', + 'type': 'static_library', + 'sources': [ + 'hello2.c', + ], + 'msvs_2010_disable_uldi_when_referenced': 1, + }, + ], +} diff --git a/third_party/python/gyp/test/msvs/uldi2010/hello2.c b/third_party/python/gyp/test/msvs/uldi2010/hello2.c new file mode 100644 index 0000000000..e2f23238d1 --- /dev/null +++ b/third_party/python/gyp/test/msvs/uldi2010/hello2.c @@ -0,0 +1,10 @@ +/* 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. */ + +#include + +int hello2() { + printf("Hello, two!\n"); + return 0; +} -- cgit v1.2.3