diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /third_party/python/gyp/test/linux/gyptest-ldflags-from-environment.py | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/python/gyp/test/linux/gyptest-ldflags-from-environment.py')
-rw-r--r-- | third_party/python/gyp/test/linux/gyptest-ldflags-from-environment.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/linux/gyptest-ldflags-from-environment.py b/third_party/python/gyp/test/linux/gyptest-ldflags-from-environment.py new file mode 100644 index 0000000000..4aea193e4b --- /dev/null +++ b/third_party/python/gyp/test/linux/gyptest-ldflags-from-environment.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +# Copyright (c) 2017 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 the use of linker flags in environment variables. + +In this test, gyp and build both run in same local environment. +""" + +import TestGyp + +import re +import subprocess +import sys + +FORMATS = ('make', 'ninja') + +if sys.platform.startswith('linux'): + test = TestGyp.TestGyp(formats=FORMATS) + + CHDIR = 'ldflags-from-environment' + with TestGyp.LocalEnv({'LDFLAGS': '-Wl,--dynamic-linker=/target', + 'LDFLAGS_host': '-Wl,--dynamic-linker=/host', + 'GYP_CROSSCOMPILE': '1'}): + test.run_gyp('test.gyp', chdir=CHDIR) + test.build('test.gyp', chdir=CHDIR) + + def GetDynamicLinker(p): + p = test.built_file_path(p, chdir=CHDIR) + r = re.compile(r'\[Requesting program interpreter: ([^\]]+)\]') + proc = subprocess.Popen(['readelf', '-l', p], stdout=subprocess.PIPE) + o = proc.communicate()[0].decode('utf-8') + assert not proc.returncode + return r.search(o).group(1) + + if GetDynamicLinker('ldflags') != '/target': + test.fail_test() + + if GetDynamicLinker('ldflags_host') != '/host': + test.fail_test() + + test.pass_test() |