| Index: tools/testing/dart/test_runner.dart
|
| diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
|
| index f9d7b998686646a48055c9a790d396d8de41f1e6..1cb1a3900edf351f6ac120afbb892f1dffb75864 100644
|
| --- a/tools/testing/dart/test_runner.dart
|
| +++ b/tools/testing/dart/test_runner.dart
|
| @@ -1854,6 +1854,7 @@ class RunningProcess {
|
| int pid;
|
| OutputLog stdout = new OutputLog();
|
| OutputLog stderr = new OutputLog();
|
| + List<String> diagnostics = <String>[];
|
| bool compilationSkipped = false;
|
| Completer<CommandOutput> completer;
|
|
|
| @@ -1917,46 +1918,35 @@ class RunningProcess {
|
|
|
| // Close stdin so that tests that try to block on input will fail.
|
| process.stdin.close();
|
| - void timeoutHandler() {
|
| + timeoutHandler() async {
|
| timedOut = true;
|
| if (process != null) {
|
| + var executable, arguments;
|
| if (io.Platform.isLinux) {
|
| - // Try to print stack traces of the timed out process.
|
| - io.Process.run('eu-stack', ['-p ${process.pid}'])
|
| - .then((result) {
|
| - io.stdout.write(result.stdout);
|
| - io.stderr.write(result.stderr);
|
| - })
|
| - .catchError(
|
| - (error) => print("Error when printing stack trace: $error"))
|
| - .whenComplete(() {
|
| - if (!process.kill()) {
|
| - DebugLogger.error("Unable to kill ${process.pid}");
|
| - }
|
| - });
|
| + executable = 'eu-stack';
|
| + arguments = ['-p ${process.pid}'];
|
| } else if (io.Platform.isMacOS) {
|
| // Try to print stack traces of the timed out process.
|
| // `sample` is a sampling profiler but we ask it sample for 1
|
| // second with a 4 second delay between samples so that we only
|
| // sample the threads once.
|
| - io.Process.run('/usr/bin/sample',
|
| - ['${process.pid}', '1', '4000', '-mayDie'])
|
| - .then((result) {
|
| - io.stdout.write(result.stdout);
|
| - io.stderr.write(result.stderr);
|
| - })
|
| - .catchError(
|
| - (error) => print("Error when printing stack trace: $error"))
|
| - .whenComplete(() {
|
| - if (!process.kill()) {
|
| - DebugLogger.error("Unable to kill ${process.pid}");
|
| - }
|
| - });
|
| - } else {
|
| - if (!process.kill()) {
|
| - DebugLogger.error("Unable to kill ${process.pid}");
|
| + executable = '/usr/bin/sample';
|
| + arguments = ['${process.pid}', '1', '4000', '-mayDie'];
|
| + }
|
| +
|
| + if (executable != null) {
|
| + try {
|
| + var result = await io.Process.run(executable, arguments);
|
| + diagnostics.addAll(result.stdout.split('\n'));
|
| + diagnostics.addAll(result.stderr.split('\n'));
|
| + } catch (error) {
|
| + diagnostics.add("Unable to capture stack traces: $error");
|
| }
|
| }
|
| +
|
| + if (!process.kill()) {
|
| + diagnostics.add("Unable to kill ${process.pid}");
|
| + }
|
| }
|
| }
|
|
|
| @@ -2014,6 +2004,7 @@ class RunningProcess {
|
| new DateTime.now().difference(startTime),
|
| compilationSkipped,
|
| pid);
|
| + commandOutput.diagnostics.addAll(diagnostics);
|
| return commandOutput;
|
| }
|
|
|
|
|