Clean test_{runner,scalafmt_helper}
, add diagnostic env vars, and improve test_cross_build
performance
#1646
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Cleans up some of the formatting of
test/shell/test_{runner,scalafmt_helper}.sh
and adds theRULES_SCALA_TEST_{ONLY,VERBOSE}
environment variables. Improvestest_cross_build.sh
performance signficantly.Defining
RULES_SCALA_TEST_ONLY
will cause only one specific test case to run, with full Bazel output. This is helpful for pinpointing and working on a specific test without hunting for it or recreating its commands.Defining
RULES_SCALA_TEST_VERBOSE
will cause all tests to emit full Bazel output. This is more useful when running all the tests from a specific script fromtest/shell/test_*.sh
.The
test_cross_build.sh
changes speed up its tests substantially, particularly between runs. Here are the times for two runs before this change; the first is after runningbazel clean
andbazel shutdown
in thetest_cross_version
directory:Here are the times for two equivalent runs after this change:
Motivation
The cleanup began as an attempt to get protobuf to stop recompiling so often in my new branch to use the latest abseil-cpp 20240722.0 and protobuf v28.3. It didn't impact that problem, but they were good cleanups regardless. (Though today I learned that
SECONDS
is a special Bash variable, and marking itlocal
is a mistake that makes all tests look like they ran in zero seconds.)The
test_cross_version.sh
speedups were also a result of working on that branch, on which the speedups described above were even more dramatic.Previously, every
bazel run
intest_scalafmt
would rebuild the entire protobuf library. I thought it was hanging, until I usedRULES_SCALA_TEST_ONLY
and could see what was happening. Then I usedRULES_SCALA_TEST_VERBOSE
to see the relationship betweenbazel
invocations intest_cross_build.sh
. That led me to remove thebazel clean
fromtest_cross_build
and move thebazel shutdown
to the end of the script.As always, this is spawned from work related to #1482, though it is a bit of a side quest.