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,6 +521,24 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
catch (TestsCompiletimeError e) { catch (TestsCompiletimeError e) {
if (reportProblems) { if (reportProblems) {
e.getOriginal().printStackTrace(); e.getOriginal().printStackTrace();
generateInstructionsAsText();
System.err.println("See exceptions above");
}
else {
System.err.println("Compilation failure");
}
throw e;
}
catch (Throwable e) {
if (reportProblems) {
generateInstructionsAsText();
}
throw new TestsCompilerError(e);
}
return classFileFactory;
}
private void generateInstructionsAsText() {
System.err.println("Generating instructions as text..."); System.err.println("Generating instructions as text...");
try { try {
if (classFileFactory == null) { if (classFileFactory == null) {
@@ -535,17 +553,6 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
e1.printStackTrace(); e1.printStackTrace();
System.err.println("-----------------------------------------------------------------------------"); System.err.println("-----------------------------------------------------------------------------");
} }
System.err.println("See exceptions above");
}
else {
System.err.println("Compilation failure");
}
throw e;
}
catch (Throwable e) {
throw new TestsCompilerError(e);
}
return classFileFactory;
} }
protected boolean verifyWithDex() { protected boolean verifyWithDex() {