Files
sdk/build/fuchsia/with_envs.py
T
zijiehe-google-com 65cdd580c7 [fuchsia] Uprev test-scripts with FUCHSIA_READELF env
Copied from http://go/dart-reviews/421761 with the essential fix to
make it work.

1) Add the env to select the right readelf.
2) Remove the removal of arch/, it's referred by meta.json.

Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-x64-try,vm-fuchsia-release-arm64-try
Bug: b/407890258, b/338009514
Change-Id: Ib7ae646e57082d310d3d76ca16834faefb888201
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421881
Auto-Submit: Zijie He <zijiehe@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-04-14 11:07:11 -07:00

63 lines
2.2 KiB
Python
Executable File

#!/usr/bin/env python3
# Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
# for details. 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 platform
import subprocess
import sys
sys.path.insert(
0,
os.path.abspath(
os.path.join(os.path.dirname(__file__),
'../../third_party/fuchsia/test_scripts/test/')))
from common import catch_sigterm
def Main():
"""
Execute the test-scripts with required environment variables. It acts like
/usr/bin/env, but provides some extra functionality to dynamically set up
the environment variables.
"""
# Ensures the signals can be correctly forwarded to the subprocesses.
catch_sigterm()
os.environ['SRC_ROOT'] = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
os.environ['FUCHSIA_IMAGES_ROOT'] = os.path.join(os.environ['SRC_ROOT'],
'third_party', 'fuchsia',
'images')
sdk_dir = ''
if platform.system() == 'Linux':
sdk_dir = 'linux'
elif platform.system() == 'Darwin':
sdk_dir = 'mac'
else:
assert False, 'Unsupported OS'
os.environ['FUCHSIA_SDK_ROOT'] = os.path.join(os.environ['SRC_ROOT'],
'third_party', 'fuchsia',
'sdk', sdk_dir)
os.environ['FUCHSIA_GN_SDK_ROOT'] = os.path.join(os.environ['SRC_ROOT'],
'third_party', 'fuchsia',
'gn-sdk', 'src')
os.environ['FUCHSIA_READELF'] = os.path.join(os.environ['SRC_ROOT'],
'buildtools', 'linux-x64',
'clang', 'bin', 'llvm-readelf')
with subprocess.Popen(sys.argv[1:]) as proc:
try:
proc.wait()
except:
# Use terminate / SIGTERM to allow the subprocess exiting cleanly.
proc.terminate()
return proc.returncode
if __name__ == '__main__':
sys.exit(Main())