-
Notifications
You must be signed in to change notification settings - Fork 123
Description
First issue I've found while looking at eclipse-platform/eclipse.platform.ui#3380 and trying to run org.eclipse.ui.editors.tests.SegmentedModeTest test from IDE.
Precondition: have both Java 17 and 21 installed in IDE (I have much more, but I assume it is enough to have these two).
Import org.eclipse.ui.editors.tests project and all dependent test projects in the workspace, select SegmentedModeTest in the Packages Explorer and say "Debug as -> JUnit Plug-in Test".
The console view shows following printout:
WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector
WARNING: JNI local refs: 698, exceeds capacity: 32
WARNING: JNI local refs: 696, exceeds capacity: 33
WARNING: JNI local refs: 696, exceeds capacity: 33
<title>Incompatible JVM</title>Version 17.0.16 of the JVM is not suitable for this product. Version: 21 or greater is required.
and error log shows
eclipse.buildId=4.38.0.I20251007-1800
java.version=25
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments: -os linux -ws gtk -arch x86_64 -data /data/4x_platform_workspace
org.eclipse.jdt.junit
Error
Wed Oct 08 13:44:22 CEST 2025
No tests found with test runner 'JUnit 5'.
The test bundle requires Java 17 but obviously it depends on the launch argument (added from "Running" target platform eclipse.ini) which says -Dosgi.requiredJavaVersion=21.
The original (badly broken) launch config generated looks like:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
<booleanAttribute key="append.args" value="true"/>
<booleanAttribute key="askclear" value="false"/>
<booleanAttribute key="automaticAdd" value="false"/>
<booleanAttribute key="automaticIncludeRequirements" value="true"/>
<booleanAttribute key="automaticValidate" value="true"/>
<stringAttribute key="bootstrap" value=""/>
<stringAttribute key="checked" value="[NONE]"/>
<booleanAttribute key="clearConfig" value="true"/>
<booleanAttribute key="clearws" value="true"/>
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
<booleanAttribute key="default" value="false"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/SegmentedModeTest.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit5"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ui.editors.tests.SegmentedModeTest"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.ui.editors.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:CompileCommand=quiet -XX:CompileCommand=exclude,org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer::getExtendedRange -Xms256m -Xcheck:jni -Xmx16G -XX:G1PeriodicGCInterval=10000 -XX:G1PeriodicGCSystemLoadThreshold=3.0 -XX:NativeMemoryTracking=summary -XX:TrimNativeHeapInterval=5000 -Dosgi.requiredJavaVersion=21 -Dosgi.dataAreaRequiresExplicitInit=true -Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true -Declipse.log.size.max=20000 -Dorg.eclipse.swt.internal.gtk.noThemingFixes -Dorg.eclipse.swt.internal.enableStrictChecks -Declipse.p2.unsignedPolicy=allow -Dorg.eclipse.equinox.p2.director.checkAuthorities=false -DSWT_GTK_INPUT_HINT_NO_EMOJI=true -Dp2.skipRepositoryProtocolCheck=true -Djava.security.manager=allow --add-modules=ALL-SYSTEM -Dorg.slf4j.simpleLogger.defaultLogLevel=off -Dorg.eclipse.swt.internal.gtk.cssFile=/opt/ate/devtools/bin/theme_patches.css"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
<booleanAttribute key="run_in_ui_thread" value="true"/>
<setAttribute key="selected_workspace_bundles">
<setEntry value="org.eclipse.ui.editors.tests*3.13.1000.qualifier"/>
</setAttribute>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
<booleanAttribute key="useDefaultConfigArea" value="false"/>
<booleanAttribute key="useProduct" value="true"/>
</launchConfiguration>
Now only open "Debug Configurations" dialog (it will by default open with the selected test launch config), and without changing anything, click on "Close" button.
The launch config changes to
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
<booleanAttribute key="append.args" value="true"/>
<booleanAttribute key="askclear" value="false"/>
<booleanAttribute key="automaticAdd" value="false"/>
<booleanAttribute key="automaticIncludeRequirements" value="true"/>
<booleanAttribute key="automaticValidate" value="true"/>
<stringAttribute key="bootstrap" value=""/>
<stringAttribute key="checked" value="[NONE]"/>
<booleanAttribute key="clearConfig" value="true"/>
<booleanAttribute key="clearws" value="true"/>
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
<booleanAttribute key="default" value="false"/>
<setAttribute key="deselected_workspace_bundles"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/SegmentedModeTest.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit5"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ui.editors.tests.SegmentedModeTest"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.ui.editors.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:CompileCommand=quiet -XX:CompileCommand=exclude,org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer::getExtendedRange -Xms256m -Xcheck:jni -Xmx16G -XX:G1PeriodicGCInterval=10000 -XX:G1PeriodicGCSystemLoadThreshold=3.0 -XX:NativeMemoryTracking=summary -XX:TrimNativeHeapInterval=5000 -Dosgi.requiredJavaVersion=21 -Dosgi.dataAreaRequiresExplicitInit=true -Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true -Declipse.log.size.max=20000 -Dorg.eclipse.swt.internal.gtk.noThemingFixes -Dorg.eclipse.swt.internal.enableStrictChecks -Declipse.p2.unsignedPolicy=allow -Dorg.eclipse.equinox.p2.director.checkAuthorities=false -DSWT_GTK_INPUT_HINT_NO_EMOJI=true -Dp2.skipRepositoryProtocolCheck=true -Djava.security.manager=allow --add-modules=ALL-SYSTEM -Dorg.slf4j.simpleLogger.defaultLogLevel=off -Dorg.eclipse.swt.internal.gtk.cssFile=/opt/ate/devtools/bin/theme_patches.css"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
<booleanAttribute key="run_in_ui_thread" value="true"/>
<setAttribute key="selected_target_bundles"/>
<setAttribute key="selected_workspace_bundles">
<setEntry value="org.eclipse.ui.editors.tests@default:default"/>
</setAttribute>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
<booleanAttribute key="useDefaultConfigArea" value="false"/>
<booleanAttribute key="useProduct" value="true"/>
</launchConfiguration>
Interestingly, this part
<setAttribute key="selected_workspace_bundles">
<setEntry value="org.eclipse.ui.editors.tests*3.13.1000.qualifier"/>
</setAttribute>
changes to this:
<setAttribute key="selected_target_bundles"/>
<setAttribute key="selected_workspace_bundles">
<setEntry value="org.eclipse.ui.editors.tests@default:default"/>
</setAttribute>
The another important change now is that JRE_CONTAINER is added and set to Java 21.
The JRE change allows the launch config go one step further.
Now (after closing the dialog and starting again from the menu) we see the SegmentedModeTest properly starting but it doesn't fail as it does on SDK build.
This brings us to the second problem.
The set of plugins selected by the PDE includes everything in my workspace. After playing with the launch config, I know there is some bundle (no idea yet which) that "fixes" the test, so I can't reproduce what SDK tests are doing.
So let try to fix that.
This is how the launch config looks like:
Let "fix" that config by using "Restore defaults" button.
This selects 496 bundles.
Test fails now (OK), but this is obviously way too much (I also see bundles included in the launch config now that have no relationship at all to SDK or UI tests, like Eclemma, Copilot etc).
So let try to fix that.
As a naive user, let click on "Deselect All" to have a "clean" state and after that click on "Select Required".
This selects 151 bundles, which sounds reasonable, but...
The test wil not start anymore, because of
eclipse.buildId=4.38.0.I20251007-1800
java.version=25
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments: -os linux -ws gtk -arch x86_64 -data /data/4x_platform_workspace
org.eclipse.jdt.junit
Error
Wed Oct 08 15:37:46 CEST 2025
No tests found with test runner 'JUnit 5'.
For whatever reason, the actual test bundle is not selected anymore after clicking on "Select Required", so no tests could be found?!?
Finally, after selecting org.eclipse.ui.editors.tests bundle manually in the launch config, clicking once again on "Select Required", PDE selects 159 bundles, the test starts but does not fail...
So I stuck between minimal state of 159 bundles with green test and "full blown" state of 496 bundles with broken test.
This last problem is surely not a PDE problem, as neither "default" nor "minimal required" set of bundles must match what SDK tests are containing.
But here are the PDE (or platform) bugs that must be fixed:
- Starting tests from scratch should produce same launch config as if started from the launch configurations dialog for the first time. So dialog pages do more with launch config as action triggered from the menu.
- If launch requires minimal JRE as 21 via VM attribute
-Dosgi.requiredJavaVersion=21(added by PDE by default), PDE shouldn't select Java 17 just because it is JRE what bundle requires. - "Select Required" button should not deselect actual test bundle that contains the test.
- If nothing is selected, "Select Required" should actually not select anything or select all required bundles including test bundle for the test), but it selects some but not all bundles required by the test bundle with the test, excluding test bundle. I don't see any logic behind.
- "Select Required" naming is also wrong. It doesn't select required bundles for the test bundle, it selects bundles required by already selected bundles, but if nothing is selected, it still does something. Weird. Calling it multiple times after adding something to selection produces different results, so it seem to be some kind of "Add all Required to Selection".
- "Restore Defaults" obviously doesn't restore defaults (as the launch config never goes back to the original state after that), so the button name is also wrong. It restores "default" plugins set (whatever default is?), and this state doesn't match the selection state of the original launch config with a single test bundle selected.