Skip to content

Commit 0c7697c

Browse files
committed
Add more logging to tests, fix single test execution
See: #782
1 parent d3ef226 commit 0c7697c

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ModuleOptionsTests.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@
1818
import java.util.List;
1919

2020
import org.eclipse.core.runtime.CoreException;
21+
import org.eclipse.core.runtime.Status;
2122
import org.eclipse.debug.core.ILaunchConfiguration;
2223
import org.eclipse.jdt.core.IClasspathAttribute;
2324
import org.eclipse.jdt.core.IClasspathEntry;
2425
import org.eclipse.jdt.core.IJavaProject;
2526
import org.eclipse.jdt.core.JavaCore;
2627
import org.eclipse.jdt.core.JavaModelException;
2728
import org.eclipse.jdt.debug.tests.AbstractDebugTest;
29+
import org.eclipse.jdt.internal.ui.JavaPlugin;
30+
import org.eclipse.jdt.launching.IVMInstall;
2831
import org.eclipse.jdt.launching.JavaRuntime;
2932

3033
public class ModuleOptionsTests extends AbstractDebugTest {
@@ -112,8 +115,9 @@ private int indexOfJREContainer(IClasspathEntry[] rawClasspath) {
112115
return -1;
113116
}
114117

115-
public void testAddModules1() throws JavaModelException {
118+
public void testAddModules1() throws Exception {
116119
IJavaProject javaProject = getProjectContext();
120+
logVMInstall(javaProject);
117121
List<String> defaultModules = getDefaultModules(javaProject);
118122
defaultModules.add("jdk.crypto.cryptoki"); // requires jdk.crypto.ec up to Java 21
119123
try {
@@ -135,8 +139,9 @@ public void testAddModules1() throws JavaModelException {
135139
}
136140
}
137141

138-
public void testLimitModules_release9() throws CoreException {
142+
public void testLimitModules_release9() throws Exception {
139143
IJavaProject javaProject = getProjectContext();
144+
logVMInstall(javaProject);
140145
try {
141146
javaProject.setOption(JavaCore.COMPILER_RELEASE, JavaCore.ENABLED);
142147
List<String> defaultModules = getDefaultModules(javaProject);
@@ -153,7 +158,7 @@ public void testLimitModules_release9() throws CoreException {
153158
+ "jdk.net," //
154159
+ "jdk.nio.mapmode," //
155160
// + "jdk.packager,jdk.packager.services,jdk.plugin.dom,"
156-
// + "jdk.scripting.nashorn,"
161+
// + "jdk.scripting.nashorn,"
157162
+ "jdk.sctp,"
158163
+ "jdk.security.auth,jdk.security.jgss,jdk.unsupported," //
159164
+ "jdk.unsupported.desktop,jdk.xml.dom";
@@ -178,8 +183,10 @@ public void testLimitModules_release9() throws CoreException {
178183
}
179184
}
180185

181-
public void testLimitModules1() throws JavaModelException {
186+
public void testLimitModules1() throws Exception {
182187
IJavaProject javaProject = getProjectContext();
188+
javaProject.setOption(JavaCore.COMPILER_RELEASE, JavaCore.DISABLED);
189+
logVMInstall(javaProject);
183190
List<String> defaultModules = getDefaultModules(javaProject);
184191
String expectedModules;
185192
String moduleList = String.join(",", defaultModules);
@@ -218,4 +225,10 @@ public void testLimitModules1() throws JavaModelException {
218225
removeClasspathAttributesFromSystemLibrary(javaProject);
219226
}
220227
}
228+
229+
private void logVMInstall(IJavaProject javaProject) throws CoreException {
230+
IVMInstall vmInstall = JavaRuntime.getVMInstall(javaProject);
231+
String msg = getName() + " project VM name: " + vmInstall.getName() + ", location: " + vmInstall.getInstallLocation();
232+
JavaPlugin.log(Status.info(msg));
233+
}
221234
}

org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/DetectVMInstallationsJob.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.eclipse.core.runtime.preferences.DefaultScope;
3434
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
3535
import org.eclipse.core.runtime.preferences.InstanceScope;
36+
import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin;
3637
import org.eclipse.jdt.launching.IVMInstall;
3738
import org.eclipse.jdt.launching.IVMInstall2;
3839
import org.eclipse.jdt.launching.IVMInstallType;
@@ -320,16 +321,24 @@ public static void initialize() {
320321
// early exit no need to read preferences or check env variable!
321322
return;
322323
}
323-
if (System.getProperty(PROPERTY_DETECT_VM_INSTALLATIONS_JOB_DISABLED) == null && Boolean.parseBoolean(System.getenv(ENV_CI))) {
324-
// exit because no explicit value for the property was given and we are running in a CI environment
325-
return;
324+
boolean ci = false;
325+
if (System.getProperty(PROPERTY_DETECT_VM_INSTALLATIONS_JOB_DISABLED) == null) {
326+
ci = Boolean.parseBoolean(System.getenv(ENV_CI));
327+
if (ci) {
328+
// exit because no explicit value for the property was given and we are running in a CI environment
329+
return;
330+
}
326331
}
327332
// finally look what is defined in the preferences
328333
IEclipsePreferences instanceNode = InstanceScope.INSTANCE.getNode(LaunchingPlugin.getDefault().getBundle().getSymbolicName());
329334
IEclipsePreferences defaultNode = DefaultScope.INSTANCE.getNode(LaunchingPlugin.getDefault().getBundle().getSymbolicName());
330335
boolean defaultValue = defaultNode.getBoolean(LaunchingPlugin.PREF_DETECT_VMS_AT_STARTUP, true);
331336
if (instanceNode.getBoolean(LaunchingPlugin.PREF_DETECT_VMS_AT_STARTUP, defaultValue)) {
332337
new DetectVMInstallationsJob().schedule();
338+
if (ci) {
339+
// log that this job will run in a CI environment
340+
JDIDebugPlugin.log(Status.info("DetectVMInstallationsJob scheduled")); //$NON-NLS-1$
341+
}
333342
}
334343
}
335344

0 commit comments

Comments
 (0)