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-solibs-avoid-relinking.py | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 third_party/python/gyp/test/ninja/solibs_avoid_relinking/gyptest-solibs-avoid-relinking.py (limited to 'third_party/python/gyp/test/ninja/solibs_avoid_relinking/gyptest-solibs-avoid-relinking.py') diff --git a/third_party/python/gyp/test/ninja/solibs_avoid_relinking/gyptest-solibs-avoid-relinking.py b/third_party/python/gyp/test/ninja/solibs_avoid_relinking/gyptest-solibs-avoid-relinking.py new file mode 100755 index 0000000000..fd4470ac23 --- /dev/null +++ b/third_party/python/gyp/test/ninja/solibs_avoid_relinking/gyptest-solibs-avoid-relinking.py @@ -0,0 +1,48 @@ +#!/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 relinking a solib doesn't relink a dependent executable if the +solib's public API hasn't changed. +""" + +from __future__ import print_function + +import os +import sys +import TestCommon +import TestGyp + +# NOTE(fischman): This test will not work with other generators because the +# API-hash-based-mtime-preservation optimization is only implemented in +# ninja.py. It could be extended to the make.py generator as well pretty +# easily, probably. +# (also, it tests ninja-specific out paths, which would have to be generalized +# if this was extended to other generators). +test = TestGyp.TestGyp(formats=['ninja']) + +if not os.environ.get('ProgramFiles(x86)'): + # TODO(scottmg) + print('Skipping test on x86, http://crbug.com/365833') + test.pass_test() + +test.run_gyp('solibs_avoid_relinking.gyp') + +# Build the executable, grab its timestamp, touch the solib's source, rebuild +# executable, ensure timestamp hasn't changed. +test.build('solibs_avoid_relinking.gyp', 'b') +test.built_file_must_exist('b' + TestCommon.exe_suffix) +pre_stat = os.stat(test.built_file_path('b' + TestCommon.exe_suffix)) +os.utime(os.path.join(test.workdir, 'solib.cc'), + (pre_stat.st_atime, pre_stat.st_mtime + 100)) +test.sleep() +test.build('solibs_avoid_relinking.gyp', 'b') +post_stat = os.stat(test.built_file_path('b' + TestCommon.exe_suffix)) + +if pre_stat.st_mtime != post_stat.st_mtime: + test.fail_test() +else: + test.pass_test() -- cgit v1.2.3