mirror of
https://github.com/dart-lang/sdk
synced 2024-07-21 02:14:37 +00:00
![Zijie He](/assets/img/avatar_default.png)
ffx will change the way product lookup prints out the download url, but the original solution is less ideal and using json is definitely better. So using the latest test-scripts would be a must-have before updating the fuchsia-sdk. A drive-by change is to return proc.returncode from with_envs.py. Change-Id: Ic4589597006226aa7f5b0e557fe1f084ad3a0a74 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345567 Reviewed-by: Ryan Macnak <rmacnak@google.com> Reviewed-by: Alexander Thomas <athom@google.com> Commit-Queue: Zijie He <zijiehe@google.com>
56 lines
1.8 KiB
Python
Executable file
56 lines
1.8 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, wait_for_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)
|
|
|
|
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())
|