Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Objectteams » Classpath problems when running OTJ test suite
Classpath problems when running OTJ test suite [message #1847177] Mon, 18 October 2021 09:17 Go to next message
Lars Schütze is currently offline Lars SchützeFriend
Messages: 16
Registered: June 2018
Junior Member
Hi Stephan, hi everyone,

I am trying to execute the OTJ tests with my changes to further explore the implementation of other features. I run AllTests in tests.otjld as JUnit Plugin Tests.

However, I have a problem with class discovery (ClassNotFoundException thrown from BundleLoader.findClass) which often points to problems with visibility of bundles and packages in OSGi.

Caused by: java.lang.ClassNotFoundException: org.eclipse.objectteams.otredyn.runtime.dynamic.linker.TeamsAndCallinIdsBootstrap cannot be found by org.eclipse.ui.workbench_3.119.0.v20200521-1247
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:516)


My code changes directly happened in CreateCallAllBindingsCallInOrgMethod#generateInvocation of OTREDyn where I construct an invokedynamic callsite with ASM.

private static final Handle teamsAndIdsBootstrapHandle = new Handle(Opcodes.H_INVOKESTATIC,
			ClassNames.TEAMS_AND_IDS_BOOTSTRAP_SLASH, ConstantMembers.teamsAndCallinIdsBootstrap.getName(),
			ConstantMembers.teamsAndCallinIdsBootstrap.getSignature(), false);


and is put as an invokedynamic with

newInstructions.add(new InvokeDynamicInsnNode("getTeamsAndCallinIds",
				ConstantMembers.getTeamsAndCallinIds.getSignature(), teamsAndIdsBootstrapHandle, joinpointId));
		addLineNumber(newInstructions, SMAPConstants.STEP_OVER_LINENUMBER);


This also works without OSGi when exporting OTJ as JAR files.

So I suspect that either I need to have the OTREDyn packages being imported into base classes (is that done somewhere?) or the ASM library needs to be used differently in OSGi environment?

Do you by chance have an idea? I already looked into the otequinox plugin but could not find something which I would relate to my problems. I also exported the packages I added to otredyn and imported these from otequinox.

Thank you very much!

[Updated on: Mon, 18 October 2021 09:18]

Report message to a moderator

Re: Classpath problems when running OTJ test suite [message #1847210 is a reply to message #1847177] Tue, 19 October 2021 12:33 Go to previous messageGo to next message
Lars Schütze is currently offline Lars SchützeFriend
Messages: 16
Registered: June 2018
Junior Member
It is as always. I went again through the code of OTEquinox and found the place where the runtime package gets dynamically imported in other plugins. I already thought this is the problem that my package is missing.
The code had to be adapted at BaseBundleLoader::addOTREImport#156.

Cheers,
Lars
Re: Classpath problems when running OTJ test suite [message #1847526 is a reply to message #1847177] Sat, 30 October 2021 16:23 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1845
Registered: July 2009
Senior Member
Hi Lars,

somewhat belatedly, let me ask if you succeeded to run the desired tests?

BaseBundleLoadTrigger.addOTREImport(..) indeed is a suitable location for wiring additional runtime packages into base classes -- when running under OT/Equinox.

I just wonder, how OT/Equinox enters the picture for otjld.AllTests: the actual tests are plain OT/J, no OSGi involved. So it appears you are using a modified otredyn already for launching the test plugin? For the software under test the main point for configuration would be AbstractOTJLDTest.getOTVMArgs().

best,
Stephan
Re: Classpath problems when running OTJ test suite [message #1847552 is a reply to message #1847526] Mon, 01 November 2021 10:57 Go to previous messageGo to next message
Lars Schütze is currently offline Lars SchützeFriend
Messages: 16
Registered: June 2018
Junior Member
Quote:
let me ask if you succeeded to run the desired tests?

In order to run the tests I already need some features I did not implement, yet. So I am implementing these features now and move forward step by step.

Quote:
I just wonder, how OT/Equinox enters the picture for otjld.AllTests: the actual tests are plain OT/J, no OSGi involved.

I start the tests with Run As -> JUnit Plugin Tests. Otherwise, how would I be able to get all my changes in the compiler etc. applied? Can I run the tests from the command line with the JARs? That would help me a lot!
Otherwise, as a long term goal, I would like to be able to execute that null-analysis you had implemented with ObjectTeams with my changes and see if there is a speed-up :-)

Quote:
So it appears you are using a modified otredyn already for launching the test plugin?

Yes, I started directly modifying otredyn for my prototype.

[Updated on: Mon, 01 November 2021 15:33]

Report message to a moderator

Re: Classpath problems when running OTJ test suite [message #1847636 is a reply to message #1847552] Tue, 02 November 2021 15:56 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1845
Registered: July 2009
Senior Member
Quote:
I start the tests with Run As -> JUnit Plugin Tests. Otherwise, how would I be able to get all my changes in the compiler etc. applied?


That's perfectly valid. I just figured if your runtime isn't complete yet, you could use the original otredyn to launch the test plug-ins, and only within tests use your variant. That should be possible by tuning your launch configuration such that you consume otequinox and otredyn from the host installation, and only the rest from your workspace (tab Plug-ins). During tests the weaver would still be found in org.eclipse.objectteams.otdt/lib.
Re: Classpath problems when running OTJ test suite [message #1847845 is a reply to message #1847636] Wed, 10 November 2021 09:13 Go to previous messageGo to next message
Lars Schütze is currently offline Lars SchützeFriend
Messages: 16
Registered: June 2018
Junior Member
That sounds interesting at least to try out. If I untick jdt.core, otdt.equinox and otdyn and runtime package from workspace and select the target platform versions the new Eclipse to run the tests starts but hangs when starting the first test. Also where do I have to put the jdt.core compiler to that it then also uses the new one? I am not sure that all changes I did to the code generation are downwards compatible to otdyn.
Re: Classpath problems when running OTJ test suite [message #1847898 is a reply to message #1847845] Thu, 11 November 2021 20:47 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1845
Registered: July 2009
Senior Member
Quote:
...hangs when starting the first test


it would be interesting to know at what point it hangs.

Quote:
Also where do I have to put the jdt.core compiler to that it then also uses the new one?


The launch configuration should select the workspace version so that your tests use the new version for compiling test programs. IOW, only runtime components should be used from the host eclipse.


Alternatively, I believe many tests should run fine even when disabling OT/Equinox in the launch configuration. We have only few tweaks to the test framework, and specifically JdtTestAdaptor might even be obsolete nowadays, which would mean all of plug-in org.eclipse.objectteams.otdt.tests should run fine without OT/Equinox.


HTH
Stephan
Re: Classpath problems when running OTJ test suite [message #1847961 is a reply to message #1847898] Mon, 15 November 2021 11:09 Go to previous messageGo to next message
Lars Schütze is currently offline Lars SchützeFriend
Messages: 16
Registered: June 2018
Junior Member
It seems like it currently hangs in the TestVerifier. After calling ::runTest it calls AbstractOTJLDTest$OTTestVerifier.verifyClass and then AbstractOTJLDTest$OTTestVerifier.launchVerifier where it waits for server.accept(). Looks like it stalls there ...

That is the vm arguments it constructed (I changed it to not use JavacTestOptions.DEFAULT but added some necessary module visibility commands):
[-javaagent:/Users/lschuetze/Development/repos/objectteams-poly/plugins/org.eclipse.objectteams.otdt/lib/otredyn_agent.jar, -Xbootclasspath/a:/Users/lschuetze/Development/repos/objectteams-poly/plugins/org.eclipse.objectteams.otdt/lib/otre_min.jar, -Dot.dump=1, -Dobjectteams.otdre.verify=1, --add-reads, java.base=ALL-UNNAMED, --add-reads, jdk.net=ALL-UNNAMED, --add-opens, java.base/java.lang=ALL-UNNAMED]


I am a little bit concerned about the commas between the --add-opens and the declared modules as they go together.

[Updated on: Mon, 15 November 2021 11:13]

Report message to a moderator

Re: Classpath problems when running OTJ test suite [message #1848030 is a reply to message #1847961] Wed, 17 November 2021 17:40 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1845
Registered: July 2009
Senior Member
Quote:
I am a little bit concerned about the commas between the --add-opens and the declared modules as they go together.


Commas are OK, this is just the rendering of a string array, where arguments have been split at what would be whitespace in a regular command line.

Quote:
AbstractOTJLDTest$OTTestVerifier.launchVerifier where it waits for server.accept(). Looks like it stalls there ...


This is where it get's tricky to debug, since we are (hopefully) launching a second vm for executing a test program. Some ideas for debugging:

  • when it hangs, do you see a new JVM process at the operating system level? If so, can you use jstack to check what it's doing, when it hangs?
  • the remote end executes a class generated on the fly from TestVerifier.getVerifyTestsCode(). So if that part doesn't behave, that's where you may want to add some logging, but beware that out and err are redirected: instead of printing on the console any logging will be received in AbstractRegressionTest.runTest(), but then it will be reported as unexpected program output :)

[Updated on: Wed, 17 November 2021 17:50]

Report message to a moderator

Re: Classpath problems when running OTJ test suite [message #1848047 is a reply to message #1848030] Thu, 18 November 2021 12:55 Go to previous messageGo to next message
Lars Schütze is currently offline Lars SchützeFriend
Messages: 16
Registered: June 2018
Junior Member
Okay, So I do not get to the point where I could attach to the launched VM. In LocalVMLauncher::execCommandLine() it executed the generated command line:
[/Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk/Contents/Home/bin/java, -verify, -javaagent:/Users/lschuetze/Development/repos/objectteams-poly/plugins/org.eclipse.objectteams.otdt/lib/otredyn_agent.jar, -Xbootclasspath/a:/Users/lschuetze/Development/repos/objectteams-poly/plugins/org.eclipse.objectteams.otdt/lib/otre_min.jar, -Dot.dump=1, -Dobjectteams.otdre.verify=1, --add-reads, java.base=ALL-UNNAMED, --add-reads, jdk.net=ALL-UNNAMED, --add-opens, java.base/java.lang=ALL-UNNAMED, --add-reads, jdk.dynalink=ALL-UNNAMED, --add-reads, jdk.localedata=ALL-UNNAMED, -Xverify:all, -XX:+UnlockExperimentalVMOptions, -Xbootclasspath/a:/Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk/Contents/Home/jre/lib/rt.jar:, -classpath, /Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk/Contents/Home/lib/jrt-fs.jar:/private/var/folders/28/fqt91mbn0rs_zf8dxkqw4pbr0000gn/T/comptest/run.1637239763023/regression:/Users/lschuetze/.p2/pool/plugins/org.eclipse.objectteams.runtime_2.8.1.202006091155.jar:/Users/lschuetze/.p2/pool/plugins/org.eclipse.objectteams.otredyn_1.4.1.202006091155.jar:/Users/lschuetze/Development/committers-2020-06/.metadata/.plugins/org.eclipse.pde.core/pde-junit/org.eclipse.osgi/523/0/.cp/:/Users/lschuetze/Development/committers-2020-06/.metadata/.plugins/org.eclipse.pde.core/pde-junit/org.eclipse.osgi/528/0/.cp/:/Users/lschuetze/Development/committers-2020-06/.metadata/.plugins/org.eclipse.pde.core/pde-junit/org.eclipse.osgi/526/0/.cp/:/Users/lschuetze/Development/committers-2020-06/.metadata/.plugins/org.eclipse.pde.core/pde-junit/org.eclipse.osgi/530/0/.cp/:/Users/lschuetze/Development/committers-2020-06/.metadata/.plugins/org.eclipse.pde.core/pde-junit/org.eclipse.osgi/525/0/.cp/:/private/var/folders/28/fqt91mbn0rs_zf8dxkqw4pbr0000gn/T/comptest/run.1637239763023/verifier:, org.eclipse.jdt.core.tests.util.VerifyTests, 52362]


It creates a process which immediately returns with error code 1.
Process[pid=44243, exitValue=1]


As you can see from the generated command line I had to programmatically add my extra VM Arguments (i.e., dynalink) that I put into the run configuration inside Eclipse because they had not been taken up. I added them to AbstractOTJLDTest$OTTestVerifier::getOTVMArgs() by hand.

The only thing that I see is that the generated otredyn.jar is not taken up from
org.eclipse.objectteams.otdt/lib/otredyn.jar
but from the host Eclipse
 /Users/lschuetze/.p2/pool/plugins/org.eclipse.objectteams.otredyn_1.4.1.202006091155.jar


And then it tries to connect to that process which leads to the deadlock.

Thanks for all your help so far!

[Updated on: Thu, 18 November 2021 13:00]

Report message to a moderator

Re: Classpath problems when running OTJ test suite [message #1848130 is a reply to message #1848047] Mon, 22 November 2021 09:24 Go to previous messageGo to next message
Lars Schütze is currently offline Lars SchützeFriend
Messages: 16
Registered: June 2018
Junior Member
Oh man. Sometimes it's just the person in front of the computer :-)

I was joining the string given to the launcher and it complained about the agent not being named otredyn_agent.jar. It was named otre_agend.jar, too.
Now I can launch the tests. So, I can move forward. Thanks anyway!!!
Re: Classpath problems when running OTJ test suite [message #1849099 is a reply to message #1847177] Tue, 04 January 2022 06:50 Go to previous messageGo to next message
Armen Edvard is currently offline Armen EdvardFriend
Messages: 1
Registered: January 2022
Junior Member
TestNG jar, jar of collected test case train, and other needed jars.
testng.xml points to applicable class in the scale.
Testing does not run rather it throws
( TestNG) ( ERROR) Can not find a class in classpath ( name of test case train)
I encountered the same issue ahead and I just added it.

In classpath and it answered the problem. But this time it didn't feel to break it. Any workarounds? Thanks in advance.

For More Information visit; Salesforce classes in Pune by Sevenmentor
Re: Classpath problems when running OTJ test suite [message #1849112 is a reply to message #1849099] Tue, 04 January 2022 11:59 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1845
Registered: July 2009
Senior Member
Armen Edvard,

I don't think your question is really connected to this thread. There's a myriad of potential reasons why you may be seeing classpath problems.

I recommend, first you try to identify what is the component you are having problems with. I don't see indications that Object Teams (this forum) is involved. Is the problem specific to TestNG? Do you use a TestNG Eclipse Plug-in? Are you having issues with JDT? If OSGi is involved, perhaps you are struggling with PDE? If you don't know better, you could try the newcomers forum.

Once you found a suitable forum, please really try to explain (a) what you are trying to do and (b) what exactly is the problem you are seeing. Too much is unclear in your post for me to even start asking questions, sorry.
Previous Topic:Semantic highlighting for OT/J scoped keywords
Next Topic:Migrating functional OTJ Application to Maven project
Goto Forum:
  


Current Time: Fri Dec 09 19:31:17 GMT 2022

Powered by FUDForum. Page generated in 0.03494 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top