2021-04-15 10:10:20 +00:00
|
|
|
#!/usr/bin/env python3
|
2011-10-05 05:34:19 +00:00
|
|
|
# Copyright (c) 2011, 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.
|
|
|
|
|
2021-04-15 10:10:20 +00:00
|
|
|
from contextlib import ExitStack
|
2011-10-05 05:34:19 +00:00
|
|
|
import os
|
2012-02-03 13:32:59 +00:00
|
|
|
import string
|
|
|
|
import subprocess
|
2011-10-05 05:34:19 +00:00
|
|
|
import sys
|
|
|
|
|
2012-03-23 11:52:43 +00:00
|
|
|
import utils
|
|
|
|
|
2011-10-05 05:34:19 +00:00
|
|
|
|
|
|
|
def Main():
|
2019-08-05 20:34:31 +00:00
|
|
|
args = sys.argv[1:]
|
2019-06-14 23:35:10 +00:00
|
|
|
|
2020-11-02 13:24:09 +00:00
|
|
|
cleanup_dart = False
|
2020-11-02 15:22:55 +00:00
|
|
|
if '--cleanup-dart-processes' in args:
|
|
|
|
args.remove('--cleanup-dart-processes')
|
2020-11-02 13:24:09 +00:00
|
|
|
cleanup_dart = True
|
|
|
|
|
2019-08-05 20:34:31 +00:00
|
|
|
tools_dir = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
repo_dir = os.path.dirname(tools_dir)
|
|
|
|
dart_test_script = os.path.join(repo_dir, 'pkg', 'test_runner', 'bin',
|
|
|
|
'test_runner.dart')
|
|
|
|
command = [utils.CheckedInSdkExecutable(), dart_test_script] + args
|
2016-05-02 12:01:44 +00:00
|
|
|
|
2019-08-05 20:34:31 +00:00
|
|
|
# The testing script potentially needs the android platform tools in PATH so
|
|
|
|
# we do that in ./tools/test.py (a similar logic exists in ./tools/build.py).
|
|
|
|
android_platform_tools = os.path.normpath(
|
|
|
|
os.path.join(tools_dir,
|
|
|
|
'../third_party/android_tools/sdk/platform-tools'))
|
|
|
|
if os.path.isdir(android_platform_tools):
|
|
|
|
os.environ['PATH'] = '%s%s%s' % (os.environ['PATH'], os.pathsep,
|
|
|
|
android_platform_tools)
|
2016-05-02 12:01:44 +00:00
|
|
|
|
2019-08-05 20:34:31 +00:00
|
|
|
with utils.FileDescriptorLimitIncreaser():
|
2021-04-15 10:10:20 +00:00
|
|
|
with ExitStack() as stack:
|
|
|
|
for ctx in utils.CoreDumpArchiver(args):
|
|
|
|
stack.enter_context(ctx)
|
2019-08-05 20:34:31 +00:00
|
|
|
exit_code = subprocess.call(command)
|
2017-01-19 16:25:39 +00:00
|
|
|
|
2020-11-02 13:24:09 +00:00
|
|
|
if cleanup_dart:
|
|
|
|
cleanup_command = [
|
|
|
|
sys.executable,
|
|
|
|
os.path.join(tools_dir, 'task_kill.py'), '--kill_dart=True',
|
|
|
|
'--kill_vc=False'
|
|
|
|
]
|
|
|
|
subprocess.call(cleanup_command)
|
|
|
|
|
2019-08-05 20:34:31 +00:00
|
|
|
utils.DiagnoseExitCode(exit_code, command)
|
|
|
|
return exit_code
|
2012-03-23 11:52:43 +00:00
|
|
|
|
2011-10-05 05:34:19 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2019-08-05 20:34:31 +00:00
|
|
|
sys.exit(Main())
|