eclipse-pde / eclipse.pde

Eclipse Public License 2.0
24 stars 58 forks source link

Unable to run plug-in tests after opening Plugins tab #1250

Closed iloveeclipse closed 2 months ago

iloveeclipse commented 2 months ago

I'm unable to run successfully plugins tests anymore after opening launch config dialog / Plugins tab. If I run a test for the first time (without opening dialog) it works, but once the config is opened, it's over, it crashes with obscure errors.

Caused by: java.lang.IllegalStateException: The bundle activator for the org.eclipse.equinox.common bundle is not available.
    at org.eclipse.core.internal.runtime.DataArea.assertLocationInitialized(DataArea.java:52)
    at org.eclipse.core.internal.runtime.DataArea.getStateLocation(DataArea.java:141)
    at org.eclipse.core.internal.runtime.InternalPlatform.getStateLocation(InternalPlatform.java:544)
    at org.eclipse.core.runtime.Plugin.getStateLocation(Plugin.java:275)
    at org.eclipse.core.internal.resources.LocalMetaArea.<init>(LocalMetaArea.java:75)
    at org.eclipse.core.internal.resources.Workspace.<init>(Workspace.java:370)
    at org.eclipse.core.resources.ResourcesPlugin$WorkspaceInitCustomizer.addingService(ResourcesPlugin.java:568)
    at org.eclipse.core.resources.ResourcesPlugin$WorkspaceInitCustomizer.addingService(ResourcesPlugin.java:1)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:947)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
    at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:257)
    at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:184)
    at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:324)
    at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:267)
    at org.eclipse.core.resources.ResourcesPlugin.start(ResourcesPlugin.java:545)
    at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:833)
    at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:1)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:571)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:825)
    ... 61 more

I see that the launch config gets these (highly unexpected) lines added:

    <booleanAttribute key="default_auto_start" value="true"/>
    <intAttribute key="default_start_level" value="1"/>

Steps to reproduce:

Save this file to the org.eclipse.core.tests.resources/URIUtilTest.launch file

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
    <booleanAttribute key="append.args" value="true"/>
    <stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
    <booleanAttribute key="askclear" value="false"/>
    <booleanAttribute key="automaticAdd" value="true"/>
    <booleanAttribute key="automaticValidate" value="false"/>
    <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="true"/>
    <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.core.tests.resources/src/org/eclipse/core/tests/filesystem/URIUtilTest.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.junit4"/>
    <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.core.tests.filesystem.URIUtilTest"/>
    <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.core.tests.resources"/>
    <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
    <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.8 -Xms256m -Xmx4G -Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true"/>
    <stringAttribute key="pde.version" value="3.3"/>
    <stringAttribute key="product" value="org.eclipse.sdk.ide"/>
    <booleanAttribute key="run_in_ui_thread" value="true"/>
    <booleanAttribute key="tracing" value="false"/>
    <booleanAttribute key="useCustomFeatures" value="false"/>
    <booleanAttribute key="useDefaultConfig" value="true"/>
    <booleanAttribute key="useDefaultConfigArea" value="false"/>
    <booleanAttribute key="useProduct" value="false"/>
</launchConfiguration>

Note, URIUtilTest is just an example, it affects actually any plugin test

Must be regression from https://github.com/eclipse-pde/eclipse.pde/pull/1233

iloveeclipse commented 2 months ago

@fedejeanne : please check.

mickaelistria commented 2 months ago

I also reproduced the issue, changing default start level to 1 and setting auto-start to false allows to get things working.

iloveeclipse commented 2 months ago

@fedejeanne : I plan to merge https://github.com/eclipse-pde/eclipse.pde/pull/1251 for the next IBuild (will be 4.32 M2) tomorrow, assuming there will be no fix available before 23:00 CET today.

fedejeanne commented 2 months ago

@fedejeanne : I plan to merge #1251 for the next IBuild (will be 4.32 M2) tomorrow, assuming there will be no fix available before 23:00 CET today.

Thank you for the heads up and for looking into it! I was just looking into it but I couldn't reproduce the error. I'll perform the setup tasks and try again later (I need to leave the office in 2 minutes).

fedejeanne commented 2 months ago

Quick update: I'm on

Version: 2024-06 (4.32) Build id: I20240423-1800

And I can't reproduce the error. The .launch file remains unchanged after I run it and the button is not initially disabled in the dialog. I had to change the .launch file to use Java 17 manually though. If I left it with Java 21 then I saw the error in the run config, I changed in the dialog to use Java 17 and then the 2 lines were also added. But even though, the tests ran.

iloveeclipse commented 2 months ago

Maybe this is something Linux specific, I don't know, I haven't debugged this. I see the problem disappears with https://github.com/eclipse-pde/eclipse.pde/pull/1251.

You can try with any launch config that is created automatically. Compare the file content after creation and after opening the launch configurations dialog. You actually should see it immediately by the wrong defaults set in the dialog. On 4.30 it looks like: image On latest master it looks like: image

fedejeanne commented 2 months ago

@iloveeclipse I'll try to reproduce it and fix it on my Linux machine later today then. Thanks for the details!

fedejeanne commented 2 months ago

Another quick update: I was able to reproduce the error on Windows. I was blinded by the fact that the tests ran fine, but the console was showing errors and the Default start level and Default Auto-Start are definitely being set to 1 and true.

I'm looking into it right now.

fedejeanne commented 2 months ago

@iloveeclipse I proposed a fix --> https://github.com/eclipse-pde/eclipse.pde/pull/1252

I tested the same scenarios that I tested in #1233 (see its section How to test) and I additionally made sure that the default values for the configuration that reaches the Plugins tab is now overwritten. More details in the (edited) description of the PR.

Hope this helps!

iloveeclipse commented 2 months ago

Verified works again with I20240424-1800