Skip to content

Commit b6bcdea

Browse files
Anna GringauzeCommit Queue
Anna Gringauze
authored and
Commit Queue
committed
[dartdev] Fix webdev integration test
Closes: #51106 Closes: #51037 Change-Id: If88b3e800764dbf0be4e294dc996fa2bc74be1f3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280561 Reviewed-by: Nicholas Shahan <[email protected]> Reviewed-by: Ben Konyi <[email protected]> Commit-Queue: Anna Gringauze <[email protected]>
1 parent dae49a0 commit b6bcdea

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

pkg/dartdev/test/commands/create_integration_test.dart

+32-5
Original file line numberDiff line numberDiff line change
@@ -133,30 +133,57 @@ void defineCreateTests() {
133133
// if they've executed correctly. These templates won't exit on their
134134
// own, so we'll need to terminate the process once we've verified it
135135
// runs correctly.
136+
var hasError = false;
136137
stdoutSub = process.stdout.transform(utf8.decoder).listen((e) {
137138
print('stdout: $e');
138-
if ((isServerTemplate && e.contains('Server listening on port')) ||
139+
if (e.contains('[SEVERE]') ||
140+
(isServerTemplate && e.contains('Server listening on port')) ||
139141
(isWebTemplate && e.contains('Succeeded after'))) {
142+
if (e.contains('[SEVERE]')) {
143+
hasError = true;
144+
}
140145
stderrSub.cancel();
141146
stdoutSub.cancel();
142147
process.kill();
143148
completer.complete();
144149
}
145150
});
146-
stderrSub = process.stderr
147-
.transform(utf8.decoder)
148-
.listen((e) => print('stderr: $e'));
151+
stderrSub = process.stderr.transform(utf8.decoder).listen((e) {
152+
print('stderr: $e');
153+
hasError = true;
154+
stderrSub.cancel();
155+
stdoutSub.cancel();
156+
process.kill();
157+
completer.complete();
158+
});
149159
await completer.future;
160+
expect(hasError, isFalse, reason: 'Command $command failed.');
150161

151162
// Since we had to terminate the process manually, we aren't certain
152163
// as to what the exit code will be on all platforms (should be -15
153164
// for POSIX systems), so we'll just wait for the process to exit
154165
// here.
155166
await process.exitCode;
156167
} else {
168+
final output = <String>[];
169+
final errors = <String>[];
170+
process.stdout.transform(utf8.decoder).listen(output.add);
171+
process.stderr.transform(utf8.decoder).listen(errors.add);
172+
157173
// If the sample should exit on its own, it should always result in
158174
// an exit code of 0.
159-
expect(await process.exitCode, 0);
175+
final duration = const Duration(seconds: 30);
176+
final exitCode =
177+
await process.exitCode.timeout(duration, onTimeout: () {
178+
print('Command $command timed out');
179+
return -1;
180+
});
181+
if (exitCode != 0) {
182+
print('Command $command exited with code $exitCode');
183+
print('Output: \n${output.join('\n')}');
184+
print('Errors: \n${errors.join('\n')}');
185+
}
186+
expect(exitCode, 0);
160187
}
161188
print('[${i + 1} / ${runCommands.length}] Done "$command".');
162189
}

pkg/pkg.status

-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ vm_service/test/*: SkipByDesign # Uses dart:io
147147
vm_snapshot_analysis/test/*: SkipByDesign # Only meant to run on vm
148148

149149
[ $system == windows ]
150-
dartdev/test/commands/create_integration_test: Skip # dartbug.com/51037 until fix lands for windows
151150
front_end/test/fasta/bootstrap_test: Skip # Issue 31902
152151
front_end/test/fasta/strong_test: Pass, Slow, Timeout
153152
front_end/test/incremental_dart2js_load_from_dill_test: Pass, Slow

0 commit comments

Comments
 (0)