You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This proposal is inspired by discussion in #71287.
Many tests use t.TempDir to create a temporary directory. These temporary directories are deleted after a test finishes executing.
It is sometimes useful to examine a test's temporary files when debugging a failure. This currently requires modifying the test to use a non-temporary directory (unless I'm missing something, which is possible).
I propose that we add a new test flag that disables deleting the temporary directories created for failing tests. This would apply to both directories created by t.TempDir and, when the -artifacts flag is not present, t.ArtifactDir. (Assuming #71287 is accepted.)
-keepfail
Keep the temporary directories created by failing tests.
The names of any retained temporary directories will be printed to the test log.
A feature along these lines was suggested in the initial proposal which added TB.TempDir, and rejected on the grounds that we already have too many test flags: #35998 (comment)
I'm sympathetic to the view that we have too many test flags, but TB.TempDir has proven to be extremely useful and adding one more flag to make it more so seems reasonable. Also, I fear that if we don't add a way to preserve temporary directories we'll just be encouraging users to switch to TB.ArtifactDir for temp files so as to have an easy way to retain temporary files on failure. That would be an unfortunate source of unnecessary churn.
The text was updated successfully, but these errors were encountered:
This proposal is inspired by discussion in #71287.
Many tests use
t.TempDir
to create a temporary directory. These temporary directories are deleted after a test finishes executing.It is sometimes useful to examine a test's temporary files when debugging a failure. This currently requires modifying the test to use a non-temporary directory (unless I'm missing something, which is possible).
I propose that we add a new test flag that disables deleting the temporary directories created for failing tests. This would apply to both directories created by
t.TempDir
and, when the-artifacts
flag is not present,t.ArtifactDir
. (Assuming #71287 is accepted.)A feature along these lines was suggested in the initial proposal which added
TB.TempDir
, and rejected on the grounds that we already have too many test flags: #35998 (comment)I'm sympathetic to the view that we have too many test flags, but
TB.TempDir
has proven to be extremely useful and adding one more flag to make it more so seems reasonable. Also, I fear that if we don't add a way to preserve temporary directories we'll just be encouraging users to switch toTB.ArtifactDir
for temp files so as to have an easy way to retain temporary files on failure. That would be an unfortunate source of unnecessary churn.The text was updated successfully, but these errors were encountered: