-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
104618: test: add support for `TEST_UNDECLARED_OUTPUTS_DIR` r=rickystewart a=rickystewart To date, we have put temporary files from tests in $TMPDIR. We have a patch to `rules_go` that copies the value of the $TEST_TMPDIR (the variable that Bazel provides) over to $TMPDIR for use in CI. Some tests (especially those using TestLogScope) have behavior where they leave files behind after the test completes *if the test fails*, thereby allowing people to look at the left-over files for debugging. As we transition to remote execution, this will no longer work, since the $TMPDIR is on some remote machine somewhere, and Bazel will just clean the $TMPDIR up after the test completes regardless of its exit status. Bazel provides the variable `TEST_UNDECLARED_OUTPUTS_DIR` for the same purpose: it gives us a place to put unstructured output from tests. To prepare for remote execution, we make the following changes: 1. Update `TestLogScope` to use `TEST_UNDECLARED_OUTPUTS_DIR` where appropriate. 2. Add a new function `datapathutils.DebuggableTempDir()` which returns either `TEST_UNDECLARED_OUTPUTS_DIR` or os.TempDir() as appropriate. Since the outputs.zip behavior is kind of awkward, we guard this behind the environment variable `REMOTE_EXEC`. We must be sure to set this variable whenever we run tests remotely. Epic: CRDB-17165 Release note: None Co-authored-by: Ricky Stewart <ricky@cockroachlabs.com>
- Loading branch information
Showing
3 changed files
with
54 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters