From 33034d6973aec141db7939a919e45dd298b72145 Mon Sep 17 00:00:00 2001 From: Mike Bland Date: Fri, 18 Oct 2024 09:33:09 -0400 Subject: [PATCH] Add SCALA_VERSION comment to test_coverage_*.sh 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. --- test/shell/test_coverage_equals_in_target.sh | 1 + test/shell/test_coverage_scalatest.sh | 1 + test/shell/test_coverage_scalatest_resources.sh | 2 +- test/shell/test_coverage_specs2_with_junit.sh | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/shell/test_coverage_equals_in_target.sh b/test/shell/test_coverage_equals_in_target.sh index 7dbaaa471..2f37fa8e8 100755 --- a/test/shell/test_coverage_equals_in_target.sh +++ b/test/shell/test_coverage_equals_in_target.sh @@ -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() { diff --git a/test/shell/test_coverage_scalatest.sh b/test/shell/test_coverage_scalatest.sh index e81dbea63..e29b6adc2 100755 --- a/test/shell/test_coverage_scalatest.sh +++ b/test/shell/test_coverage_scalatest.sh @@ -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() { diff --git a/test/shell/test_coverage_scalatest_resources.sh b/test/shell/test_coverage_scalatest_resources.sh index cef6e690e..08bb38b74 100755 --- a/test/shell/test_coverage_scalatest_resources.sh +++ b/test/shell/test_coverage_scalatest_resources.sh @@ -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() { @@ -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 diff --git a/test/shell/test_coverage_specs2_with_junit.sh b/test/shell/test_coverage_specs2_with_junit.sh index f962a00f1..725eecccd 100755 --- a/test/shell/test_coverage_specs2_with_junit.sh +++ b/test/shell/test_coverage_specs2_with_junit.sh @@ -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() { @@ -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