8275173: testlibrary_tests/ir_framework/tests/TestCheckedTests.java fails after JDK-8274911

Reviewed-by: chagedorn, thartmann
This commit is contained in:
Jie Fu 2021-10-13 14:30:11 +00:00
parent 5ffb5d100f
commit 451a296510

View File

@ -26,6 +26,8 @@ package ir_framework.tests;
import compiler.lib.ir_framework.*;
import compiler.lib.ir_framework.driver.IRViolationException;
import compiler.lib.ir_framework.driver.TestVMException;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import jdk.test.lib.Asserts;
/*
@ -41,11 +43,17 @@ public class TestCheckedTests {
public int iFld;
public static void main(String[] args) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream oldOut = System.out;
System.setOut(ps);
TestFramework.run();
try {
TestFramework.run(BadIRAndRuntimeCheckedTests.class);
Utils.shouldHaveThrownException();
Utils.shouldHaveThrownException(baos.toString());
} catch (TestVMException e) {
System.setOut(oldOut);
Asserts.assertTrue(e.getExceptionInfo().contains("Test Failures (2)"));
Asserts.assertTrue(e.getExceptionInfo().contains("checkTestBad3"));
Asserts.assertTrue(e.getExceptionInfo().contains("checkTestBad5"));
@ -53,10 +61,12 @@ public class TestCheckedTests {
Asserts.assertFalse(e.getExceptionInfo().contains("Failed IR Rules"));
}
System.setOut(ps);
try {
TestFramework.run(BadIRCheckedTests.class);
Utils.shouldHaveThrownException();
Utils.shouldHaveThrownException(baos.toString());
} catch (IRViolationException e) {
System.setOut(oldOut);
Asserts.assertTrue(e.getExceptionInfo().contains("Failed IR Rules (3)"));
}
}