OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Classes and methods for executing tests. | 6 * Classes and methods for executing tests. |
7 * | 7 * |
8 * This module includes: | 8 * This module includes: |
9 * - Managing parallel execution of tests, including timeout checks. | 9 * - Managing parallel execution of tests, including timeout checks. |
10 * - Evaluating the output of each test as pass/fail/crash/timeout. | 10 * - Evaluating the output of each test as pass/fail/crash/timeout. |
(...skipping 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1820 int timeout; | 1820 int timeout; |
1821 bool timedOut = false; | 1821 bool timedOut = false; |
1822 DateTime startTime; | 1822 DateTime startTime; |
1823 Timer timeoutTimer; | 1823 Timer timeoutTimer; |
1824 int pid; | 1824 int pid; |
1825 OutputLog stdout = new OutputLog(); | 1825 OutputLog stdout = new OutputLog(); |
1826 OutputLog stderr = new OutputLog(); | 1826 OutputLog stderr = new OutputLog(); |
1827 List<String> diagnostics = <String>[]; | 1827 List<String> diagnostics = <String>[]; |
1828 bool compilationSkipped = false; | 1828 bool compilationSkipped = false; |
1829 Completer<CommandOutput> completer; | 1829 Completer<CommandOutput> completer; |
| 1830 Map configuration; |
1830 List<String> preArguments; | 1831 List<String> preArguments; |
1831 | 1832 |
1832 RunningProcess(this.command, this.timeout, {this.preArguments}); | 1833 RunningProcess(this.command, |
| 1834 this.timeout, |
| 1835 {this.configuration, |
| 1836 this.preArguments}); |
1833 | 1837 |
1834 Future<CommandOutput> run() { | 1838 Future<CommandOutput> run() { |
1835 completer = new Completer<CommandOutput>(); | 1839 completer = new Completer<CommandOutput>(); |
1836 startTime = new DateTime.now(); | 1840 startTime = new DateTime.now(); |
1837 _runCommand(); | 1841 _runCommand(); |
1838 return completer.future; | 1842 return completer.future; |
1839 } | 1843 } |
1840 | 1844 |
1841 void _runCommand() { | 1845 void _runCommand() { |
1842 command.outputIsUpToDate.then((bool isUpToDate) { | 1846 command.outputIsUpToDate.then((bool isUpToDate) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 executable = 'eu-stack'; | 1905 executable = 'eu-stack'; |
1902 arguments = ['-p ${process.pid}']; | 1906 arguments = ['-p ${process.pid}']; |
1903 } else if (io.Platform.isMacOS) { | 1907 } else if (io.Platform.isMacOS) { |
1904 // Try to print stack traces of the timed out process. | 1908 // Try to print stack traces of the timed out process. |
1905 // `sample` is a sampling profiler but we ask it sample for 1 | 1909 // `sample` is a sampling profiler but we ask it sample for 1 |
1906 // second with a 4 second delay between samples so that we only | 1910 // second with a 4 second delay between samples so that we only |
1907 // sample the threads once. | 1911 // sample the threads once. |
1908 executable = '/usr/bin/sample'; | 1912 executable = '/usr/bin/sample'; |
1909 arguments = ['${process.pid}', '1', '4000', '-mayDie']; | 1913 arguments = ['${process.pid}', '1', '4000', '-mayDie']; |
1910 } else if (io.Platform.isWindows) { | 1914 } else if (io.Platform.isWindows) { |
1911 executable = "cdb.exe"; | 1915 bool is_x64 = command.executable.contains("X64") || |
| 1916 command.executable.contains("SIMARM64"); |
| 1917 executable = configuration['win_sdk_path'] + |
| 1918 "\\Debuggers\\" + (is_x64 ? "x64" : "x86") + "\\cdb.exe"; |
| 1919 diagnostics.add("Using $executable to print stack traces"); |
1912 arguments = ['-p', '${process.pid}', '-c', '!uniqstack;qd']; | 1920 arguments = ['-p', '${process.pid}', '-c', '!uniqstack;qd']; |
1913 } | 1921 } |
1914 | 1922 |
1915 if (executable != null) { | 1923 if (executable != null) { |
1916 try { | 1924 try { |
1917 var result = await io.Process.run(executable, arguments); | 1925 var result = await io.Process.run(executable, arguments); |
1918 diagnostics.addAll(result.stdout.split('\n')); | 1926 diagnostics.addAll(result.stdout.split('\n')); |
1919 diagnostics.addAll(result.stderr.split('\n')); | 1927 diagnostics.addAll(result.stderr.split('\n')); |
1920 } catch (error) { | 1928 } catch (error) { |
1921 diagnostics.add("Unable to capture stack traces: $error"); | 1929 diagnostics.add("Unable to capture stack traces: $error"); |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2702 assert(adbDevicePool != null); | 2710 assert(adbDevicePool != null); |
2703 return adbDevicePool.acquireDevice().then((AdbDevice device) { | 2711 return adbDevicePool.acquireDevice().then((AdbDevice device) { |
2704 return _runAdbPrecompilationCommand(device, command, timeout) | 2712 return _runAdbPrecompilationCommand(device, command, timeout) |
2705 .whenComplete(() { | 2713 .whenComplete(() { |
2706 adbDevicePool.releaseDevice(device); | 2714 adbDevicePool.releaseDevice(device); |
2707 }); | 2715 }); |
2708 }); | 2716 }); |
2709 } else if (command is VmCommand && command.needsDFERunner) { | 2717 } else if (command is VmCommand && command.needsDFERunner) { |
2710 final runner = _getDFEProcess(); | 2718 final runner = _getDFEProcess(); |
2711 return runner.acquire().then((port) { | 2719 return runner.acquire().then((port) { |
2712 return new RunningProcess(command, timeout, preArguments: ['-DDFE_WORKER
_PORT=${port}']).run(); | 2720 return new RunningProcess(command, timeout, |
| 2721 configuration: globalConfiguration, |
| 2722 preArguments: ['-DDFE_WORKER_PORT=${port}']).run(); |
2713 }).whenComplete(() => runner.release()); | 2723 }).whenComplete(() => runner.release()); |
2714 } else if (command is VmBatchCommand) { | 2724 } else if (command is VmBatchCommand) { |
2715 var name = command.displayName; | 2725 var name = command.displayName; |
2716 return _getBatchRunner(command.displayName + command.dartFile) | 2726 return _getBatchRunner(command.displayName + command.dartFile) |
2717 .runCommand(name, command, timeout, command.arguments); | 2727 .runCommand(name, command, timeout, command.arguments); |
2718 } else { | 2728 } else { |
2719 return new RunningProcess(command, timeout).run(); | 2729 return new RunningProcess( |
| 2730 command, timeout, configuration: globalConfiguration).run(); |
2720 } | 2731 } |
2721 } | 2732 } |
2722 | 2733 |
2723 Future<CommandOutput> _runAdbPrecompilationCommand( | 2734 Future<CommandOutput> _runAdbPrecompilationCommand( |
2724 AdbDevice device, AdbPrecompilationCommand command, int timeout) async { | 2735 AdbDevice device, AdbPrecompilationCommand command, int timeout) async { |
2725 var runner = command.precompiledRunnerFilename; | 2736 var runner = command.precompiledRunnerFilename; |
2726 var processTest = command.processTestFilename; | 2737 var processTest = command.processTestFilename; |
2727 var testdir = command.precompiledTestDirectory; | 2738 var testdir = command.precompiledTestDirectory; |
2728 var arguments = command.arguments; | 2739 var arguments = command.arguments; |
2729 var devicedir = DartPrecompiledAdbRuntimeConfiguration.DeviceDir; | 2740 var devicedir = DartPrecompiledAdbRuntimeConfiguration.DeviceDir; |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3243 } | 3254 } |
3244 } | 3255 } |
3245 | 3256 |
3246 void eventAllTestsDone() { | 3257 void eventAllTestsDone() { |
3247 for (var listener in _eventListener) { | 3258 for (var listener in _eventListener) { |
3248 listener.allDone(); | 3259 listener.allDone(); |
3249 } | 3260 } |
3250 _allDone(); | 3261 _allDone(); |
3251 } | 3262 } |
3252 } | 3263 } |
OLD | NEW |