Skip to content

Commit 9719b95

Browse files
author
Amos Shi
committed
8314614: jdk/jshell/ImportTest.java failed with "InternalError: Failed remote listen"
8312140: jdk/jshell tests failed with JDI socket timeouts Backport-of: 14193a049ebcbd3639962729c631293b8d3a9114
1 parent 81837ac commit 9719b95

15 files changed

+88
-40
lines changed

test/langtools/jdk/jshell/AnalyzeSnippetTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public void setUp() {
6464
state = JShell.builder()
6565
.out(new PrintStream(new ByteArrayOutputStream()))
6666
.err(new PrintStream(new ByteArrayOutputStream()))
67+
.executionEngine(Presets.TEST_DEFAULT_EXECUTION)
6768
.build();
6869
sca = state.sourceCodeAnalysis();
6970
}

test/langtools/jdk/jshell/CustomInputToolBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ private void doTest(boolean interactiveTerminal, String code, String... expected
9090
.interactiveTerminal(interactiveTerminal)
9191
.promptCapture(true)
9292
.persistence(new HashMap<>())
93-
.start("--no-startup");
93+
.start("--no-startup",
94+
"--execution", Presets.TEST_DEFAULT_EXECUTION);
9495

9596
String actual = new String(out.toByteArray());
9697
List<String> actualLines = Arrays.asList(actual.split("\\R"));

test/langtools/jdk/jshell/ExecutionControlTestBase.java

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,28 +25,14 @@
2525

2626
import org.testng.annotations.Test;
2727
import jdk.jshell.VarSnippet;
28-
import java.net.InetAddress;
2928

3029
import static jdk.jshell.Snippet.Status.VALID;
3130
import static jdk.jshell.Snippet.SubKind.*;
3231

3332
public class ExecutionControlTestBase extends KullaTesting {
3433

35-
String standardListenSpec() {
36-
String loopback = InetAddress.getLoopbackAddress().getHostAddress();
37-
return "jdi:hostname(" + loopback + ")";
38-
}
39-
40-
String standardLaunchSpec() {
41-
return "jdi:launch(true)";
42-
}
43-
44-
String standardJdiSpec() {
45-
return "jdi";
46-
}
47-
48-
String standardSpecs() {
49-
return "5(" + standardListenSpec() + "), 6(" + standardLaunchSpec() + "), 7(" + standardJdiSpec() + ")";
34+
String alwaysPassingSpec() {
35+
return "5(local)";
5036
}
5137

5238
@Test

test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -129,9 +129,7 @@ public void setUp() {
129129
Map<String, String> pm = provider.defaultParameters();
130130
pm.put("0", "alwaysFailing");
131131
pm.put("1", "alwaysFailing");
132-
pm.put("2", standardListenSpec());
133-
pm.put("3", standardLaunchSpec());
134-
pm.put("4", standardJdiSpec());
132+
pm.put("2", "local");
135133
setUp(builder -> builder.executionEngine(provider, pm));
136134
}
137135

@@ -159,9 +157,7 @@ public void variables() {
159157
assertTrue(log.contains("This operation intentionally broken"), log);
160158
log = logged.get(Level.FINEST).get(0);
161159
assertTrue(
162-
log.contains("Success failover -- 2 = " + standardListenSpec())
163-
|| log.contains("Success failover -- 3 = " + standardLaunchSpec())
164-
|| log.contains("Success failover -- 4 = " + standardJdiSpec()),
160+
log.contains("Success failover -- 2 = local"),
165161
log);
166162
}
167163
}

test/langtools/jdk/jshell/FailOverExecutionControlDyingLaunchTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,6 @@ public class FailOverExecutionControlDyingLaunchTest extends ExecutionControlTes
4343
public void setUp() {
4444
setUp(builder -> builder.executionEngine(
4545
"failover:0(jdi:remoteAgent(DyingRemoteAgent),launch(true)), "
46-
+ standardSpecs()));
46+
+ alwaysPassingSpec()));
4747
}
4848
}

test/langtools/jdk/jshell/FailOverExecutionControlHangingLaunchTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,6 @@ public class FailOverExecutionControlHangingLaunchTest extends ExecutionControlT
4242
public void setUp() {
4343
setUp(builder -> builder.executionEngine(
4444
"failover:0(jdi:remoteAgent(HangingRemoteAgent),launch(true)), "
45-
+ standardSpecs()));
45+
+ alwaysPassingSpec()));
4646
}
4747
}

test/langtools/jdk/jshell/FailOverExecutionControlHangingListenTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,6 @@ public void setUp() {
4545
String loopback = InetAddress.getLoopbackAddress().getHostAddress();
4646
setUp(builder -> builder.executionEngine(
4747
"failover:0(jdi:remoteAgent(HangingRemoteAgent),hostname(" + loopback + ")),"
48-
+ standardSpecs()));
48+
+ alwaysPassingSpec()));
4949
}
5050
}

test/langtools/jdk/jshell/FailOverExecutionControlTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@ public class FailOverExecutionControlTest extends ExecutionControlTestBase {
4141
@Override
4242
public void setUp() {
4343
setUp(builder -> builder.executionEngine("failover:0(expectedFailureNonExistent1), 1(expectedFailureNonExistent2), "
44-
+ standardSpecs()));
44+
+ alwaysPassingSpec()));
4545
}
4646

4747
}

test/langtools/jdk/jshell/IdGeneratorTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public JShell.Builder getBuilder() {
5353
return JShell.builder()
5454
.in(inStream)
5555
.out(new PrintStream(outStream))
56-
.err(new PrintStream(errStream));
56+
.err(new PrintStream(errStream))
57+
.executionEngine(Presets.TEST_DEFAULT_EXECUTION);
5758
}
5859

5960
public void testTempNameGenerator() {

test/langtools/jdk/jshell/KullaTesting.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ public class KullaTesting {
100100
private Set<Snippet> allSnippets = new LinkedHashSet<>();
101101

102102
static {
103-
JShell js = JShell.create();
103+
JShell js = JShell.builder()
104+
.executionEngine(Presets.TEST_DEFAULT_EXECUTION)
105+
.build();
104106
MAIN_SNIPPET = js.eval("MAIN_SNIPPET").get(0).snippet();
105107
js.close();
106108
assertTrue(MAIN_SNIPPET != null, "Bad MAIN_SNIPPET set-up -- must not be null");
@@ -192,7 +194,8 @@ public int read(byte[] b, int off, int len) throws IOException {
192194
JShell.Builder builder = JShell.builder()
193195
.in(in)
194196
.out(new PrintStream(outStream))
195-
.err(new PrintStream(errStream));
197+
.err(new PrintStream(errStream))
198+
.executionEngine(Presets.TEST_DEFAULT_EXECUTION);
196199
bc.accept(builder);
197200
state = builder.build();
198201
allSnippets = new LinkedHashSet<>();

0 commit comments

Comments
 (0)