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/actions/generated-header/action.py | 11 ++ .../gyp/test/actions/generated-header/main.cc | 7 ++ .../gyp/test/actions/generated-header/test.gyp | 34 ++++++ third_party/python/gyp/test/actions/gyptest-all.py | 101 ++++++++++++++++++ .../python/gyp/test/actions/gyptest-default.py | 68 ++++++++++++ .../python/gyp/test/actions/gyptest-errors.py | 24 +++++ .../gyp/test/actions/gyptest-generated-header.py | 38 +++++++ .../gyp/test/actions/src/action_missing_name.gyp | 24 +++++ .../python/gyp/test/actions/src/actions.gyp | 114 +++++++++++++++++++++ .../gyp/test/actions/src/confirm-dep-files.py | 21 ++++ .../python/gyp/test/actions/src/subdir1/counter.py | 44 ++++++++ .../gyp/test/actions/src/subdir1/executable.gyp | 74 +++++++++++++ .../gyp/test/actions/src/subdir1/make-prog1.py | 20 ++++ .../gyp/test/actions/src/subdir1/make-prog2.py | 20 ++++ .../python/gyp/test/actions/src/subdir1/program.c | 12 +++ .../gyp/test/actions/src/subdir2/make-file.py | 11 ++ .../python/gyp/test/actions/src/subdir2/none.gyp | 33 ++++++ .../gyp/test/actions/src/subdir3/generate_main.py | 21 ++++ .../gyp/test/actions/src/subdir3/null_input.gyp | 29 ++++++ 19 files changed, 706 insertions(+) create mode 100644 third_party/python/gyp/test/actions/generated-header/action.py create mode 100644 third_party/python/gyp/test/actions/generated-header/main.cc create mode 100644 third_party/python/gyp/test/actions/generated-header/test.gyp create mode 100755 third_party/python/gyp/test/actions/gyptest-all.py create mode 100755 third_party/python/gyp/test/actions/gyptest-default.py create mode 100755 third_party/python/gyp/test/actions/gyptest-errors.py create mode 100644 third_party/python/gyp/test/actions/gyptest-generated-header.py create mode 100644 third_party/python/gyp/test/actions/src/action_missing_name.gyp create mode 100644 third_party/python/gyp/test/actions/src/actions.gyp create mode 100755 third_party/python/gyp/test/actions/src/confirm-dep-files.py create mode 100755 third_party/python/gyp/test/actions/src/subdir1/counter.py create mode 100644 third_party/python/gyp/test/actions/src/subdir1/executable.gyp create mode 100755 third_party/python/gyp/test/actions/src/subdir1/make-prog1.py create mode 100755 third_party/python/gyp/test/actions/src/subdir1/make-prog2.py create mode 100644 third_party/python/gyp/test/actions/src/subdir1/program.c create mode 100755 third_party/python/gyp/test/actions/src/subdir2/make-file.py create mode 100644 third_party/python/gyp/test/actions/src/subdir2/none.gyp create mode 100755 third_party/python/gyp/test/actions/src/subdir3/generate_main.py create mode 100644 third_party/python/gyp/test/actions/src/subdir3/null_input.gyp (limited to 'third_party/python/gyp/test/actions') diff --git a/third_party/python/gyp/test/actions/generated-header/action.py b/third_party/python/gyp/test/actions/generated-header/action.py new file mode 100644 index 0000000000..9be98798d6 --- /dev/null +++ b/third_party/python/gyp/test/actions/generated-header/action.py @@ -0,0 +1,11 @@ +#!/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. + +import os +import sys + +outfile = sys.argv[1] +open(outfile, 'w').write('const char kFoo[] = "%s";' % sys.argv[2]) diff --git a/third_party/python/gyp/test/actions/generated-header/main.cc b/third_party/python/gyp/test/actions/generated-header/main.cc new file mode 100644 index 0000000000..7973781bc6 --- /dev/null +++ b/third_party/python/gyp/test/actions/generated-header/main.cc @@ -0,0 +1,7 @@ +#include + +#include "MyHeader.h" + +int main() { + printf("%s\n", kFoo); +} diff --git a/third_party/python/gyp/test/actions/generated-header/test.gyp b/third_party/python/gyp/test/actions/generated-header/test.gyp new file mode 100644 index 0000000000..209b951ef6 --- /dev/null +++ b/third_party/python/gyp/test/actions/generated-header/test.gyp @@ -0,0 +1,34 @@ +# 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. +{ + 'targets': [ + { + 'target_name': 'generate_header', + 'type': 'none', + 'actions': [ + { + 'inputs': [ ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/MyHeader.h', + ], + 'action_name': 'generate header', + 'action': ['python', './action.py', + '<(SHARED_INTERMEDIATE_DIR)/MyHeader.h', 'foobar output' ], + }, + ], + 'msvs_cygwin_shell': 0, + }, + { + 'target_name': 'program', + 'type': 'executable', + 'dependencies': [ + 'generate_header', + ], + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)', + ], + 'sources': [ 'main.cc' ], + }, + ], +} diff --git a/third_party/python/gyp/test/actions/gyptest-all.py b/third_party/python/gyp/test/actions/gyptest-all.py new file mode 100755 index 0000000000..c8833a5d1e --- /dev/null +++ b/third_party/python/gyp/test/actions/gyptest-all.py @@ -0,0 +1,101 @@ +#!/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 simple actions when using an explicit build target of 'all'. +""" + +import glob +import os +import TestGyp + +test = TestGyp.TestGyp(workdir='workarea_all') + +test.run_gyp('actions.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +# Some gyp files use an action that mentions an output but never +# writes it as a means to making the action run on every build. That +# doesn't mesh well with ninja's semantics. TODO(evan): figure out +# how to work always-run actions in to ninja. +if test.format in ['ninja', 'xcode-ninja']: + test.build('actions.gyp', test.ALL, chdir='relocate/src') +else: + # Test that an "always run" action increases a counter on multiple + # invocations, and that a dependent action updates in step. + test.build('actions.gyp', test.ALL, chdir='relocate/src') + test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '1') + test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '1') + test.build('actions.gyp', test.ALL, chdir='relocate/src') + test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2') + test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2') + + # The "always run" action only counts to 2, but the dependent target + # will count forever if it's allowed to run. This verifies that the + # dependent target only runs when the "always run" action generates + # new output, not just because the "always run" ran. + test.build('actions.gyp', test.ALL, chdir='relocate/src') + test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2') + test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2') + +expect = """\ +Hello from program.c +Hello from make-prog1.py +Hello from make-prog2.py +""" + +if test.format == 'xcode': + chdir = 'relocate/src/subdir1' +else: + chdir = 'relocate/src' +test.run_built_executable('program', chdir=chdir, stdout=expect) + + +test.must_match('relocate/src/subdir2/file.out', "Hello from make-file.py\n") + + +expect = "Hello from generate_main.py\n" + +if test.format == 'xcode': + chdir = 'relocate/src/subdir3' +else: + chdir = 'relocate/src' +test.run_built_executable('null_input', chdir=chdir, stdout=expect) + + +# Clean out files which may have been created if test.ALL was run. +def clean_dep_files(): + for file in (glob.glob('relocate/src/dep_*.txt') + + glob.glob('relocate/src/deps_all_done_*.txt')): + if os.path.exists(file): + os.remove(file) + +# Confirm our clean. +clean_dep_files() +test.must_not_exist('relocate/src/dep_1.txt') +test.must_not_exist('relocate/src/deps_all_done_first_123.txt') + +# Make sure all deps finish before an action is run on a 'None' target. +# If using the Make builder, add -j to make things more difficult. +arguments = [] +if test.format == 'make': + arguments = ['-j'] +test.build('actions.gyp', 'action_with_dependencies_123', chdir='relocate/src', + arguments=arguments) +test.must_exist('relocate/src/deps_all_done_first_123.txt') + +# Try again with a target that has deps in reverse. Output files from +# previous tests deleted. Confirm this execution did NOT run the ALL +# target which would mess up our dep tests. +clean_dep_files() +test.build('actions.gyp', 'action_with_dependencies_321', chdir='relocate/src', + arguments=arguments) +test.must_exist('relocate/src/deps_all_done_first_321.txt') +test.must_not_exist('relocate/src/deps_all_done_first_123.txt') + + +test.pass_test() diff --git a/third_party/python/gyp/test/actions/gyptest-default.py b/third_party/python/gyp/test/actions/gyptest-default.py new file mode 100755 index 0000000000..70c99ec9ce --- /dev/null +++ b/third_party/python/gyp/test/actions/gyptest-default.py @@ -0,0 +1,68 @@ +#!/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 simple actions when using the default build target. +""" + +import TestGyp + +test = TestGyp.TestGyp(workdir='workarea_default') + +test.run_gyp('actions.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +# Some gyp files use an action that mentions an output but never +# writes it as a means to making the action run on every build. That +# doesn't mesh well with ninja's semantics. TODO(evan): figure out +# how to work always-run actions in to ninja. +if test.format in ['ninja', 'xcode-ninja']: + test.build('actions.gyp', test.ALL, chdir='relocate/src') +else: + # Test that an "always run" action increases a counter on multiple + # invocations, and that a dependent action updates in step. + test.build('actions.gyp', chdir='relocate/src') + test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '1') + test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '1') + test.build('actions.gyp', chdir='relocate/src') + test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2') + test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2') + + # The "always run" action only counts to 2, but the dependent target + # will count forever if it's allowed to run. This verifies that the + # dependent target only runs when the "always run" action generates + # new output, not just because the "always run" ran. + test.build('actions.gyp', test.ALL, chdir='relocate/src') + test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2') + test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2') + +expect = """\ +Hello from program.c +Hello from make-prog1.py +Hello from make-prog2.py +""" + +if test.format == 'xcode': + chdir = 'relocate/src/subdir1' +else: + chdir = 'relocate/src' +test.run_built_executable('program', chdir=chdir, stdout=expect) + + +test.must_match('relocate/src/subdir2/file.out', "Hello from make-file.py\n") + + +expect = "Hello from generate_main.py\n" + +if test.format == 'xcode': + chdir = 'relocate/src/subdir3' +else: + chdir = 'relocate/src' +test.run_built_executable('null_input', chdir=chdir, stdout=expect) + + +test.pass_test() diff --git a/third_party/python/gyp/test/actions/gyptest-errors.py b/third_party/python/gyp/test/actions/gyptest-errors.py new file mode 100755 index 0000000000..e1ef883e1e --- /dev/null +++ b/third_party/python/gyp/test/actions/gyptest-errors.py @@ -0,0 +1,24 @@ +#!/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 behavior for different action configuration errors: +exit status of 1, and the expected error message must be in stderr. +""" + +import TestGyp + +test = TestGyp.TestGyp(workdir='workarea_errors') + + +test.run_gyp('action_missing_name.gyp', chdir='src', status=1, stderr=None) +expect = [ + "Anonymous action in target broken_actions2. An action must have an 'action_name' field.", +] +test.must_contain_all_lines(test.stderr(), expect) + + +test.pass_test() diff --git a/third_party/python/gyp/test/actions/gyptest-generated-header.py b/third_party/python/gyp/test/actions/gyptest-generated-header.py new file mode 100644 index 0000000000..cd5bd691a6 --- /dev/null +++ b/third_party/python/gyp/test/actions/gyptest-generated-header.py @@ -0,0 +1,38 @@ +#!/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 dependencies on generated headers work, even if the header has +a mixed-case file name. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +CHDIR = 'generated-header' + +test.run_gyp('test.gyp', chdir=CHDIR) +test.build('test.gyp', 'program', chdir=CHDIR) +test.up_to_date('test.gyp', 'program', chdir=CHDIR) + +expect = 'foobar output\n' +test.run_built_executable('program', chdir=CHDIR, stdout=expect) + +# Change what's written to the generated header, regyp and rebuild, and check +# that the change makes it to the executable and that the build is clean. +test.sleep() +test.write('generated-header/test.gyp', + test.read('generated-header/test.gyp').replace('foobar', 'barbaz')) + +test.run_gyp('test.gyp', chdir=CHDIR) +test.build('test.gyp', 'program', chdir=CHDIR) +test.up_to_date('test.gyp', 'program', chdir=CHDIR) + +expect = 'barbaz output\n' +test.run_built_executable('program', chdir=CHDIR, stdout=expect) + +test.pass_test() diff --git a/third_party/python/gyp/test/actions/src/action_missing_name.gyp b/third_party/python/gyp/test/actions/src/action_missing_name.gyp new file mode 100644 index 0000000000..6647aac3b5 --- /dev/null +++ b/third_party/python/gyp/test/actions/src/action_missing_name.gyp @@ -0,0 +1,24 @@ +# 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': 'broken_actions2', + 'type': 'none', + 'actions': [ + { + 'inputs': [ + 'no_name.input', + ], + 'action': [ + 'python', + '-c', + 'from __future__ import print_function; print(\'missing name\')', + ], + }, + ], + }, + ], +} diff --git a/third_party/python/gyp/test/actions/src/actions.gyp b/third_party/python/gyp/test/actions/src/actions.gyp new file mode 100644 index 0000000000..5d2db1955e --- /dev/null +++ b/third_party/python/gyp/test/actions/src/actions.gyp @@ -0,0 +1,114 @@ +# 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': 'pull_in_all_actions', + 'type': 'none', + 'dependencies': [ + 'subdir1/executable.gyp:*', + 'subdir2/none.gyp:*', + 'subdir3/null_input.gyp:*', + ], + }, + { + 'target_name': 'depend_on_always_run_action', + 'type': 'none', + 'dependencies': [ 'subdir1/executable.gyp:counter' ], + 'actions': [ + { + 'action_name': 'use_always_run_output', + 'inputs': [ + 'subdir1/actions-out/action-counter.txt', + 'subdir1/counter.py', + ], + 'outputs': [ + 'subdir1/actions-out/action-counter_2.txt', + ], + 'action': [ + 'python', 'subdir1/counter.py', '<(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + + # Three deps which don't finish immediately. + # Each one has a small delay then creates a file. + # Delays are 1.0, 1.1, and 2.0 seconds. + { + 'target_name': 'dep_1', + 'type': 'none', + 'actions': [{ + 'inputs': [ 'actions.gyp' ], + 'outputs': [ 'dep_1.txt' ], + 'action_name': 'dep_1', + 'action': [ 'python', '-c', + 'import time; time.sleep(1); open(\'dep_1.txt\', \'w\')' ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }], + }, + { + 'target_name': 'dep_2', + 'type': 'none', + 'actions': [{ + 'inputs': [ 'actions.gyp' ], + 'outputs': [ 'dep_2.txt' ], + 'action_name': 'dep_2', + 'action': [ 'python', '-c', + 'import time; time.sleep(1.1); open(\'dep_2.txt\', \'w\')' ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }], + }, + { + 'target_name': 'dep_3', + 'type': 'none', + 'actions': [{ + 'inputs': [ 'actions.gyp' ], + 'outputs': [ 'dep_3.txt' ], + 'action_name': 'dep_3', + 'action': [ 'python', '-c', + 'import time; time.sleep(2.0); open(\'dep_3.txt\', \'w\')' ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }], + }, + + # An action which assumes the deps have completed. + # Does NOT list the output files of it's deps as inputs. + # On success create the file deps_all_done_first.txt. + { + 'target_name': 'action_with_dependencies_123', + 'type': 'none', + 'dependencies': [ 'dep_1', 'dep_2', 'dep_3' ], + 'actions': [{ + 'inputs': [ 'actions.gyp' ], + 'outputs': [ 'deps_all_done_first_123.txt' ], + 'action_name': 'action_with_dependencies_123', + 'action': [ 'python', 'confirm-dep-files.py', '<(_outputs)' ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }], + }, + # Same as above but with deps in reverse. + { + 'target_name': 'action_with_dependencies_321', + 'type': 'none', + 'dependencies': [ 'dep_3', 'dep_2', 'dep_1' ], + 'actions': [{ + 'inputs': [ 'actions.gyp' ], + 'outputs': [ 'deps_all_done_first_321.txt' ], + 'action_name': 'action_with_dependencies_321', + 'action': [ 'python', 'confirm-dep-files.py', '<(_outputs)' ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }], + }, + + ], +} diff --git a/third_party/python/gyp/test/actions/src/confirm-dep-files.py b/third_party/python/gyp/test/actions/src/confirm-dep-files.py new file mode 100755 index 0000000000..3b8463057d --- /dev/null +++ b/third_party/python/gyp/test/actions/src/confirm-dep-files.py @@ -0,0 +1,21 @@ +#!/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. + +"""Confirms presence of files generated by our targets we depend on. +If they exist, create a new file. + +Note target's input files are explicitly NOT defined in the gyp file +so they can't easily be passed to this script as args. +""" + +import os +import sys + +outfile = sys.argv[1] # Example value we expect: deps_all_done_first_123.txt +if (os.path.exists("dep_1.txt") and + os.path.exists("dep_2.txt") and + os.path.exists("dep_3.txt")): + open(outfile, "w") diff --git a/third_party/python/gyp/test/actions/src/subdir1/counter.py b/third_party/python/gyp/test/actions/src/subdir1/counter.py new file mode 100755 index 0000000000..d888f2e803 --- /dev/null +++ b/third_party/python/gyp/test/actions/src/subdir1/counter.py @@ -0,0 +1,44 @@ +#!/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. + +import sys +import time + +output = sys.argv[1] +persistoutput = "%s.persist" % sys.argv[1] + +count = 0 +try: + count = open(persistoutput, 'r').read() +except: + pass +count = int(count) + 1 + +if len(sys.argv) > 2: + max_count = int(sys.argv[2]) + if count > max_count: + count = max_count + +oldcount = 0 +try: + oldcount = open(output, 'r').read() +except: + pass + +# Save the count in a file that is undeclared, and thus hidden, to gyp. We need +# to do this because, prior to running commands, some build systems deletes +# any declared outputs, so we would lose our count if we just wrote to the +# given output file. +open(persistoutput, 'w').write('%d' % (count)) + +# Only write the given output file if the count has changed. +if int(oldcount) != count: + open(output, 'w').write('%d' % (count)) + # Sleep so the next run changes the file time sufficiently to make the build + # detect the file as changed. + time.sleep(1) + +sys.exit(0) diff --git a/third_party/python/gyp/test/actions/src/subdir1/executable.gyp b/third_party/python/gyp/test/actions/src/subdir1/executable.gyp new file mode 100644 index 0000000000..6a1ce4f91e --- /dev/null +++ b/third_party/python/gyp/test/actions/src/subdir1/executable.gyp @@ -0,0 +1,74 @@ +# 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': 'program', + 'type': 'executable', + 'msvs_cygwin_shell': 0, + 'sources': [ + 'program.c', + ], + 'actions': [ + { + 'action_name': 'make-prog1', + 'inputs': [ + 'make-prog1.py', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/prog1.c', + ], + 'action': [ + 'python', '<(_inputs)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + }, + { + 'action_name': 'make-prog2', + 'inputs': [ + 'make-prog2.py', + ], + 'outputs': [ + 'actions-out/prog2.c', + ], + 'action': [ + 'python', '<(_inputs)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + { + 'target_name': 'counter', + 'type': 'none', + 'actions': [ + { + # This action should always run, regardless of whether or not it's + # inputs or the command-line change. We do this by creating a dummy + # first output, which is always missing, thus causing the build to + # always try to recreate it. Actual output files should be listed + # after the dummy one, and dependent targets should list the real + # output(s) in their inputs + # (see '../actions.gyp:depend_on_always_run_action'). + 'action_name': 'action_counter', + 'inputs': [ + 'counter.py', + ], + 'outputs': [ + 'actions-out/action-counter.txt.always', + 'actions-out/action-counter.txt', + ], + 'action': [ + 'python', '<(_inputs)', 'actions-out/action-counter.txt', '2', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + ], +} diff --git a/third_party/python/gyp/test/actions/src/subdir1/make-prog1.py b/third_party/python/gyp/test/actions/src/subdir1/make-prog1.py new file mode 100755 index 0000000000..7ea1d8a2d4 --- /dev/null +++ b/third_party/python/gyp/test/actions/src/subdir1/make-prog1.py @@ -0,0 +1,20 @@ +#!/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. + +import sys + +contents = r""" +#include + +void prog1(void) +{ + printf("Hello from make-prog1.py\n"); +} +""" + +open(sys.argv[1], 'w').write(contents) + +sys.exit(0) diff --git a/third_party/python/gyp/test/actions/src/subdir1/make-prog2.py b/third_party/python/gyp/test/actions/src/subdir1/make-prog2.py new file mode 100755 index 0000000000..0bfe4973c2 --- /dev/null +++ b/third_party/python/gyp/test/actions/src/subdir1/make-prog2.py @@ -0,0 +1,20 @@ +#!/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. + +import sys + +contents = r""" +#include + +void prog2(void) +{ + printf("Hello from make-prog2.py\n"); +} +""" + +open(sys.argv[1], 'w').write(contents) + +sys.exit(0) diff --git a/third_party/python/gyp/test/actions/src/subdir1/program.c b/third_party/python/gyp/test/actions/src/subdir1/program.c new file mode 100644 index 0000000000..c0931534eb --- /dev/null +++ b/third_party/python/gyp/test/actions/src/subdir1/program.c @@ -0,0 +1,12 @@ +#include + +extern void prog1(void); +extern void prog2(void); + +int main(void) +{ + printf("Hello from program.c\n"); + prog1(); + prog2(); + return 0; +} diff --git a/third_party/python/gyp/test/actions/src/subdir2/make-file.py b/third_party/python/gyp/test/actions/src/subdir2/make-file.py new file mode 100755 index 0000000000..088a05e0b0 --- /dev/null +++ b/third_party/python/gyp/test/actions/src/subdir2/make-file.py @@ -0,0 +1,11 @@ +#!/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. + +import sys + +contents = "Hello from make-file.py\n" + +open(sys.argv[1], 'w').write(contents) diff --git a/third_party/python/gyp/test/actions/src/subdir2/none.gyp b/third_party/python/gyp/test/actions/src/subdir2/none.gyp new file mode 100644 index 0000000000..2caa97d55c --- /dev/null +++ b/third_party/python/gyp/test/actions/src/subdir2/none.gyp @@ -0,0 +1,33 @@ +# 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': 'file', + 'type': 'none', + 'msvs_cygwin_shell': 0, + 'actions': [ + { + 'action_name': 'make-file', + 'inputs': [ + 'make-file.py', + ], + 'outputs': [ + 'file.out', + # TODO: enhance testing infrastructure to test this + # without having to hard-code the intermediate dir paths. + #'<(INTERMEDIATE_DIR)/file.out', + ], + 'action': [ + 'python', '<(_inputs)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + } + ], + }, + ], +} diff --git a/third_party/python/gyp/test/actions/src/subdir3/generate_main.py b/third_party/python/gyp/test/actions/src/subdir3/generate_main.py new file mode 100755 index 0000000000..804d38df31 --- /dev/null +++ b/third_party/python/gyp/test/actions/src/subdir3/generate_main.py @@ -0,0 +1,21 @@ +#!/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. + +import sys + +contents = """ +#include + +int main(void) +{ + printf("Hello from generate_main.py\\n"); + return 0; +} +""" + +open(sys.argv[1], 'w').write(contents) + +sys.exit(0) diff --git a/third_party/python/gyp/test/actions/src/subdir3/null_input.gyp b/third_party/python/gyp/test/actions/src/subdir3/null_input.gyp new file mode 100644 index 0000000000..9b0bea5fdb --- /dev/null +++ b/third_party/python/gyp/test/actions/src/subdir3/null_input.gyp @@ -0,0 +1,29 @@ +# 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': 'null_input', + 'type': 'executable', + 'msvs_cygwin_shell': 0, + 'actions': [ + { + 'action_name': 'generate_main', + 'process_outputs_as_sources': 1, + 'inputs': [], + 'outputs': [ + '<(INTERMEDIATE_DIR)/main.c', + ], + 'action': [ + # TODO: we can't just use <(_outputs) here?! + 'python', 'generate_main.py', '<(INTERMEDIATE_DIR)/main.c', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + ], +} -- cgit v1.2.3