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 --- .../gyptest-action.py | 45 ++++++++++++++++++++++ .../src/action.gyp | 28 ++++++++++++++ .../src/rcopy.py | 20 ++++++++++ 3 files changed, 93 insertions(+) create mode 100755 third_party/python/gyp/test/actions-multiple-outputs-with-dependencies/gyptest-action.py create mode 100644 third_party/python/gyp/test/actions-multiple-outputs-with-dependencies/src/action.gyp create mode 100644 third_party/python/gyp/test/actions-multiple-outputs-with-dependencies/src/rcopy.py (limited to 'third_party/python/gyp/test/actions-multiple-outputs-with-dependencies') diff --git a/third_party/python/gyp/test/actions-multiple-outputs-with-dependencies/gyptest-action.py b/third_party/python/gyp/test/actions-multiple-outputs-with-dependencies/gyptest-action.py new file mode 100755 index 0000000000..a9d218282c --- /dev/null +++ b/third_party/python/gyp/test/actions-multiple-outputs-with-dependencies/gyptest-action.py @@ -0,0 +1,45 @@ +#!/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 actions with multiple outputs & dependncies will correctly rebuild. + +This is a regression test for crrev.com/1177163002. +""" + +from __future__ import print_function + +import TestGyp +import os +import sys +import time + +if sys.platform in ('darwin', 'win32'): + print("This test is currently disabled: https://crbug.com/483696.") + sys.exit(0) + +test = TestGyp.TestGyp() + +TESTDIR='relocate/src' +test.run_gyp('action.gyp', chdir='src') +test.relocate('src', TESTDIR) + +def build_and_check(content): + test.write(TESTDIR + '/input.txt', content) + test.build('action.gyp', 'upper', chdir=TESTDIR) + test.built_file_must_match('result.txt', content, chdir=TESTDIR) + +build_and_check('Content for first build.') + +# Ninja works with timestamps and the test above is fast enough that the +# 'updated' file may end up with the same timestamp as the original, meaning +# that ninja may not always recognize the input file has changed. +if test.format == 'ninja': + time.sleep(1) + +build_and_check('An updated input file.') + +test.pass_test() diff --git a/third_party/python/gyp/test/actions-multiple-outputs-with-dependencies/src/action.gyp b/third_party/python/gyp/test/actions-multiple-outputs-with-dependencies/src/action.gyp new file mode 100644 index 0000000000..a305d65ea9 --- /dev/null +++ b/third_party/python/gyp/test/actions-multiple-outputs-with-dependencies/src/action.gyp @@ -0,0 +1,28 @@ +# 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': 'upper', + 'type': 'none', + 'actions': [{ + 'action_name': 'upper_action', + 'inputs': ['<(PRODUCT_DIR)/out2.txt'], + 'outputs': ['<(PRODUCT_DIR)/result.txt'], + 'action': ['python', 'rcopy.py', '<@(_inputs)', '<@(_outputs)'], + }], + }, + { + 'target_name': 'lower', + 'type': 'none', + 'actions': [{ + 'action_name': 'lower_action', + 'inputs': ['input.txt'], + 'outputs': ['<(PRODUCT_DIR)/out1.txt', '<(PRODUCT_DIR)/out2.txt'], + 'action': ['python', 'rcopy.py', '<@(_inputs)', '<@(_outputs)'], + }], + }, + ], +} diff --git a/third_party/python/gyp/test/actions-multiple-outputs-with-dependencies/src/rcopy.py b/third_party/python/gyp/test/actions-multiple-outputs-with-dependencies/src/rcopy.py new file mode 100644 index 0000000000..fb029598c4 --- /dev/null +++ b/third_party/python/gyp/test/actions-multiple-outputs-with-dependencies/src/rcopy.py @@ -0,0 +1,20 @@ +#!/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. + +import os +import sys + +"""A slightly odd 'cp' implementation for this test. + +This 'cp' can have many targets, but only one source. 'cp src dest1 dest2' +will copy the file 'src' to both 'dest1' and 'dest2'.""" + +with open(sys.argv[1], 'r') as f: + src = f.read() +for dest in sys.argv[2:]: + with open(dest, 'w') as f: + f.write(src) + -- cgit v1.2.3