Github user squito commented on a diff in the pull request:
https://github.com/apache/spark/pull/6917#discussion_r33146259
--- Diff: dev/run-tests.py ---
@@ -639,32 +651,47 @@ def detect_binary_inop_with_mima():
run_cmd([os.path.join(SPARK_HOME, "dev", "mima")])
-def run_scala_tests_maven(test_profiles):
+def run_scala_tests_maven(test_profiles, tags_to_exclude):
mvn_test_goals = ["test", "--fail-at-end"]
profiles_and_goals = test_profiles + mvn_test_goals
+ if tags_to_exclude:
+ # This will be read by the scalatest plugin in pom.xml
+ profiles_and_goals += ["-Dspark.test.tagsToExclude='%s'" %
tags_to_exclude]
+
print "[info] Running Spark tests using Maven with these arguments:",
- print " ".join(profiles_and_goals)
+ print format_cmd(profiles_and_goals)
exec_maven(profiles_and_goals)
-def run_scala_tests_sbt(test_modules, test_profiles):
-
+def run_scala_tests_sbt(test_modules, test_profiles, tags_to_exclude):
sbt_test_goals = set(itertools.chain.from_iterable(m.sbt_test_goals
for m in test_modules))
if not sbt_test_goals:
+ print "[warn] No SBT goals to run... Exiting."
return
+ # In SBT, we can only exclude scalatest tags through "test-only", but
not "test"
+ # Here we rewrite each test goal to use "test-only * -- -l <tags>"
instead
+ # e.g. test -> test-only * -- -l SlowTest
+ # e.g. hive/test -> hive/test-only * -- -l SlowTest
+ if tags_to_exclude:
+ new_sbt_test_goals = []
+ for g in sbt_test_goals:
+ g = re.sub(r"test$", "test-only * -- -l %s" % tags_to_exclude,
g)
--- End diff --
I think this will have the unintended side-effect of excluding *all* junit
tests. Its really unfortunate that the junit args & the scalatest args are
incompatible. From https://github.com/sbt/junit-interface, "Any parameter not
starting with - or + is treated as a glob pattern for matching tests.", so
junit decides to only look for tests which match the pattern of the test you
are trying to exclude. Eg., compare:
```
> test-only *JavaAPISuite
...
[info] Test run finished: 0 failed, 0 ignored, 90 total, 20.878s
```
vs
```
> test-only *JavaAPISuite -- -l FooBar
...
[info] Test run finished: 0 failed, 0 ignored, 0 total, 0.001s
```
That's why I had to make bigger changes to the sbt build to get it to pass
a different set of args to junit & scalatest
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]