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

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

Issue 285023002: Fix listening for multiple signals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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 d73b01ac256c1507ea89eb5a226c84b59e720ab2..a8112088df187ac07011a1afb8a6970f6e66224c 100644
--- a/tests/standalone/io/signals_test.dart
+++ b/tests/standalone/io/signals_test.dart
@@ -60,7 +60,7 @@ void testSignal(ProcessSignal signal) {
process.kill(signal);
}
}, onDone: () {
- Expect.equals('ready\ngot signal\n', output);
+ Expect.equals('ready\n$signal\n', output);
});
process.exitCode.then((exitCode) {
Expect.equals(0, exitCode);
@@ -69,6 +69,34 @@ void testSignal(ProcessSignal signal) {
});
}
+void testMultipleSignals(List<ProcessSignal> signals) {
+ for (var signal in signals) {
+ asyncStart();
+ Process.start(Platform.executable,
+ [Platform.script.resolve('signal_test_script.dart').toFilePath()]
+ ..addAll(signals.map((s) => s.toString())))
+ .then((process) {
+ process.stdin.close();
+ process.stderr.drain();
+
+ var output = "";
+ process.stdout.transform(UTF8.decoder)
+ .listen((str) {
+ output += str;
+ if (output == 'ready\n') {
+ process.kill(signal);
+ }
+ }, onDone: () {
+ Expect.equals('ready\n$signal\n', output);
+ });
+ process.exitCode.then((exitCode) {
+ Expect.equals(0, exitCode);
+ asyncEnd();
+ });
+ });
+ }
+}
+
void testListenCancel() {
for (int i = 0; i < 10; i++) {
@@ -95,4 +123,12 @@ void main() {
testSignal(ProcessSignal.SIGUSR1);
testSignal(ProcessSignal.SIGUSR2);
testSignal(ProcessSignal.SIGWINCH);
+
+ testMultipleSignals([
+ ProcessSignal.SIGHUP,
+ ProcessSignal.SIGINT,
+ ProcessSignal.SIGTERM,
+ ProcessSignal.SIGUSR1,
+ ProcessSignal.SIGUSR2,
+ 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