运行 使用 sbt 进行微基准测试

Run spark microbenchmarks using sbt

我有一个 Spark. It has a microbenchmark suite which is located here. If I browse to a particular file e.g. AggregateBenchmark.scala 的克隆设置,我在评论中看到了执行基准测试的说明。

 * To run this:
 *  build/sbt "sql/test-only *benchmark.AggregateBenchmark"

我确实在项目文件夹中尝试了上述命令,但它每次都忽略了基准测试。以下是上面发出的命令的输出。

[info] AggregateBenchmark:
[info] - aggregate without grouping !!! IGNORED !!!
[info] - stat functions !!! IGNORED !!!
[info] - aggregate with linear keys !!! IGNORED !!!
[info] - aggregate with randomized keys !!! IGNORED !!!
[info] - aggregate with string key !!! IGNORED !!!
[info] - aggregate with decimal key !!! IGNORED !!!
[info] - aggregate with multiple key types !!! IGNORED !!!
[info] - cube !!! IGNORED !!!
[info] - hash and BytesToBytesMap !!! IGNORED !!!
[info] ScalaCheck
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] Warning: Unknown ScalaCheck args provided: -oDF
[info] ScalaTest
[info] Run completed in 1 second, 393 milliseconds.
[info] Total number of tests run: 0
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 0, failed 0, canceled 0, ignored 9, pending 0
[info] No tests were executed.
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0, Ignored 9
[success] Total time: 94 s, completed Feb 17, 2017 2:57:21 PM

我在这里遗漏了什么吗?需要传递哪些额外的标志、命令才能使测试成为 运行?

遗憾的是,没有方法可以在不更改源代码的情况下运行忽略来自 CLI 的测试。

您引用的微基准测试是使用 FunSuite 编写的,并使用忽略标记系统。 API 无法忽略测试。有关 FunSuite 和忽略测试的更多信息,请参见此处:http://doc.scalatest.org/3.0.1/#org.scalatest.Ignore

忽略测试有点类似于只在源代码中注释掉测试,但它的优点是保持源代码对编译器可见,以便可以维护测试并使其与源代码保持同步他们测试。出于多种原因,开发人员选择忽略测试,但在这种情况下,这是因为 运行 作为单元测试套件的一部分,宁微基准测试有点昂贵。

运行 测试的唯一方法是使用您选择的编辑器进入并将测试的方法调用从 ignore(...) 更改为 test(...),重新编译,然后是 运行 基准。