Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to run OSGi TCK #1803

Open
grgrzybek opened this issue Nov 25, 2022 · 7 comments
Open

Attempt to run OSGi TCK #1803

grgrzybek opened this issue Nov 25, 2022 · 7 comments
Assignees
Labels
Milestone

Comments

@grgrzybek
Copy link
Member

grgrzybek commented Nov 25, 2022

Whiteboard (CMPN 8.1) tests: https://github.com/osgi/osgi/tree/main/org.osgi.test.cases.servlet
Official test project: https://github.com/osgi/osgi-test
Helper library: https://github.com/laeubisoft/osgi-test-framework

@grgrzybek grgrzybek self-assigned this Nov 25, 2022
@grgrzybek
Copy link
Member Author

grgrzybek commented Mar 29, 2023

From osgi/osgi#548:

But I don't see osgi.tck.cmpn folder in osgi/osgi project

The build on GHA uses some code to cause the TCK extraction:

https://github.com/osgi/osgi/blob/ec62218646e12d2cb8069a7f685b80a159f61805/osgi.tck/build.gradle#L105-L121

The task is :osgi.tck:preptck.cmpn. If you run that gradle task after the :build task, you will have a osgi.tck/generated/osgi.tck.cmpn folder that you can cd into the run the TCKs.

The GHA build uploads these folders

https://github.com/osgi/osgi/blob/ec62218646e12d2cb8069a7f685b80a159f61805/.github/workflows/cibuild.yml#L79-L86

which are then downloaded and used by the tck execution job.

https://github.com/osgi/osgi/blob/ec62218646e12d2cb8069a7f685b80a159f61805/.github/workflows/cibuild.yml#L191-L199

Also:

I have added a TCK to the Microsoft JDBC driver here that shows how to do the maven setup:
https://github.com/microsoft/mssql-jdbc/pull/2066/files

@grgrzybek
Copy link
Member Author

According to https://github.com/osgi/osgi/blob/main/CONTRIBUTING.md#run--debug-a-tck, I can run a test using:

$ gradle :org.osgi.test.cases.webcontainer:testOSGi

testOSGi comes from bnd gradle plugin: https://github.com/bndtools/bnd/tree/6.4.0/gradle-plugins#additional-tasks

@grgrzybek
Copy link
Member Author

Here's how I managed to relatively easily run TCK tests.

Build what's needed:

$ gradle :build :publish
$ gradle :osgi.specs:specifications :osgi.tck:tck.core :osgi.tck:tck.cmpn

Then the goal is to be able to use bnd runtests inside osgi.tck/generated/osgi.tck.cmpn directory.

  • cnf/ext/central.mvn can be changed to add more Maven artifacts
  • cnf/repo/org.osgi.impl.bundle.webcontainer/org.osgi.impl.bundle.webcontainer-7.0.0.lib can be changed to include other bundles (by symbolic name) used by tests

For example, I've replaced Virgo&Gemini with Pax Web by adding to cnf/repo/org.osgi.impl.bundle.webcontainer/org.osgi.impl.bundle.webcontainer-7.0.0.lib this:

org.osgi.service.repository;version=1.1.0
jakarta.servlet-api;version="[4.0,5.0)"
javax.el-api;version=3.0.3
jakarta.annotation-api;version="[1.3.5,2.0)"
javax.security.auth.message-api;version=1.1.3
org.eclipse.jdt.core.compiler.batch;version=3.26.0
org.osgi.util.promise;version=1.3.0
org.osgi.util.function;version=1.2.0
biz.aQute.bndlib;version=6.4.0
biz.aQute.bnd.util;version=6.4.0
biz.aQute.bnd.transform;version=6.4.0
org.ops4j.base;version=1.5.1
org.ops4j.pax.swissbox.bnd;version=1.8.5
org.ops4j.pax.swissbox.property;version=1.8.5
org.ops4j.pax.url.commons;version=2.6.12
org.ops4j.pax.url.war;version=2.6.12
org.ops4j.pax.logging.pax-logging-api;version=2.2.2
org.ops4j.pax.logging.pax-logging-log4j2;version=2.2.2
org.ops4j.pax.web.pax-web-api;version=8.0.18
org.ops4j.pax.web.pax-web-spi;version=8.0.18
org.ops4j.pax.web.pax-web-runtime;version=8.0.18
org.ops4j.pax.web.pax-web-tomcat-common;version=8.0.18
org.ops4j.pax.web.pax-web-tomcat;version=8.0.18
org.ops4j.pax.web.pax-web-compatibility-el2;version=8.0.18
org.ops4j.pax.web.pax-web-jsp;version=8.0.18
org.ops4j.pax.web.pax-web-extender-war;version=8.0.18

After changing the above, I could run:

$ gradle :osgi.impl:clean :osgi.impl:build
$ gradle :osgi.tck:clean :osgi.tck:preptck.cmpn

Finally, when being in osgi.tck/generated/osgi.tck.cmpn, I can run individual tests:

$ bnd runtests -t 'org.osgi.test.cases.webcontainer.junit.BundleManifestHeadersTest#testManifestHeaders001' org.osgi.test.cases.webcontainer.bnd

My bnd command is:

#!/bin/bash

java -jar /home/ggrzybek/.m2/repository/biz/aQute/bnd/biz.aQute.bnd/6.4.0/biz.aQute.bnd-6.4.0.jar $@

To debug the tests, I've copied osgi.tck/generated/osgi.tck.cmpn/org.osgi.test.cases.webcontainer.bnd to osgi.tck/generated/osgi.tck.cmpn/org.osgi.test.cases.webcontainer-d.bnd adding this at the end:

-runvm="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"

Finally to get fresh OSGi TCK jars in ~/.m2/repository, it's enough to run:

$ gradle :org.osgi.test.cases.webcontainer:release

(or any other TCK lib). pom, jar, source-jar is copied to Maven local repo.

@grgrzybek
Copy link
Member Author

Also, to make changes to Pax Web and Pax URL easier, I've replaced some libs in osgi.tck/generated/osgi.tck.cmpn/jar with symbolic links:

$ ls -l *pax*
-rw-r--r--. 1 ggrzybek ggrzybek  809830 04-03 15:14 org.ops4j.pax.logging.pax-logging-api-2.2.2.jar
-rw-r--r--. 1 ggrzybek ggrzybek 2160942 04-03 15:14 org.ops4j.pax.logging.pax-logging-log4j2-2.2.2.jar
-rw-r--r--. 1 ggrzybek ggrzybek    9744 04-03 15:14 org.ops4j.pax.swissbox.bnd-1.8.5.jar
-rw-r--r--. 1 ggrzybek ggrzybek    4009 04-03 15:14 org.ops4j.pax.swissbox.property-1.8.5.jar
-rw-r--r--. 1 ggrzybek ggrzybek    9641 04-03 15:14 org.ops4j.pax.url.commons-2.6.12.jar
lrwxrwxrwx. 1 ggrzybek ggrzybek      90 04-05 10:33 org.ops4j.pax.url.war-2.6.12.jar -> /data/sources/github.com/ops4j/org.ops4j.pax.url/pax-url-war/target/pax-url-war-2.6.12.jar
lrwxrwxrwx. 1 ggrzybek ggrzybek      94 04-05 10:28 org.ops4j.pax.web.pax-web-api-8.0.18.jar -> /data/sources/github.com/ops4j/org.ops4j.pax.web-8.0/pax-web-api/target/pax-web-api-8.0.18.jar
-rw-r--r--. 1 ggrzybek ggrzybek    3013 04-03 15:14 org.ops4j.pax.web.pax-web-compatibility-el2-8.0.18.jar
lrwxrwxrwx. 1 ggrzybek ggrzybek     112 04-05 10:30 org.ops4j.pax.web.pax-web-extender-war-8.0.18.jar -> /data/sources/github.com/ops4j/org.ops4j.pax.web-8.0/pax-web-extender-war/target/pax-web-extender-war-8.0.18.jar
-rw-r--r--. 1 ggrzybek ggrzybek 1026193 04-03 15:14 org.ops4j.pax.web.pax-web-jsp-8.0.18.jar
-rw-r--r--. 1 ggrzybek ggrzybek  160674 04-03 15:14 org.ops4j.pax.web.pax-web-runtime-8.0.18.jar
lrwxrwxrwx. 1 ggrzybek ggrzybek      94 04-05 10:30 org.ops4j.pax.web.pax-web-spi-8.0.18.jar -> /data/sources/github.com/ops4j/org.ops4j.pax.web-8.0/pax-web-spi/target/pax-web-spi-8.0.18.jar
lrwxrwxrwx. 1 ggrzybek ggrzybek     100 04-05 10:31 org.ops4j.pax.web.pax-web-tomcat-8.0.18.jar -> /data/sources/github.com/ops4j/org.ops4j.pax.web-8.0/pax-web-tomcat/target/pax-web-tomcat-8.0.18.jar
-rw-r--r--. 1 ggrzybek ggrzybek  552160 04-03 15:14 org.ops4j.pax.web.pax-web-tomcat-common-8.0.18.jar

@mattrpav
Copy link
Member

mattrpav commented Apr 5, 2023 via email

@grgrzybek
Copy link
Member Author

Is it feasible to add the TCK run to CI?

Sure! I plan to use something similar to https://github.com/microsoft/mssql-jdbc/pull/2066/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants