| 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 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1847 watchdogTimer.cancel(); | 1847 watchdogTimer.cancel(); |
| 1848 } | 1848 } |
| 1849 } | 1849 } |
| 1850 } | 1850 } |
| 1851 | 1851 |
| 1852 // Close stdin so that tests that try to block on input will fail. | 1852 // Close stdin so that tests that try to block on input will fail. |
| 1853 process.stdin.close(); | 1853 process.stdin.close(); |
| 1854 void timeoutHandler() { | 1854 void timeoutHandler() { |
| 1855 timedOut = true; | 1855 timedOut = true; |
| 1856 if (process != null) { | 1856 if (process != null) { |
| 1857 if (!process.kill()) { | 1857 if (io.Platform.isLinux) { |
| 1858 DebugLogger.error("Unable to kill ${process.pid}"); | 1858 // Try to print stack traces of the timed out process. |
| 1859 io.Process.run('eu-stack', ['-p ${process.pid}']) |
| 1860 .then((result) { |
| 1861 io.stdout.write(result.stdout); |
| 1862 io.stderr.write(result.stderr); |
| 1863 }) |
| 1864 .catchError( |
| 1865 (error) => print("Error when printing stack trace: $error")) |
| 1866 .whenComplete(() { |
| 1867 if (!process.kill()) { |
| 1868 DebugLogger.error("Unable to kill ${process.pid}"); |
| 1869 } |
| 1870 }); |
| 1871 } else { |
| 1872 if (!process.kill()) { |
| 1873 DebugLogger.error("Unable to kill ${process.pid}"); |
| 1874 } |
| 1859 } | 1875 } |
| 1860 } | 1876 } |
| 1861 } | 1877 } |
| 1862 | 1878 |
| 1863 stdoutSubscription.asFuture().then(closeStdout); | 1879 stdoutSubscription.asFuture().then(closeStdout); |
| 1864 stderrSubscription.asFuture().then(closeStderr); | 1880 stderrSubscription.asFuture().then(closeStderr); |
| 1865 | 1881 |
| 1866 process.exitCode.then((exitCode) { | 1882 process.exitCode.then((exitCode) { |
| 1867 if (!stdoutDone || !stderrDone) { | 1883 if (!stdoutDone || !stderrDone) { |
| 1868 watchdogTimer = new Timer(MAX_STDIO_DELAY, () { | 1884 watchdogTimer = new Timer(MAX_STDIO_DELAY, () { |
| (...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3044 } | 3060 } |
| 3045 } | 3061 } |
| 3046 | 3062 |
| 3047 void eventAllTestsDone() { | 3063 void eventAllTestsDone() { |
| 3048 for (var listener in _eventListener) { | 3064 for (var listener in _eventListener) { |
| 3049 listener.allDone(); | 3065 listener.allDone(); |
| 3050 } | 3066 } |
| 3051 _allDone(); | 3067 _allDone(); |
| 3052 } | 3068 } |
| 3053 } | 3069 } |
| OLD | NEW |