Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Unified Diff: tests/standalone/io/signals_test.dart

Issue 163273002: Add signal test for each supported signal. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/standalone/io/signal_test_script.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/signals_test.dart
diff --git a/tests/standalone/io/signals_test.dart b/tests/standalone/io/signals_test.dart
index 00805a5e5bf9c5bc1179947a263abbda7be0ab3b..f138f319d4709357bb5d8c97ab47942c8831c40a 100644
--- a/tests/standalone/io/signals_test.dart
+++ b/tests/standalone/io/signals_test.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import "dart:io";
+import "dart:convert";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
@@ -42,6 +43,32 @@ void testSignals(int usr1Expect,
});
}
+void testSignal(ProcessSignal signal) {
+ asyncStart();
+ Process.start(Platform.executable,
+ [Platform.script.resolve('signal_test_script.dart').toFilePath(),
+ signal.toString()])
+ .then((process) {
+ process.stdin.close();
+ process.stderr.transform(UTF8.decoder).listen(print);
Søren Gjesse 2014/02/13 10:54:27 Debug print?
Anders Johnsen 2014/02/13 12:08:03 Done.
+
+ var output = "";
+ process.stdout.transform(UTF8.decoder)
+ .listen((str) {
+ output += str;
+ if (output == 'ready\n') {
+ process.kill(signal);
+ }
+ }, onDone: () {
+ Expect.equals('ready\ngot signal\n', output);
+ });
+ process.exitCode.then((exitCode) {
+ Expect.equals(0, exitCode);
+ asyncEnd();
+ });
+ });
+}
+
void testListenCancel() {
for (int i = 0; i < 10; i++) {
@@ -61,4 +88,11 @@ void main() {
testSignals(1, 10);
testSignals(1, 0, 0, 1, true);
testSignals(0, 1, 1, 0, true);
+
Søren Gjesse 2014/02/13 10:54:27 Don't you need to skip some of these on Windows?
Anders Johnsen 2014/02/13 12:08:03 Already filtered out, see 10 lines above.
+ testSignal(ProcessSignal.SIGHUP);
+ testSignal(ProcessSignal.SIGINT);
+ testSignal(ProcessSignal.SIGTERM);
+ testSignal(ProcessSignal.SIGUSR1);
+ testSignal(ProcessSignal.SIGUSR2);
+ testSignal(ProcessSignal.SIGWINCH);
}
« no previous file with comments | « tests/standalone/io/signal_test_script.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698