mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
e54809cecc
The `sandbox-perf` build has been failing for a while with the following errors: ``` INFO: From Generating benchmark code for //ledger/sandbox-perf:sandbox-perf_codegen: JMH benchmark generation: JMH Benchmark generator failed JMH benchmark generation: Benchmark classes should not be final. [com.digitalasset.platform.sandbox.perf.LargeTransactionBench] JMH benchmark generation: The instantiated @State class cannot be abstract. [com.digitalasset.platform.sandbox.perf.PerfBenchState] ``` However, these errors are ignored; running the benchmarks runs the `AcsBench` benchmark and ignores the fact `LargeTransactionBench` and `SimpleBench` failed to compile. I've fixed the errors by making sure that classes are not final, and that `SimpleBench` uses a concrete state class. This also introduces a cheap patch to the Scala JMH Bazel rules that makes sure they fail if there are any errors. I'm not really sure how to patch the Bazel rules properly, but someone else might have an idea. :-) CHANGELOG_BEGIN CHANGELOG_END Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
47 lines
1.5 KiB
Diff
47 lines
1.5 KiB
Diff
diff --git a/src/scala/io/bazel/rules_scala/jmh_support/BenchmarkGenerator.scala b/src/scala/io/bazel/rules_scala/jmh_support/BenchmarkGenerator.scala
|
|
index d367ff4..99076ec 100644
|
|
--- a/src/scala/io/bazel/rules_scala/jmh_support/BenchmarkGenerator.scala
|
|
+++ b/src/scala/io/bazel/rules_scala/jmh_support/BenchmarkGenerator.scala
|
|
@@ -12,6 +12,7 @@ import org.openjdk.jmh.runner.options.{Options, OptionsBuilder}
|
|
import java.net.URI
|
|
|
|
import scala.collection.JavaConverters._
|
|
+import scala.util.control.NonFatal
|
|
import java.nio.file.{FileSystems, Files, Path, Paths}
|
|
|
|
import io.bazel.rulesscala.jar.JarCreator
|
|
@@ -43,13 +44,18 @@ object BenchmarkGenerator {
|
|
|
|
def main(argv: Array[String]): Unit = {
|
|
val args = parseArgs(argv)
|
|
- generateJmhBenchmark(
|
|
- args.generatorType,
|
|
- args.resultSourceJar,
|
|
- args.resultResourceJar,
|
|
- args.inputJar,
|
|
- args.classPath
|
|
- )
|
|
+ try {
|
|
+ generateJmhBenchmark(
|
|
+ args.generatorType,
|
|
+ args.resultSourceJar,
|
|
+ args.resultResourceJar,
|
|
+ args.inputJar,
|
|
+ args.classPath
|
|
+ )
|
|
+ } catch {
|
|
+ case NonFatal(exception) =>
|
|
+ sys.exit(1)
|
|
+ }
|
|
}
|
|
|
|
private def parseArgs(argv: Array[String]): BenchmarkGeneratorArgs = {
|
|
@@ -172,6 +178,7 @@ object BenchmarkGenerator {
|
|
for (e <- destination.getErrors.asScala) {
|
|
log(e.toString)
|
|
}
|
|
+ throw new RuntimeException("JHM Benchmark generator failed")
|
|
}
|
|
}
|
|
constructJar(sourceJarOut, tmpSourceDir)
|