Flutter Engine
The Flutter Engine
test.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
3# for details. All rights reserved. Use of this source code is governed by a
4# BSD-style license that can be found in the LICENSE file.
5
6from contextlib import ExitStack
7import os
8import string
9import subprocess
10import sys
11
12import utils
13
14
15def Main():
16 args = sys.argv[1:]
17
18 cleanup_dart = False
19 if '--cleanup-dart-processes' in args:
20 args.remove('--cleanup-dart-processes')
21 cleanup_dart = True
22
23 tools_dir = os.path.dirname(os.path.realpath(__file__))
24 repo_dir = os.path.dirname(tools_dir)
25 dart_test_script = os.path.join(repo_dir, 'pkg', 'test_runner', 'bin',
26 'test_runner.dart')
27 command = [utils.CheckedInSdkExecutable(), dart_test_script] + args
28
29 # The testing script potentially needs the android platform tools in PATH so
30 # we do that in ./tools/test.py (a similar logic exists in ./tools/build.py).
31 android_platform_tools = os.path.normpath(
32 os.path.join(tools_dir,
33 '../third_party/android_tools/sdk/platform-tools'))
34 if os.path.isdir(android_platform_tools):
35 os.environ['PATH'] = '%s%s%s' % (os.environ['PATH'], os.pathsep,
36 android_platform_tools)
37
39 with ExitStack() as stack:
40 for ctx in utils.CoreDumpArchiver(args):
41 stack.enter_context(ctx)
42 exit_code = subprocess.call(command)
43
44 if cleanup_dart:
45 cleanup_command = [
46 sys.executable,
47 os.path.join(tools_dir, 'task_kill.py'), '--kill_dart=True',
48 '--kill_vc=False'
49 ]
50 subprocess.call(cleanup_command)
51
52 utils.DiagnoseExitCode(exit_code, command)
53 return exit_code
54
55
56if __name__ == '__main__':
57 sys.exit(Main())
def Main()
Definition: test.py:15
def CoreDumpArchiver(args)
Definition: utils.py:973
def DiagnoseExitCode(exit_code, command)
Definition: utils.py:492
def FileDescriptorLimitIncreaser()
Definition: utils.py:995
def CheckedInSdkExecutable()
Definition: utils.py:504