Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean
test_{runner,scalafmt_helper}
, add diagnostic env vars, and i…
…mprove `test_cross_build` performance (#1646) * Clean test_{runner,scalafmt_helper}, add env vars Did a little cleaning up while trying to get protobuf to stop recompiling so often. Didn't impact that problem, but good cleanups regardless. Also added two environment variables to make diagnosing test failures (or slowdowns) easier: - 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 from `test/shell/test_*.sh`. Also, today I learned that `SECONDS` is a special Bash variable. Making it `local` screwed it up and showed all tests as taking zero seconds. * Don't clean test_cross_build, shutdown at end This speeds up the `test_cross_build.sh` tests substantially, particularly between runs. Here are the times for two runs before this change; the first is after running `bazel clean` and `bazel shutdown` in the `test_cross_build` directory: ```txt $ /usr/bin/time ./test_cross_build.sh running test test_cross_build Test "test_cross_build" successful (73 sec) running test test_scalafmt Test "test_scalafmt" successful (94 sec) 167.01 real 0.37 user 0.50 sys $ /usr/bin/time ./test_cross_build.sh running test test_cross_build Test "test_cross_build" successful (8 sec) running test test_scalafmt Test "test_scalafmt" successful (92 sec) 99.96 real 0.35 user 0.48 sys ``` Here are the times for two equivalent runs after this change: ```txt $ /usr/bin/time ./test_cross_build.sh running test test_cross_build Test "test_cross_build" successful (71 sec) running test test_scalafmt Test "test_scalafmt" successful (6 sec) 77.50 real 0.33 user 0.44 sys $ /usr/bin/time ./test_cross_build.sh running test test_cross_build Test "test_cross_build" successful (5 sec) running test test_scalafmt Test "test_scalafmt" successful (2 sec) 7.21 real 0.26 user 0.38 sys ``` The effect is even more dramatic when setting compiler flags in `.bazelrc`, as I've tried while building protobuf-v28.3 under Bazel 6.5.0.
- Loading branch information