Generate instructions as text in case of other exceptions

It makes possible to analyze what causes a failure if DxChecker.check fails
This commit is contained in:
Dmitry Petrov
2019-12-27 13:55:54 +03:00
parent 4b6202c902
commit 76e7a9ba4a
@@ -521,20 +521,7 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
catch (TestsCompiletimeError e) { catch (TestsCompiletimeError e) {
if (reportProblems) { if (reportProblems) {
e.getOriginal().printStackTrace(); e.getOriginal().printStackTrace();
System.err.println("Generating instructions as text..."); generateInstructionsAsText();
try {
if (classFileFactory == null) {
System.err.println("Cannot generate text: exception was thrown during generation");
}
else {
System.err.println(classFileFactory.createText());
}
}
catch (Throwable e1) {
System.err.println("Exception thrown while trying to generate text, the actual exception follows:");
e1.printStackTrace();
System.err.println("-----------------------------------------------------------------------------");
}
System.err.println("See exceptions above"); System.err.println("See exceptions above");
} }
else { else {
@@ -543,11 +530,31 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
throw e; throw e;
} }
catch (Throwable e) { catch (Throwable e) {
if (reportProblems) {
generateInstructionsAsText();
}
throw new TestsCompilerError(e); throw new TestsCompilerError(e);
} }
return classFileFactory; return classFileFactory;
} }
private void generateInstructionsAsText() {
System.err.println("Generating instructions as text...");
try {
if (classFileFactory == null) {
System.err.println("Cannot generate text: exception was thrown during generation");
}
else {
System.err.println(classFileFactory.createText());
}
}
catch (Throwable e1) {
System.err.println("Exception thrown while trying to generate text, the actual exception follows:");
e1.printStackTrace();
System.err.println("-----------------------------------------------------------------------------");
}
}
protected boolean verifyWithDex() { protected boolean verifyWithDex() {
return true; return true;
} }