Skip to content

Commit

Permalink
Add SCALA_VERSION comment to test_coverage_*.sh
Browse files Browse the repository at this point in the history
After @simuons asked about an apparently missing `--repo_env` setting in
`test_coverage_scalatest.sh` in #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.
  • Loading branch information
mbland committed Oct 21, 2024
1 parent 8cc2de7 commit c4b5a9a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions test/shell/test_coverage_equals_in_target.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
. "${dir}"/test_helper.sh
runner=$(get_test_runner "${1:-local}")

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

test_coverage_target_name_contains_equals_sign() {
Expand Down
1 change: 1 addition & 0 deletions test/shell/test_coverage_scalatest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
. "${dir}"/test_helper.sh
runner=$(get_test_runner "${1:-local}")

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

test_coverage_on() {
Expand Down
2 changes: 1 addition & 1 deletion test/shell/test_coverage_scalatest_resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
. "${dir}"/test_helper.sh
runner=$(get_test_runner "${1:-local}")

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

test_coverage_succeeds_resource_call() {
Expand All @@ -16,7 +17,6 @@ test_coverage_succeeds_resource_call() {

test_coverage_includes_resource_test_targets() {
bazel coverage \
--repo_env="SCALA_VERSION=${SCALA_VERSION}" \
--instrument_test_targets=True \
//test/coverage_scalatest_resources/consumer:tests
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
Expand Down
2 changes: 1 addition & 1 deletion test/shell/test_coverage_specs2_with_junit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
. "${dir}"/test_helper.sh
runner=$(get_test_runner "${1:-local}")

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

test_coverage_on() {
Expand All @@ -15,7 +16,6 @@ test_coverage_on() {

test_coverage_includes_test_targets() {
bazel coverage \
--repo_env="SCALA_VERSION=${SCALA_VERSION}" \
--instrument_test_targets=True \
//test/coverage_specs2_with_junit:test-specs2-with-junit
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
Expand Down

0 comments on commit c4b5a9a

Please sign in to comment.