-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testscript: provide WorkdirRoot as a new Params field (#87)
Via testscript.Params.TestWork, it is possible for the caller to prevent the work directories for scripts from being removed once complete. However the work directories for testscripts are created under a temporary directory and that working directory is not returned to the caller of testscript.Run. This makes it impossible for the caller to programmatically know where the resulting scripts are. We therefore provide testscript.Params.WorkdirRoot. WorkdirRoot specifies the directory within which scripts' work directories will be created. Setting WorkdirRoot implies TestWork=true. If empty, the work directories will be created inside $GOTMPDIR/go-test-script*, where $GOTMPDIR defaults to os.TempDir(). Also fix a bug whereby the value of $WORK was not printed as part of the verbose mode env when Params.TestWork was specified. i.e. it was impossible to see what the working directory was because all instances of the working directory value are replaced with the literal $WORK.
- Loading branch information
Showing
3 changed files
with
46 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Intentionally empty test script; used to test Params.WorkdirRoot | ||
|
||
-- README.md -- | ||
This file exists so that a test for Params.WorkdirRoot can verify the existence of a file | ||
within WorkdirRoot/script-nothing once scripts have finished. |
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