diff --git a/pkg/dartdev/test/commands/create_integration_test.dart b/pkg/dartdev/test/commands/create_integration_test.dart index 510e34d971d..09e29cdcb3b 100644 --- a/pkg/dartdev/test/commands/create_integration_test.dart +++ b/pkg/dartdev/test/commands/create_integration_test.dart @@ -133,20 +133,31 @@ void defineCreateTests() { // if they've executed correctly. These templates won't exit on their // own, so we'll need to terminate the process once we've verified it // runs correctly. + var hasError = false; stdoutSub = process.stdout.transform(utf8.decoder).listen((e) { print('stdout: $e'); - if ((isServerTemplate && e.contains('Server listening on port')) || + if (e.contains('[SEVERE]') || + (isServerTemplate && e.contains('Server listening on port')) || (isWebTemplate && e.contains('Succeeded after'))) { + if (e.contains('[SEVERE]')) { + hasError = true; + } stderrSub.cancel(); stdoutSub.cancel(); process.kill(); completer.complete(); } }); - stderrSub = process.stderr - .transform(utf8.decoder) - .listen((e) => print('stderr: $e')); + stderrSub = process.stderr.transform(utf8.decoder).listen((e) { + print('stderr: $e'); + hasError = true; + stderrSub.cancel(); + stdoutSub.cancel(); + process.kill(); + completer.complete(); + }); await completer.future; + expect(hasError, isFalse, reason: 'Command $command failed.'); // Since we had to terminate the process manually, we aren't certain // as to what the exit code will be on all platforms (should be -15 @@ -154,9 +165,25 @@ void defineCreateTests() { // here. await process.exitCode; } else { + final output = []; + final errors = []; + process.stdout.transform(utf8.decoder).listen(output.add); + process.stderr.transform(utf8.decoder).listen(errors.add); + // If the sample should exit on its own, it should always result in // an exit code of 0. - expect(await process.exitCode, 0); + final duration = const Duration(seconds: 30); + final exitCode = + await process.exitCode.timeout(duration, onTimeout: () { + print('Command $command timed out'); + return -1; + }); + if (exitCode != 0) { + print('Command $command exited with code $exitCode'); + print('Output: \n${output.join('\n')}'); + print('Errors: \n${errors.join('\n')}'); + } + expect(exitCode, 0); } print('[${i + 1} / ${runCommands.length}] Done "$command".'); } diff --git a/pkg/pkg.status b/pkg/pkg.status index f10c16756cc..c53c32a0763 100644 --- a/pkg/pkg.status +++ b/pkg/pkg.status @@ -147,7 +147,6 @@ vm_service/test/*: SkipByDesign # Uses dart:io vm_snapshot_analysis/test/*: SkipByDesign # Only meant to run on vm [ $system == windows ] -dartdev/test/commands/create_integration_test: Skip # dartbug.com/51037 until fix lands for windows front_end/test/fasta/bootstrap_test: Skip # Issue 31902 front_end/test/fasta/strong_test: Pass, Slow, Timeout front_end/test/incremental_dart2js_load_from_dill_test: Pass, Slow