Skip to content

Conversation

@srdo-humio
Copy link
Contributor

@srdo-humio srdo-humio commented Jul 28, 2022

ScalaTest cares about the ordering between -s (class selection) and
-t (test name selection). "-s -t" will select the test in the specified class
with the specified name. "-t -s" will select all tests in the specified
class, and all tests with the specified name.

Putting the -s we derive from --test_filter at the front of the argument
list rather than at the back is more likely to do what people want when
they specify both --test_filter and other selector flags.

It is still possible to specify -s last by passing the arguments as
--test_arg=-t --test_arg=testName --test_arg=-s --test_arg=className
and leaving --test_filter out.

fixes #1411

ScalaTest cares about the ordering between -s (class selection) and
-t (test name selection). "-s -t" will select the test in the specified class
with the specified name. "-t -s" will select all tests in the specified
class, and all tests with the specified name.

Putting the -s we derive from --test_filter at the front of the argument
list rather than at the back is more likely to do what people want when
they specify both --test_filter and other selector flags.

It is still possible to specify -s last by passing the arguments as
--test_arg=-t --test_arg=testName --test_arg=-s --test_arg=className
and leaving --test_filter out.
@srdo-humio srdo-humio force-pushed the stig/issue-1411-test-flag-ordering branch from af8b08d to 9961e03 Compare July 28, 2022 13:08
@johnynek
Copy link
Contributor

I think I was originally responsible for this (or reviewing it) and I frankly didn't understand this. So, I don't think the prior behavior was intentional.

Put another way, I'm in support of merging.

@wiwa
Copy link
Contributor

wiwa commented Jul 28, 2022

Looks good; could we get a test for this? i.e. an shtest calling bazel test...

Copy link
Collaborator

@liucijus liucijus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @srdo-humio. Please add a test to prevent future regressions.

@srdo-humio
Copy link
Contributor Author

👍 Added tests.

scala_test(
name = "tests",
srcs = ["A.scala", "B.scala"],
tags = ["manual"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this target under test_expect_failure/ instead, where it's expected to be not passing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Should the shell script remain where it is, or where do I put that?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, leave it there, thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I think this shell script does not get executed - you need to include it into test_rules_scala.sh

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be done now.

@liucijus
Copy link
Collaborator

Thanks @srdo-humio for contribution!

@johnynek and @wiwa thanks for reviewing!

@liucijus liucijus merged commit 972fdf2 into bazel-contrib:master Jul 29, 2022
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

Successfully merging this pull request may close these issues.

ScalaTest runner interpretation of --test_filter is problematic

4 participants