Skip to content

Commit 33034d6

Browse files
committed
Add SCALA_VERSION comment to test_coverage_*.sh
After @simuons asked about an apparently missing `--repo_env` setting in `test_coverage_scalatest.sh` in bazel-contrib#1622, I realized the test case missing it used `grep`, not `diff`. Rather than add the flag where it wasn't needed, I commented the local `SCALA_VERSION` setting in each file. Now that I think about it, the proper solution is to generate coverage files for each Scala version, or for ranges of scala versions. Then we can remove this `SCALA_VERSION` and `--repo_env` setting completely. I'll look into that as a side quest.
1 parent 1a3888b commit 33034d6

4 files changed

+4
-2
lines changed

test/shell/test_coverage_equals_in_target.sh

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
44
. "${dir}"/test_helper.sh
55
runner=$(get_test_runner "${1:-local}")
66

7+
# Default to 2.12.19 for `diff` tests because other versions change the output.
78
SCALA_VERSION="${SCALA_VERSION:-2.12.19}"
89

910
test_coverage_target_name_contains_equals_sign() {

test/shell/test_coverage_scalatest.sh

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
44
. "${dir}"/test_helper.sh
55
runner=$(get_test_runner "${1:-local}")
66

7+
# Default to 2.12.19 for `diff` tests because other versions change the output.
78
SCALA_VERSION="${SCALA_VERSION:-2.12.19}"
89

910
test_coverage_on() {

test/shell/test_coverage_scalatest_resources.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
44
. "${dir}"/test_helper.sh
55
runner=$(get_test_runner "${1:-local}")
66

7+
# Default to 2.12.19 for `diff` tests because other versions change the output.
78
SCALA_VERSION="${SCALA_VERSION:-2.12.19}"
89

910
test_coverage_succeeds_resource_call() {
@@ -16,7 +17,6 @@ test_coverage_succeeds_resource_call() {
1617

1718
test_coverage_includes_resource_test_targets() {
1819
bazel coverage \
19-
--repo_env="SCALA_VERSION=${SCALA_VERSION}" \
2020
--instrument_test_targets=True \
2121
//test/coverage_scalatest_resources/consumer:tests
2222
grep -q "SF:test/coverage_scalatest_resources/consumer/src/test/scala/com/example/consumer/ConsumerSpec.scala" $(bazel info bazel-testlogs)/test/coverage_scalatest_resources/consumer/tests/coverage.dat

test/shell/test_coverage_specs2_with_junit.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
44
. "${dir}"/test_helper.sh
55
runner=$(get_test_runner "${1:-local}")
66

7+
# Default to 2.12.19 for `diff` tests because other versions change the output.
78
SCALA_VERSION="${SCALA_VERSION:-2.12.19}"
89

910
test_coverage_on() {
@@ -15,7 +16,6 @@ test_coverage_on() {
1516

1617
test_coverage_includes_test_targets() {
1718
bazel coverage \
18-
--repo_env="SCALA_VERSION=${SCALA_VERSION}" \
1919
--instrument_test_targets=True \
2020
//test/coverage_specs2_with_junit:test-specs2-with-junit
2121
grep -q "SF:test/coverage_specs2_with_junit/TestWithSpecs2WithJUnit.scala" $(bazel info bazel-testlogs)/test/coverage_specs2_with_junit/test-specs2-with-junit/coverage.dat

0 commit comments

Comments
 (0)