[CFE] Better error and reproduction on compile and lint crash Change-Id: I7555d9d2c7244325d4eacba4cc8780c2a98a4fc3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385600 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Jens Johansen <jensj@google.com>
diff --git a/pkg/front_end/presubmit_helper_spawn.dart b/pkg/front_end/presubmit_helper_spawn.dart index dd52fcc..fd0b01c 100644 --- a/pkg/front_end/presubmit_helper_spawn.dart +++ b/pkg/front_end/presubmit_helper_spawn.dart
@@ -37,9 +37,43 @@ includedFiles: work.includedFiles, includedDirectoryUris: work.includedDirectoryUris, repoDir: work.repoDir)); - } catch (e) { + } catch (e, st) { // This will make it send false. compileAndLintErrorsFound = -1; + + StringBuffer sb = new StringBuffer(); + sb.writeln("void main() {"); + sb.writeln(" runCompileAndLintTest(includedFiles: {"); + String comma = ""; + for (Uri uri in work.includedFiles) { + sb.writeln(" ${comma}Uri.parse('$uri')"); + comma = ", "; + } + sb.writeln(" }, includedDirectoryUris: {"); + comma = ""; + for (Uri uri in work.includedDirectoryUris) { + sb.writeln(" ${comma}Uri.parse('$uri')"); + comma = ", "; + } + sb.writeln(" }, repoDir: Uri.parse('${work.repoDir}'));"); + sb.writeln("}"); + + print(""" +WARNING: '${work.name}' crashed: +============ +${e.toString().trim()} +============ +$st +============ + +To reproduce open up compile_and_lint_impl.dart and insert + +$sb + +Then run that file through your debugger or similar. + +"""); + print("Got error for ${work.name}: $e"); } print("Sending ok = ${compileAndLintErrorsFound == 0} " "for ${work.name} after ${stopwatch.elapsed}");
diff --git a/pkg/front_end/test/compile_and_lint_impl.dart b/pkg/front_end/test/compile_and_lint_impl.dart index cfe3f41..2c4e6da 100644 --- a/pkg/front_end/test/compile_and_lint_impl.dart +++ b/pkg/front_end/test/compile_and_lint_impl.dart
@@ -181,6 +181,7 @@ in Directory.fromUri(packageEntry.key.packageUriRoot) .listSync(recursive: true)) { if (f is! File) continue; + if (!f.path.endsWith(".dart")) continue; if (helpers[f.uri] == null) { FileInfoHelper fileInfo = indexUriHelper(f.uri); for (String name in fileInfo.libraryNames) {