mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8293000: Review running times of jshell regression tests
Reviewed-by: darcy
This commit is contained in:
parent
6d83482a6b
commit
b4e1e416da
@ -38,12 +38,19 @@ import javax.tools.Diagnostic;
|
||||
import jdk.jshell.SourceCodeAnalysis;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import jdk.jshell.TypeDeclSnippet;
|
||||
import static jdk.jshell.Snippet.Status.OVERWRITTEN;
|
||||
import static jdk.jshell.Snippet.Status.VALID;
|
||||
|
||||
public class ClassMembersTest extends KullaTesting {
|
||||
|
||||
@BeforeMethod
|
||||
@Override
|
||||
public void setUp() {
|
||||
setUp(builder -> builder.executionEngine("local"));
|
||||
}
|
||||
|
||||
@Test(dataProvider = "memberTestCase")
|
||||
public void memberTest(AccessModifier accessModifier, CodeChunk codeChunk, Static isStaticMember, Static isStaticReference) {
|
||||
MemberTestCase testCase = new MemberTestCase(accessModifier, codeChunk, isStaticMember, isStaticReference);
|
||||
|
||||
@ -723,7 +723,7 @@ public class CompletionSuggestionTest extends KullaTesting {
|
||||
|
||||
@BeforeMethod
|
||||
public void setUp() {
|
||||
super.setUp();
|
||||
setUp(builder -> builder.executionEngine("local"));
|
||||
|
||||
Path srcZip = Paths.get("src.zip");
|
||||
|
||||
|
||||
@ -50,22 +50,30 @@ public class ExecutionControlTestBase extends KullaTesting {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
variables();
|
||||
testImportOnDemand();
|
||||
classesDeclaration();
|
||||
interfaceTest();
|
||||
methodOverload();
|
||||
testExprSanity();
|
||||
}
|
||||
|
||||
public void classesDeclaration() {
|
||||
assertEval("interface A { }");
|
||||
assertEval("class B implements A { }");
|
||||
assertEval("interface C extends A { }");
|
||||
assertEval("interface AA { }");
|
||||
assertEval("class BB implements AA { }");
|
||||
assertEval("interface C extends AA { }");
|
||||
assertEval("enum D implements C { }");
|
||||
assertEval("@interface E { }");
|
||||
assertClasses(
|
||||
clazz(KullaTesting.ClassType.INTERFACE, "A"),
|
||||
clazz(KullaTesting.ClassType.CLASS, "B"),
|
||||
clazz(KullaTesting.ClassType.INTERFACE, "AA"),
|
||||
clazz(KullaTesting.ClassType.CLASS, "BB"),
|
||||
clazz(KullaTesting.ClassType.INTERFACE, "C"),
|
||||
clazz(KullaTesting.ClassType.ENUM, "D"),
|
||||
clazz(KullaTesting.ClassType.ANNOTATION, "E"));
|
||||
assertActiveKeys();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void interfaceTest() {
|
||||
String interfaceSource
|
||||
= "interface A {\n"
|
||||
@ -93,7 +101,6 @@ public class ExecutionControlTestBase extends KullaTesting {
|
||||
assertEval("new B.Inner2();");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void variables() {
|
||||
VarSnippet snx = varKey(assertEval("int x = 10;"));
|
||||
VarSnippet sny = varKey(assertEval("String y = \"hi\";"));
|
||||
@ -105,7 +112,6 @@ public class ExecutionControlTestBase extends KullaTesting {
|
||||
assertActiveKeys();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void methodOverload() {
|
||||
assertEval("int m() { return 1; }");
|
||||
assertEval("int m(int x) { return 2; }");
|
||||
@ -130,15 +136,13 @@ public class ExecutionControlTestBase extends KullaTesting {
|
||||
assertActiveKeys();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExprSanity() {
|
||||
assertEval("int x = 3;", "3");
|
||||
assertEval("int y = 4;", "4");
|
||||
assertEval("x + y;", "7");
|
||||
assertEval("int i = 3;", "3");
|
||||
assertEval("int j = 4;", "4");
|
||||
assertEval("i + j;", "7");
|
||||
assertActiveKeys();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImportOnDemand() {
|
||||
assertImportKeyMatch("import java.util.*;", "java.util.*", TYPE_IMPORT_ON_DEMAND_SUBKIND, added(VALID));
|
||||
assertEval("List<Integer> list = new ArrayList<>();");
|
||||
|
||||
@ -44,10 +44,17 @@ import static org.testng.Assert.assertTrue;
|
||||
import static jdk.jshell.Snippet.Status.OVERWRITTEN;
|
||||
import static jdk.jshell.Snippet.SubKind.TEMP_VAR_EXPRESSION_SUBKIND;
|
||||
import static jdk.jshell.Snippet.Status.VALID;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
|
||||
@Test
|
||||
public class SimpleRegressionTest extends KullaTesting {
|
||||
|
||||
@BeforeMethod
|
||||
@Override
|
||||
public void setUp() {
|
||||
setUp(builder -> builder.executionEngine("local"));
|
||||
}
|
||||
|
||||
public void testSnippetMemberAssignment() {
|
||||
assertEval("class C { int y; }");
|
||||
assertEval("C c = new C();");
|
||||
|
||||
@ -155,11 +155,6 @@ public class ToolBasicTest extends ReplToolTesting {
|
||||
out = new PrintWriter(writer);
|
||||
setCommandInput(cmd + "\n");
|
||||
t = new Thread(() -> {
|
||||
try {
|
||||
// no chance to know whether cmd is being evaluated
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
int i = 1;
|
||||
int n = 30;
|
||||
synchronized (lock) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user