Welcome! Please see the About page for a little more info on how this works.

0 votes
in Test by


The clojure/data.xml test suite fails to run on JDK 17 with the following error

$ lein test
Exception in thread "main" Syntax error compiling at (clojure/data/xml/cljs_repls.clj:11:5).
	at clojure.lang.Compiler.analyze(Compiler.java:6808)
	at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: No such var: repl-nh/eval-resource
	at clojure.lang.Util.runtimeException(Util.java:221)
	at clojure.lang.Compiler.resolveIn(Compiler.java:7387)
	at clojure.lang.Compiler.resolve(Compiler.java:7357)
	at clojure.lang.Compiler.analyzeSymbol(Compiler.java:7318)
	at clojure.lang.Compiler.analyze(Compiler.java:6768)
	... 67 more
Tests failed.

This is because the Clojurescript tests run on top of the Nashorn JS engine, but the latter has been removed from JDK 15 onwards.

Are there any plans to run the tests directly from Clojurescript, perhaps as core.async does it with deps.edn? Happy to have a look if so and you are open to PRs.


2 Answers

+1 vote

Leiningen is not used for building/testing any of the Contrib libraries. Some maintainers have added project.clj as a convenience for themselves but that is not official infrastructure (some maintainers have added deps.edn which is also not official).

The official infrastructure uses Maven (and mvn test passes but it looks like there's not much of a JDK test matrix in place for data.xml). The pom.xml currently specifies Clojure version 1.7.0 which means the cljs tests are skipped regardless of JDK.

If the pom.xml is updated to, say, Clojure 1.9.0, then the tests fail on JDK 17 (as you observed).

It would be nice if there was more of a matrix of Clojure versions and JDK versions in the tests for this Contrib.

I see, thanks. For my reference, the contrib packages use https://github.com/clojure/build.poms as their parent POM.

Any thoughts on how to construct the versions matrix in the tests?
I'm not sure why it isn't running the matrix of tests automatically. There's not much setup needed as that is handled by the CI system itself. The build.ci project specifies the Clojure and JDK versions that should be used and the minimum version of Clojure supported.

It looks like several project matrix tests are not running properly at the moment (I just checked java.jdbc) so maybe something is broken on CI right now?
+1 vote

This project doesn't actually use Leiningen to run the project tests - the Maven build (mvn clean test) is what's run in the official build.

That said when run that way they have the same problem (well multiple) problems. The logic to only test on Java 8 is wrong for JDK > 8 and will only try to run the tests on Java 8. It depends on a really old ClojureScript version and newer versions have removed a lot of the Nashorn repl stuff the test suite depends on, so using newest ClojureScript also won't work.

What I ideally would want here is not what we have in core.async (which splits the build into a piece that can't be run automatically on the build box during releases) but to fix what we have in clojure.xml to continue working in the maven-based build. There are OpenJDK builds of Nashorn that can be used, so Nashorn is not really a deal breaker either way. I do not follow the CLJS testing stuff enough to know if it's worth doing that and addressing the parts pulled out of cljs repl, or it would be better to use something else and retrofitting the tests into a different framework.

If you're interested in working on it, would be happy to have help on it. We don't use PRs but I've created a jira for this at https://clojure.atlassian.net/browse/DXML-67 and you could sign the contributor agreement and request access to jira to provide patches. https://clojure.org/dev/dev#_becoming_a_contributor

I shall have a look, thanks!

(The data.xml-test-matrix correctly now shows JDK17 as failing https://build.clojure.org/view/Contrib/job/data.xml-test-matrix/lastBuild/. I assume this was due to a CI configuration update).
Yes, I mentioned on the clojure-dev channel that some CI matrix tests weren't running and Alex fixed the CI configuration so those matrix tests are running correctly now.
Hi, I think I might have failed the eligibility criteria for the contribution agreement .

Though, I had already completed the work to support the current the cljs test suite on JDK 15 and 17 using the openjdk library


so please feel free to scavenge any of it either in full or in part, no need to reference me.

Basically, nashorn is brought in as an external maven test dependency  for JDK versions [15,17] via on profile conditionals, otherwise the build in instance is used as in earlier versions.

I've decided also to copy the cljs.repl.nashorn file from the ClojureScript codebase and update for openjdk nashorn, not so much for supporting the tests (they are easily fixed even without it), but maintaining the cljs repl functionality used for development.

I've also noticed that some clojure tests failed on MS-Windows due to comparing strings with newlines, so I've fixed that to.

I've confirmed that all tests now run and pass on openjJDK 8, 11, 15 and 17, so at least this seems like a good starting point, making only the minimal of changes while retaining the the existing functionality throughout.

The next  I had in mind was to ask you what clojure(script) dependencies to upgrade to, and after that evaluate other possible solutions such as graalvm for running the cljs tests.

Hope this helps!