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

Test / skip := true leads to java.lang.IllegalArgumentException: Benchmark does not match a class #216

Open
catap opened this issue May 20, 2022 · 0 comments

Comments

@catap
Copy link
Contributor

catap commented May 20, 2022

When a project with is build or run by sbt-jmh contains Test / skip := true, well, it produces a jar which can't be used at all.

Any benchmark fails as:

[info] # JMH version: 1.32
[info] # VM version: JDK 1.8.0_322, OpenJDK 64-Bit Server VM, 25.322-b06
[info] # VM invoker: /Library/Java/JavaVirtualMachines/openjdk8-temurin/Contents/Home/jre/bin/java
[info] # VM options: <none>
[info] # Blackhole mode: full + dont-inline hint
[info] # Warmup: 5 iterations, 10 s each
[info] # Measurement: 5 iterations, 10 s each
[info] # Timeout: 10 min per iteration
[info] # Threads: 1 thread, will synchronize iterations
[info] # Benchmark mode: Throughput, ops/time
[info] # Benchmark: test.TestBenchmark.readFromFile
[info] # Run progress: 66.67% complete, ETA 00:00:01
[info] # Fork: 1 of 5
[info] <failure>
[info] java.lang.IllegalArgumentException: Benchmark does not match a class
[info] 	at org.openjdk.jmh.util.ClassUtils.loadClass(ClassUtils.java:94)
[info] 	at org.openjdk.jmh.runner.BenchmarkHandler.<init>(BenchmarkHandler.java:69)
[info] 	at org.openjdk.jmh.runner.BaseRunner.runBenchmark(BaseRunner.java:232)
[info] 	at org.openjdk.jmh.runner.BaseRunner.doSingle(BaseRunner.java:138)
[info] 	at org.openjdk.jmh.runner.BaseRunner.runBenchmarksForked(BaseRunner.java:75)
[info] 	at org.openjdk.jmh.runner.ForkedRunner.run(ForkedRunner.java:72)
[info] 	at org.openjdk.jmh.runner.ForkedMain.main(ForkedMain.java:84)
[info] Caused by: java.lang.ClassNotFoundException: test.jmh_generated.TestBenchmark_readFromFile_jmhTest
[info] 	at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
[info] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
[info] 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
[info] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
[info] 	at java.lang.Class.forName0(Native Method)
[info] 	at java.lang.Class.forName(Class.java:264)
[info] 	at org.openjdk.jmh.util.ClassUtils.loadClass(ClassUtils.java:73)
[info] 	... 6 more

How to reproduce:

  1. Get the last version. I've used Fix sbt-jmh-tester #215 as local root.
  2. publish locally artifacts by: sbt ^^1.3.10 publishLocal
  3. add Test / skip := true to sbt-jmh-tester/build.sbt
  4. run sbt jmh:run inside sbt-jmh-tester folder

Here it is.

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

No branches or pull requests

1 participant