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

Disable failing tests #494

Merged
merged 2 commits into from
Jan 27, 2018
Merged

Disable failing tests #494

merged 2 commits into from
Jan 27, 2018

Conversation

ckoparkar
Copy link
Contributor

@ckoparkar ckoparkar commented Jan 26, 2018

These failures are unrelated to the nREPL itself.

  1. CLJS doesn't build on JDK9 because it depends on a package deprecated in JDK9 (javax.xml.bind). CLJS-2377 tracks it. It has been fixed on master, but not yet released. After that, we can enable CLJS-1.9 tests on JDK9, but not the others.

  2. CLJS-1.9 also doesn't build on JDK7 anymore ? I think this is because of a dependency on the closure-compiler which requires JDK8 or higher (https://github.com/google/closure-compiler/wiki/Releases#september-10-2017-v20170910)

/cc @gonewest818

Before submitting a PR make sure the following things have been done:

  • The commits are consistent with our contribution guidelines
  • You've added tests to cover your change(s)
  • All tests are passing
  • The new code is not generating reflection warnings
  • You've updated the readme (if adding/changing middleware)

Thanks!

@ckoparkar
Copy link
Contributor Author

All tests pass! Yay!

.travis.yml Outdated
@@ -44,6 +44,16 @@ matrix:
jdk: oraclejdk8
after_success: bash <(curl -s https://codecov.io/bash) -f target/coverage/codecov.json

exclude:
- env: VERSION=1.9 TARGET=test-cljs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should also put the explanations here, so people would be able to quickly understand why've setup the build this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Added comments there.

.travis.yml Outdated
exclude:
# CLJS doesn't build on JDK9 because it depends on a package (javax.xml.bind)
# deprecated in JDK9. See (CLJS-2377).
# After a CLJS release, the VERSION=1.9 build can be re-enabled.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In bhauman/lein-figwheel#612 another way to handle this was discussed. Conditionally adding :jvm-opts ["--add-modules" "java.xml.bind"] to the build.

Copy link
Contributor Author

@ckoparkar ckoparkar Jan 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered doing this. So we could add something like:

:jvm-opts ~(try (do (Class/forName "javax.xml.bind.DatatypeConverter")
                     [])
                (catch ClassNotFoundException e  ["--add-modules" "java.xml.bind"]))

But this seemed like too much of a hack to get the tests working. Should we take this path ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, I should've mentioned this in the PR as well. Thanks for bringing it up.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, I just wanted to put it out there. I don't have a strong opinion either way.

However, that said, another equally hacky approach would be to detect the java version in the Makefile and use lein update-in to inject the :jvm-opts as needed for cljs.

The Makefile has been the place where other transient toggling is being done, for instance filtering out some cloverage tests, and turning off mranderson.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's true. One advantage of this would be that all toggling would be in one place.

But would doing this in Clojure be a bit safer than grepping the version there ? (I have to admit that I have minimal experience with Makefiles, so I might be totally wrong. I used Class/forName because of Alex Miller's comment on the same figwheel issue.)

If we're not disabling the tests and adding java-opts instead, I'm leaning toward adding it in the project.clj file and using Class/forName. But I'm fine with the Makefile version too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, for instance in orchard there's this
https://github.com/clojure-emacs/orchard/blob/master/Makefile#L5-L8

which detects Java 9 and constructs a test selector :java9.0 which is then used to filter certain test cases based on metadata (e.g. lein with-profile +1.9 test :java9.0). The usage would be different in this case, but we're already taking a similar risk elsewhere.

@gonewest818 gonewest818 mentioned this pull request Jan 26, 2018
5 tasks
Makefile Outdated
lein with-profile +$(VERSION),+test-cljs test
endif

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh well. Let's go ahead with the Makefile version then. Does this look ok ? I couldn't figure out how to use both with-profile and update-in at the same time. I'm not using Clojure/Leiningen for a while now. And I ran out of make-fu :P . Could you please help with this ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that work? I've never tried expressing a recipe that way. I would have done the conditional test in bash syntax, ie. all the logic completely inside the recipe.

test-cljs: .source-deps
        if [ "$(JAVA_VERSION)" = "9.0" ]; then \
            lein with-profile +$(VERSION),+test-cljs,+jxb test; \
        else \
            lein with-profile +$(VERSION),+test-cljs test; \
        fi

Also, now that I'm thinking about it... I wonder if it's more future-proof to name the Leiningen profile "+java9.0" [edit: even better, "+java9-modules"] rather than "+jxb"? In the event the project requires other Java 9 modules down the road then this mechanism for adding modules has a general label instead of the specific one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while I'm at my keyboard I'll take a look at the update-in usage also.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing it with update-in would look something like this:

test-cljs: .source-deps
        if [ "$(JAVA_VERSION)" = "9.0" ]; then \
            lein with-profile +$(VERSION),+test-cljs \
                 update-in :jvm-opts concat "[\"--add-module\" \"java.xml.bind\"]" \ 
                 -- test; \
        else \
            lein with-profile +$(VERSION),+test-cljs test; \
        fi

going this route you don't need the :jxb profile in project.clj at all.

Makefile Outdated
@@ -3,6 +3,9 @@
VERSION ?= 1.9
export CLOVERAGE_VERSION = 1.0.11-SNAPSHOT

# The test-cljs target needs to be modified if working with JDK9
JAVA_VERSION = :java$(shell lein version | cut -d " " -f 5 | cut -d "." -f 1-2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to produce a string like :java9.0 (or :java1.8, :java1.7, it's annoying that the numbering convention changed).

Suggest you simplify by dropping the ":java" part:

JAVA_VERSION = $(shell lein version | cut -d " " -f 5 | cut -d "." -f 1-2)

which will produce a number like "#.#"

Makefile Outdated
@@ -13,7 +16,13 @@ test-clj: .source-deps
lein with-profile +$(VERSION),+test-clj test

test-cljs: .source-deps
lein with-profile +$(VERSION),+test-cljs test
if [ "$(JAVA_VERSION)" = "9.0" ] || [ "$(JAVA_VERSION)" = "9" ]; then \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, on my linux machine, JAVA_VERSION is simply "9" instead of "9.0". Is it different on yours ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Travis it returns "9.0"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right... I was in the middle of typing the same thing. The orchard builds are all getting "9.0" on the Travis CI infrastructure running Ubuntu 14.04.

What distribution are you running?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using OpenJDK on Archlinux.

Should we leave the = "9" around, just in case ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm launching a Docker container with Ubuntu 16.04 and apt-get install openjdk-9-jdk to see. I assume that's what Travis CI will move to next.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

root@2735a24c8c08:~# ./lein version
Leiningen 2.8.1 on Java 9-internal OpenJDK 64-Bit Server VM
root@2735a24c8c08:~# ./lein version | cut -d " " -f 5
9-internal
root@2735a24c8c08:~# ./lein version | cut -d " " -f 5 | cut -d "." -f 1-2
9-internal

That = "9" doesn't look like it's going to work. As of right now OpenJDK 9 on Ubuntu 16.04 calls itself 9-internal and you could use that, but really we should open a ticket that we need a way to detect Oracle and OpenJDK versions and report back consistently. I'd be shocked if something better isn't available.

Copy link
Contributor Author

@ckoparkar ckoparkar Jan 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Strange. Yeah, we should track this somewhere. I've used 9-internal here though. The failing Travis builds would be a good forcing function for us to modify it.

Makefile Outdated
lein with-profile +$(VERSION),+test-cljs test
if [ "$(JAVA_VERSION)" = "9.0" ] || [ "$(JAVA_VERSION)" = "9" ]; then \
lein with-profile +$(VERSION),+test-cljs \
update-in :jvm-opts concat '["--add-modules" "java.xml.bind"]' \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @gonewest818! I've pretty much used your code verbatim, except for using single quotes here. Escaping the double quotes didn't work.

The jxb profile sure was ugly. This looks so much better.

The javax.xml.bind has been deprecated in JDK9, but ClojureScript depends on it (CLJS-2377).
@bbatsov bbatsov merged commit 04fd79d into clojure-emacs:master Jan 27, 2018
@bbatsov
Copy link
Member

bbatsov commented Jan 27, 2018

Nice! I was completely fine with the original solution, but you've managed to improve it quite a bit! Very useful (and also very educational for me)!

Thanks, guys! 🙇

@ckoparkar
Copy link
Contributor Author

Thanks a lot for all the help @gonewest818!

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

Successfully merging this pull request may close these issues.

None yet

3 participants