rules_scala icon indicating copy to clipboard operation
rules_scala copied to clipboard

--test_filter with trailing # does not work in rules_scala

Open wisechengyi opened this issue 2 years ago • 0 comments

E.g. from bazel's repo, adding # to the end of test filter class would work.

% bazel test //src/test/java/net/starlark/java/syntax:all --test_filter=net.starlark.java.syntax.LexerTest
INFO: Analyzed 2 targets (0 packages loaded, 0 targets configured).
INFO: Found 1 target and 1 test target...
INFO: Elapsed time: 0.703s, Critical Path: 0.03s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
//src/test/java/net/starlark/java/syntax:SyntaxTests            (cached) PASSED in 1.2s

Executed 0 out of 1 test: 1 test passes.
INFO: Build completed successfully, 1 total action

% bazel test //src/test/java/net/starlark/java/syntax:all --test_filter=net.starlark.java.syntax.LexerTest#
INFO: Analyzed 2 targets (0 packages loaded, 103 targets configured).
INFO: Found 1 target and 1 test target...
INFO: Elapsed time: 1.583s, Critical Path: 0.99s
INFO: 2 processes: 1 internal, 1 darwin-sandbox.
INFO: Build completed successfully, 2 total actions
//src/test/java/net/starlark/java/syntax:SyntaxTests                     PASSED in 0.9s

Executed 1 out of 1 test: 1 test passes.
INFO: Build completed successfully, 2 total actions

in rules_scala:

% bazel test test/src/main/scala/scalarules/test/resource_jars --test_filter=foo.TestResourceJars 
INFO: Build option --test_filter has changed, discarding analysis cache.
INFO: Analyzed target //test/src/main/scala/scalarules/test/resource_jars:resource_jars (0 packages loaded, 1045 targets configured).
INFO: Found 1 test target...
Target //test/src/main/scala/scalarules/test/resource_jars:resource_jars up-to-date:
  bazel-bin/test/src/main/scala/scalarules/test/resource_jars/resource_jars.jar
  bazel-bin/test/src/main/scala/scalarules/test/resource_jars/resource_jars
INFO: Elapsed time: 2.543s, Critical Path: 1.55s
INFO: 2 processes: 1 internal, 1 darwin-sandbox.
INFO: Build completed successfully, 2 total actions
//test/src/main/scala/scalarules/test/resource_jars:resource_jars        PASSED in 1.4s

Executed 1 out of 1 test: 1 test passes.
INFO: Build completed successfully, 2 total actions

% bazel test test/src/main/scala/scalarules/test/resource_jars --test_filter=foo.TestResourceJars#
INFO: Build option --test_filter has changed, discarding analysis cache.
INFO: Analyzed target //test/src/main/scala/scalarules/test/resource_jars:resource_jars (0 packages loaded, 1045 targets configured).
INFO: Found 1 test target...
FAIL: //test/src/main/scala/scalarules/test/resource_jars:resource_jars (see /private/var/tmp/_bazel_yic/2ceecb63e72239e50b9654ebbc6f2a73/execroot/io_bazel_rules_scala/bazel-out/darwin-fastbuild/testlogs/test/src/main/scala/scalarules/test/resource_jars/resource_jars/test.log)
Target //test/src/main/scala/scalarules/test/resource_jars:resource_jars up-to-date:
  bazel-bin/test/src/main/scala/scalarules/test/resource_jars/resource_jars.jar
  bazel-bin/test/src/main/scala/scalarules/test/resource_jars/resource_jars
INFO: Elapsed time: 2.053s, Critical Path: 1.17s
INFO: 2 processes: 1 internal, 1 darwin-sandbox.
INFO: Build completed, 1 test FAILED, 2 total actions
//test/src/main/scala/scalarules/test/resource_jars:resource_jars        FAILED in 1.1s
  /private/var/tmp/_bazel_yic/2ceecb63e72239e50b9654ebbc6f2a73/execroot/io_bazel_rules_scala/bazel-out/darwin-fastbuild/testlogs/test/src/main/scala/scalarules/test/resource_jars/resource_jars/test.log

INFO: Build completed, 1 test FAILED, 2 total actions

The trailing # is significant because

  1. bazel's intellij plugin will add the trailing # intentionally, so currently our test fails.
  2. this could be a way for the test runner to distinguish class a.b.ccc vs a.b.c (substring of the former).

wisechengyi avatar Apr 06 '22 16:04 wisechengyi