forked from bazelbuild/rules_scala
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When building JMH benchmarks, fail on error, instead of proceeding. (b…
…azelbuild#977) * When building JMH benchmarks, fail on error, instead of proceeding. Currently, if there are errors in some (but not all) benchmarks, running `bazel run //path/to/benchmark` will compile them, fail on some, and then run the rest. This changes that behavior so that any JMH build failure will fail the build. * Add a test for expected failures in JMH benchmarks. * Document the fix to JMH builds as a breaking change. * Split "test_benchmark_jmh_failure" from "test_benchmark_jmh". * We don't need ValidBenchmark.scala when testing JMH failures.
- Loading branch information
1 parent
d534984
commit a9c290c
Showing
5 changed files
with
63 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
load( | ||
"//jmh:jmh.bzl", | ||
"scala_benchmark_jmh", | ||
) | ||
|
||
scala_benchmark_jmh( | ||
name = "jmh_reports_failure", | ||
srcs = [ | ||
"InvalidBenchmark.scala", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package foo | ||
|
||
import org.openjdk.jmh.annotations.Benchmark | ||
|
||
// Benchmark classes cannot be final. | ||
final class InvalidBenchmark { | ||
@Benchmark | ||
def sumIntegersBenchmark: Int = | ||
(1 to 100).sum | ||
} |