Unit tests fail on Apple Silicon with Gradle :test task but pass with JUnit test runner

Answered

NOTE: This is an update to Plugin tests are failing on Apple Silicon. I also submitted it to YouTrack as IDEA-304723, but it's not really an IntelliJ bug.

I have an IDEA plugin that has failing unit tests on a new Apple Silicon MacBook, but these tests pass on AMD64 platforms, including an older MacBook and a GitHub Actions runner. All three tests appear to be failing due to an error loading the JNA library. The plugin itself works on all platforms, the only problem is with these tests.

The failing tests all pass on Apple Silicon if I use a JUnit run configuration in IntelliJ instead of just running  `gradlew :test`. So, this appears to be a Gradle configuration issue, but I cannot figure out where the problem is. The plugin supports IDEA 2022.1+, and is being built against IC-2022.1 with Gradle IntelliJ Plugin v1.9.0, so Apple Silicon should be fully supported.

Please see build.gradle.kts and issues/1 in the plugin GitHub repo for more details (sorry, I can't figure out how to paste code here without completely breaking formatting).

 

 

 

 

 

3 comments
Comment actions Permalink

I forgot to add that the dev-junit5 branch of the plugin repo has the relevant code to reproduce this issue.

0
Comment actions Permalink

Could you please try if upgrading to gradle-intellij-plugin 1.10.0 helps here? https://github.com/mdklatt/idea-netcdf-plugin/blob/dev-junit5/build.gradle.kts#L12

0
Comment actions Permalink

This does not fix the Gradle tests, and now some of the JUnit tests fail as well due to class loader exceptions. e.g. java.lang.NoClassDefFoundError: com/intellij/ui/treeStructure/Tree. I am using the -Didea.force.use.core.classloader=true workaround for the JUnit run configuration; disabling this makes no difference.

0

Please sign in to leave a comment.