GithubHelp home page GithubHelp logo

Comments (6)

jonahgraham avatar jonahgraham commented on July 24, 2024

Thank you for the comprehensive analysis. Can you convert your possible fix into a PR and include a test for it please? I am not sure which tests are most suitable to add this regression to, perhaps org.eclipse.cdt.core.parser.tests.rewrite.astwriter.SourceRewriteTest?

from cdt.

Neuromancer42 avatar Neuromancer42 commented on July 24, 2024

Hi Jonah, I am trying to make this into a PR.

I am not sure if it is an okay place for asking about this, but I am not able to launching any junit tests or applications. I've set up the development workspace, set the target platform and the api baseline, and then imported org.eclipse.cdt.core/org.eclipse.cdt.core.tests and editted some of the code. But then when I trying to run org.eclipse.cdt.core.tests/parser as a junit plug-in tests, it always complains in the console like following.

Console output
WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign
!SESSION 2022-11-05 21:38:52.975 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.3
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=zh_CN_#Hans
Framework arguments:  -version 3 -port 51529 -testLoaderClass org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader -loaderpluginname org.eclipse.jdt.junit5.runtime -packageNameFile /var/folders/j1/5fvny3mj3vjdlm8js3kr_vww0000gn/T/packageNames14300840597596892197.txt -application org.eclipse.pde.junit.runtime.uitestapplication -product org.eclipse.sdk.ide -testpluginname org.eclipse.cdt.core.tests
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -consoleLog -consolelog -version 3 -port 51529 -testLoaderClass org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader -loaderpluginname org.eclipse.jdt.junit5.runtime -packageNameFile /var/folders/j1/5fvny3mj3vjdlm8js3kr_vww0000gn/T/packageNames14300840597596892197.txt -application org.eclipse.pde.junit.runtime.uitestapplication -product org.eclipse.sdk.ide -data /Users/neuromancer/Workspace/ws-eclipse/cdt/ws/../junit-workspace -dev file:/Users/neuromancer/Workspace/ws-eclipse/cdt/ws/.metadata/.plugins/org.eclipse.pde.core/pde-junit/dev.properties -os macosx -ws cocoa -arch x86_64 -consoleLog -consolelog -testpluginname org.eclipse.cdt.core.tests

!ENTRY org.eclipse.cdt.debug.core 4 0 2022-11-05 21:38:54.342
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.cdt.debug.core [117]
  Unresolved requirement: Require-Bundle: org.eclipse.cdt.core; bundle-version="[7.0.0,8.0.0)"

	at org.eclipse.osgi.container.Module.start(Module.java:463)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1852)
	at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1845)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1786)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1750)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1672)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)

from cdt.

jonahgraham avatar jonahgraham commented on July 24, 2024

On first glance it looks like you have a mix of CDT versions - this is probably a side effect of CDT preparing for the new major release.

CDT has itself in its target platform:

<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/tools/cdt/releases/latest"/>
<!-- We explicitly have CDT in target platform so that developers can develop org.eclipse.cdt.core/ui without requiring all the projects from CDT in their workspace. -->
<unit id="org.eclipse.cdt.feature.group" version="0.0.0"/>
</location>

But that assumes that the latest release is compatible with the current source, which in this case it isn't as cdt.core has a major version bump recently (#116):

Bundle-Version: 8.0.0.qualifier

Therefore you need to import the source versions from the main repo for some of the other bundles that are needed.

from cdt.

Neuromancer42 avatar Neuromancer42 commented on July 24, 2024

Hi Jonah. I've solved the version problem by importing whole cdt repo.

But I am sorry to disturb you again, that a new problem arises. When I run the tests in org.eclipse.cdt.core.tests/parser, all tests in org.eclispe.cdt.core.parser.tests.rewrite report the following error:

Full stack trace
java.lang.NullPointerException: Cannot invoke "org.eclipse.core.runtime.IPath.makeRelativeTo(org.eclipse.core.runtime.IPath)" because "path" is null
	at org.eclipse.cdt.core.tests.BaseTestFramework.importFile(BaseTestFramework.java:131)
	at org.eclipse.cdt.core.parser.tests.rewrite.RewriteBaseTest.setUp(RewriteBaseTest.java:60)
	at org.eclipse.cdt.core.parser.tests.rewrite.astwriter.ASTWriterTester.setUp(ASTWriterTester.java:61)
	at junit.framework.TestCase.runBare(TestCase.java:140)
	at org.eclipse.cdt.core.testplugin.util.BaseTestCase.runBare(BaseTestCase.java:182)
	at junit.framework.TestResult$1.protect(TestResult.java:122)
	at junit.framework.TestResult.runProtected(TestResult.java:142)
	at junit.framework.TestResult.run(TestResult.java:125)
	at junit.framework.TestCase.run(TestCase.java:130)
	at org.eclipse.cdt.core.testplugin.util.BaseTestCase.run(BaseTestCase.java:191)
	at junit.framework.TestSuite.runTest(TestSuite.java:241)
	at junit.framework.TestSuite.run(TestSuite.java:236)
	at junit.framework.TestSuite.runTest(TestSuite.java:241)
	at junit.framework.TestSuite.run(TestSuite.java:236)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
	at org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:42)
	at org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:80)
	at org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:72)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:95)
	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:91)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:60)
	at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:98)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:74)
	at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness.lambda$0(PlatformUITestHarness.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Testable.lambda$1(E4Testable.java:127)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4318)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3941)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.runApp(NonUIThreadTestApplication.java:53)
	at org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:47)
	at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:48)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1440)

from cdt.

jonahgraham avatar jonahgraham commented on July 24, 2024

Short answer is you need to run the tests as "JUnit Plug-in tests" because you need all the bundles to start in the OSGi.

I have been trying to improve the CDT tests in the last couple of weeks. I have documented this in my fork which will be merged soon into TESTING on the main branch as part of #120.

from cdt.

jonahgraham avatar jonahgraham commented on July 24, 2024

Thanks @Neuromancer42 for the fix in #145 - it fixes the main issue you have raised.

Note that there are a couple of related issues in the code that may still trip you up and I would be happy to review changes on them.

  1. The code seem to always change __asm__ to asm when rewriting. This means when using GCC options like -ansi you go from a compiling code using __asm__ to non compiling code with warning: implicit declaration of function ‘asm’

  2. The new code adds spaces after the open and before the closed bracket, but it also adds it around the comma. So this code:

	asm("bswap %0" : "+r" (_data, _data2));

when rewritten becomes:

	asm("bswap %0" : "+r" ( _data , _data2 ));

That isn't terribly bad, but since the formatter doesn't format asm statements fully it does change the code.

from cdt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.