Skip to content

Comments

Limit access to junit platform engines#2071

Merged
iloveeclipse merged 2 commits intoeclipse-pde:masterfrom
laeubi:limit_access_to_services
Oct 30, 2025
Merged

Limit access to junit platform engines#2071
iloveeclipse merged 2 commits intoeclipse-pde:masterfrom
laeubi:limit_access_to_services

Conversation

@laeubi
Copy link
Contributor

@laeubi laeubi commented Oct 28, 2025

Currently the testruntime is exposed to multiple engines and the check for compatibility does not work well in the case of JUnit 5/6 on the classpath.

This now

  • limit the dynamic import to a range of the currently only supported junit 5
  • remove the falsely check for compatible engines
  • enhance the multi-bundle classloader to not expose META-INF/services/* from bundles not strictly classloader compatible for the given service interface

For JUnit 6 we need to revise the whole approach here, this is currently only for getting things back in action.

FYI @HannesWell @iloveeclipse @trancexpress

@eclipse-pde-bot
Copy link
Contributor

eclipse-pde-bot commented Oct 28, 2025

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

ui/org.eclipse.pde.junit.runtime/META-INF/MANIFEST.MF

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From 78bf42a3be625b6fd9f754ffc4f7fa4ba2fef232 Mon Sep 17 00:00:00 2001
From: Eclipse PDE Bot <pde-bot@eclipse.org>
Date: Thu, 30 Oct 2025 18:11:31 +0000
Subject: [PATCH] Version bump(s) for 4.38 stream


diff --git a/ui/org.eclipse.pde.junit.runtime/META-INF/MANIFEST.MF b/ui/org.eclipse.pde.junit.runtime/META-INF/MANIFEST.MF
index 78a8359eed..b32cbe8bf4 100644
--- a/ui/org.eclipse.pde.junit.runtime/META-INF/MANIFEST.MF
+++ b/ui/org.eclipse.pde.junit.runtime/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.pde.junit.runtime; singleton:=true
-Bundle-Version: 3.8.200.qualifier
+Bundle-Version: 3.8.300.qualifier
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
 Require-Bundle: org.eclipse.jdt.junit.runtime;bundle-version="[3.4.0,4.0.0)",
-- 
2.51.0

Further information are available in Common Build Issues - Missing version increments.

@iloveeclipse
Copy link
Member

This is meant to be addition to #2070, not replacement?
Because with this patch only the test case from eclipse-platform/eclipse.platform#2213 still fail.

@laeubi
Copy link
Contributor Author

laeubi commented Oct 28, 2025

This is meant to be addition to #2070, not replacement?

No this should replace the former ... but I have some trouble debugging the code, even though remote debugger port is opened Eclipse does not hold on the breakpoints :-\

Because with this patch only the test case from eclipse-platform/eclipse.platform#2213 still fail.

With the same message or a different one?

@iloveeclipse
Copy link
Member

With the same message or a different one?

Looks like same:

!SESSION 2025-10-28 10:27:38.253 -----------------------------------------------
eclipse.buildId=unknown
java.version=21.0.8
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -version 3 -port 46377 -testLoaderClass org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader -loaderpluginname org.eclipse.jdt.junit5.runtime -classNames org.eclipse.core.tests.internal.preferences.TestBug388004 -application org.eclipse.pde.junit.runtime.coretestapplication -testpluginname org.eclipse.core.tests.runtime
Command-line arguments:  -os linux -ws gtk -arch x86_64 -consoleLog -version 3 -port 46377 -testLoaderClass org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader -loaderpluginname org.eclipse.jdt.junit5.runtime -classNames org.eclipse.core.tests.internal.preferences.TestBug388004 -application org.eclipse.pde.junit.runtime.coretestapplication -data /data/4x_platform_workspace/../junit-workspace -dev file:///data/4x_platform_workspace/.metadata/.plugins/org.eclipse.pde.core/pde-junit/dev.properties -os linux -ws gtk -arch x86_64 -consoleLog -testpluginname org.eclipse.core.tests.runtime

!ENTRY org.eclipse.osgi 4 0 2025-10-28 10:27:39.026
!MESSAGE Application error
!STACK 1
java.util.ServiceConfigurationError: org.junit.platform.engine.TestEngine: org.junit.platform.suite.engine.SuiteTestEngine not a subtype
	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1244)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
	at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
	at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
	at java.base/java.lang.Iterable.forEach(Iterable.java:74)
	at org.junit.platform.launcher.core.LauncherFactory.collectTestEngines(LauncherFactory.java:161)
	at org.junit.platform.launcher.core.LauncherFactory.createDefaultLauncher(LauncherFactory.java:139)
	at org.junit.platform.launcher.core.LauncherFactory.lambda$create$2(LauncherFactory.java:132)
	at org.junit.platform.launcher.core.DefaultLauncherSession.lambda$new$0(DefaultLauncherSession.java:66)
	at org.junit.platform.launcher.core.ClasspathAlignmentCheckingLauncherInterceptor.intercept(ClasspathAlignmentCheckingLauncherInterceptor.java:25)
	at org.junit.platform.launcher.core.DefaultLauncherSession.<init>(DefaultLauncherSession.java:66)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.createSession(SessionPerRequestLauncher.java:78)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.discover(SessionPerRequestLauncher.java:58)
	at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.<init>(JUnit5TestReference.java:47)
	at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.createUnfilteredTest(JUnit5TestLoader.java:88)
	at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.createTest(JUnit5TestLoader.java:69)
	at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.loadTests(JUnit5TestLoader.java:56)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:504)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:748)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:443)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:111)
	at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.start(CoreTestApplication.java:28)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:615)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:563)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1415)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1387)

but I have some trouble debugging the code, even though remote debugger port is opened Eclipse does not hold on the breakpoints :-\

This happens if breakpoint info is misaligned with the code in question (switching from one branch to other changes breakpoint positions that do not match the methods/lines).

@github-actions
Copy link

github-actions bot commented Oct 28, 2025

Test Results

   771 files  ±0     771 suites  ±0   1h 0m 2s ⏱️ -8s
 3 633 tests ±0   3 579 ✅ +1   54 💤 ±0  0 ❌  - 1 
10 833 runs  ±0  10 670 ✅ +1  163 💤 ±0  0 ❌  - 1 

Results for commit c2f01a7. ± Comparison against base commit b6dd59b.

♻️ This comment has been updated with latest results.

@laeubi
Copy link
Contributor Author

laeubi commented Oct 28, 2025

I got it working and see why it has not the desired effect... this needs a bit more sophisticated approach like it did on Tycho...

@laeubi laeubi force-pushed the limit_access_to_services branch from 6ffdf11 to 83f7494 Compare October 28, 2025 13:16
@iloveeclipse
Copy link
Member

Last commit works now, however seem to break some JUnit 4 tests

@laeubi
Copy link
Contributor Author

laeubi commented Oct 28, 2025

Yes I need to dig into a bit more... but I think it goes into right direction.

Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.ui.testing;resolution:=optional
DynamicImport-Package: org.junit.platform.engine
DynamicImport-Package: org.junit.platform.engine;version="[1.14.0,2.0.0)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to admit that I didn't knew that dynamically imported packages can have a version(range) too.
In general I wonder if we should better convert this to an optional package-import?
IIRC dynamic imports still create wires at runtime, but only on demand/dynamically. But as a test-runtime usually doesn't change I'm think if an ordinary (optional) import would be fine.
Rereading my comment from #1047 (comment), I think there was no greater meaning in it.
And we already have an optional requirement on org.eclipse.ui.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference between an optional and a dynamic import is that the optional one is resolved at the time the bundle is resolved, and the dynamic one is resolved at the time you try to access that package (+dynamic supports wildcards)

Comment on lines +21 to +22
* Default implementation used with Java 1.8
* TODO provide MR variant using stack walker, currently blocked by JDT bug ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was about to suggest to use StackWalker. Until I was reminded that this bundle is still at Java-8 and until I read this comment.
Looking forward to see a MR bundle in action. I think this would be a good fit. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, sadly I was hit by this bug now but once this is merged it should work, and would be good if this feature is actually used in platform somewhere, but this is here really not high throughput method I just wanted to make it work first:


import org.osgi.framework.Bundle;

final class SPIMapping {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm so happy that we are way past beyond Java-8 in most bundles nowadays. I was about to suggest to make this a record and again had to remind myself that this bundle is still at Java-8...

@iloveeclipse
Copy link
Member

Last commit works now, however seem to break some JUnit 4 tests

Should JuNit 4 support code use "old" branch? We need to fix "known" Junit 5 test failures ASAP, they block us from further work.

@laeubi
Copy link
Contributor Author

laeubi commented Oct 30, 2025

I'll look into it now, my current asumption is that actually JUnit5 is somehow always included, now I filter the engines correctly JUnit5 is not happy... one might ask if we not simply can drop junit4 provider at all and execute with JUni5 Vintage anyways...

@laeubi
Copy link
Contributor Author

laeubi commented Oct 30, 2025

@akurtakov we do already similar here, the problem is more that if junit4 runtime is selected it complains to not find some JUnit 5 engines... what seems intended ;-)

@laeubi
Copy link
Contributor Author

laeubi commented Oct 30, 2025

At laest when I create a new plain Junit 4 test it works... will check now what the test exactly does here..

@laeubi
Copy link
Contributor Author

laeubi commented Oct 30, 2025

It seems only runType test is affected and all other similar tests succeed here... I compared the test output and didn't found a direct problem... need to investigate further.

@laeubi
Copy link
Contributor Author

laeubi commented Oct 30, 2025

One option of course would be to accept the test failure for now and merge then further investigate on the remaining problems later on. I could until now not reproduce the problem in a "real" launch, need to check what these tests are doing special

@iloveeclipse
Copy link
Member

I could until now not reproduce the problem in a "real" launch

Give me a moment to check.

@iloveeclipse
Copy link
Member

For the record, these two tests are failing:
Test Result (2 failures / -8)
JUnitRuntimeTests org.eclipse.pde.junit.runtime.tests.JUnitExecutionTest.executeType[JUnit4 (JUnitPlatform)]
JUnitRuntimeTests org.eclipse.pde.junit.runtime.tests.JUnitExecutionTest.executeType[JUnit4 (JUnitPlatform) Fragment]

java.lang.AssertionError: test completed with Error
	at org.eclipse.pde.junit.runtime.tests.JUnitExecutionTest.assertSuccessful(JUnitExecutionTest.java:141)
	at org.eclipse.pde.junit.runtime.tests.JUnitExecutionTest.executeType(JUnitExecutionTest.java:105)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.pde.ui.tests.runtime.TestUtils$1.evaluate(TestUtils.java:267)
	Suppressed: java.lang.AssertionError: FailureTrace of TestCase: verification.tests.junit4.platform.Test1.initializationError : Completed - Error:

org.junit.platform.commons.PreconditionViolationException: Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath
	at org.junit.platform.commons.util.Preconditions.condition(Preconditions.java:313)
	at org.junit.platform.launcher.core.DefaultLauncher.<init>(DefaultLauncher.java:59)
	at org.junit.platform.launcher.core.LauncherFactory.createDefaultLauncher(LauncherFactory.java:141)
	at org.junit.platform.launcher.core.LauncherFactory.lambda$create$2(LauncherFactory.java:132)
	at org.junit.platform.launcher.core.DefaultLauncherSession.lambda$new$0(DefaultLauncherSession.java:66)
	at org.junit.platform.launcher.core.ClasspathAlignmentCheckingLauncherInterceptor.intercept(ClasspathAlignmentCheckingLauncherInterceptor.java:25)
	at org.junit.platform.launcher.core.DefaultLauncherSession.<init>(DefaultLauncherSession.java:66)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.createSession(SessionPerRequestLauncher.java:78)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.discover(SessionPerRequestLauncher.java:58)
	at org.junit.platform.runner.JUnitPlatform.generateTestTree(JUnitPlatform.java:159)
	at org.junit.platform.runner.JUnitPlatform.<init>(JUnitPlatform.java:145)
	at org.junit.platform.runner.JUnitPlatform.<init>(JUnitPlatform.java:138)
	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
	at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
	at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
	at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
	at org.junit.internal.requests.ClassRequest.createRunner(ClassRequest.java:28)
	at org.junit.internal.requests.MemoizingRequest.getRunner(MemoizingRequest.java:19)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:90)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:76)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:49)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:504)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:748)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:443)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:110)
	at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.start(CoreTestApplication.java:28)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:615)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:563)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1415)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1387)
java.lang.AssertionError: test completed with Error
	at org.eclipse.pde.junit.runtime.tests.JUnitExecutionTest.assertSuccessful(JUnitExecutionTest.java:141)
	at org.eclipse.pde.junit.runtime.tests.JUnitExecutionTest.executeType(JUnitExecutionTest.java:105)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.pde.ui.tests.runtime.TestUtils$1.evaluate(TestUtils.java:267)
	Suppressed: java.lang.AssertionError: FailureTrace of TestCase: verification.tests.junit4.platform.fragment.Test1.initializationError : Completed - Error:

org.junit.platform.commons.PreconditionViolationException: Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath
	at org.junit.platform.commons.util.Preconditions.condition(Preconditions.java:313)
	at org.junit.platform.launcher.core.DefaultLauncher.<init>(DefaultLauncher.java:59)
	at org.junit.platform.launcher.core.LauncherFactory.createDefaultLauncher(LauncherFactory.java:141)
	at org.junit.platform.launcher.core.LauncherFactory.lambda$create$2(LauncherFactory.java:132)
	at org.junit.platform.launcher.core.DefaultLauncherSession.lambda$new$0(DefaultLauncherSession.java:66)
	at org.junit.platform.launcher.core.ClasspathAlignmentCheckingLauncherInterceptor.intercept(ClasspathAlignmentCheckingLauncherInterceptor.java:25)
	at org.junit.platform.launcher.core.DefaultLauncherSession.<init>(DefaultLauncherSession.java:66)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.createSession(SessionPerRequestLauncher.java:78)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.discover(SessionPerRequestLauncher.java:58)
	at org.junit.platform.runner.JUnitPlatform.generateTestTree(JUnitPlatform.java:159)
	at org.junit.platform.runner.JUnitPlatform.<init>(JUnitPlatform.java:145)
	at org.junit.platform.runner.JUnitPlatform.<init>(JUnitPlatform.java:138)
	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
	at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
	at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
	at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
	at org.junit.internal.requests.ClassRequest.createRunner(ClassRequest.java:28)
	at org.junit.internal.requests.MemoizingRequest.getRunner(MemoizingRequest.java:19)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:90)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:76)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:49)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:504)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:748)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:443)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:110)
	at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.start(CoreTestApplication.java:28)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:615)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:563)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1415)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1387)

@laeubi
Copy link
Contributor Author

laeubi commented Oct 30, 2025

I got it to reproduce the problem, one needs to

  • import org.eclipse.pde.junit.runtime.tests/test-bundles/verification.tests.junit4.platform/src/verification/tests/junit4/platform
  • open Test1 in editor and select the class
  • Then Run As > Junit Plugin Test

Running it as a package, project or single method just works! So it is important to really select the class!

@iloveeclipse
Copy link
Member

I was able to reproduce the test failure just by executing JUnitExecutionTest from IDE (using latest SDK installation as target platform).

@laeubi
Copy link
Contributor Author

laeubi commented Oct 30, 2025

I now found the issue and will investigate how to solve this properly...

Currently the testruntime is exposed to multiple engines and the check
for compatibility does not work well in the case of JUnit 5/6 on the
classpath.

This now
- limit the dynamic import to a range of the currently only supported
junit 5
- remove the falsely check for compatible engines
- Use SPIClassloader to ensure compatible SPI are visible only
- For JUnit 4 find the platform launcher as the SPI check
@laeubi laeubi force-pushed the limit_access_to_services branch from 4a07c3c to d33a411 Compare October 30, 2025 18:03
@laeubi
Copy link
Contributor Author

laeubi commented Oct 30, 2025

It should now work for the specific JUnit4 case as well.

Once things has stabilized and

is merged we can even use MR with a simpler approach for Java 9+ ... I also noticed that org.eclipse.jdt.junit.runtime seem to require Java 11 what makes it unusable for running test with Java 1.8 (what is the minimum baseline for JDT at the moment) but this has to be fixed independently.

@iloveeclipse
Copy link
Member

iloveeclipse commented Oct 30, 2025

There are two other new failures: https://ci.eclipse.org/pde/job/eclipse.pde/job/PR-2071/6/testReport/

Test Result (2 failures / ±0)
AllPDETests AllLauncherTests PluginBasedLaunchTest.testGetMergedBundleMap_automaticAddedWorkspacePlugins_multiVersionPluginDisabledWithoutVersion
AllPDETests AllLauncherTests PluginBasedLaunchTest.testGetMergedBundleMap_automaticAddedWorkspacePlugins_multiVersionPluginDisabledWithSpecificVersion

@iloveeclipse
Copy link
Member

There are two other new failures: https://ci.eclipse.org/pde/job/eclipse.pde/job/PR-2071/6/testReport/

They look like "smaller" problems as broken JUnit4 support.
I honestly would prefer to merge now ans see what happens on next IBuild and fix these two new fails in a separate PR.
WDYT?

@laeubi
Copy link
Contributor Author

laeubi commented Oct 30, 2025 via email

@iloveeclipse
Copy link
Member

OK, let's merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants