Skip to content

Commit

Permalink
debugging "fail now" on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdan committed Jun 19, 2024
1 parent 5556500 commit 1aba8f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions testscript/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ func (ts *TestScript) waitBackgroundOne(bgName string) {
}
// Note: ignore bg.neg, which only takes effect on the non-specific
// wait command.
println(ts.file, bg.cmd.ProcessState.Success(), bg.cmd.ProcessState.Exited(), bg.cmd.ProcessState.ExitCode())
if bg.cmd.ProcessState.Success() {
if bg.neg {
ts.Fatalf("unexpected command success")
Expand Down Expand Up @@ -634,6 +635,7 @@ func (ts *TestScript) waitBackground(checkStatus bool) {
if !checkStatus {
continue
}
println(ts.file, bg.cmd.ProcessState.Success(), bg.cmd.ProcessState.Exited(), bg.cmd.ProcessState.ExitCode())
if bg.cmd.ProcessState.Success() {
if bg.neg {
ts.Fatalf("unexpected command success")
Expand Down
3 changes: 3 additions & 0 deletions testscript/testdata/interrupt_implicit.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Let testscript stop signalcatcher at the end of the testscript.

signalcatcher &
7 changes: 6 additions & 1 deletion testscript/testscript.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,12 @@ func (ts *TestScript) run() {
for _, bg := range ts.background {
interruptProcess(bg.cmd.Process)
}
ts.cmdWait(false, nil)
func() {
defer catchFailNow(func() {
failed = true
})
ts.cmdWait(false, nil)
}()

// If we reached here but we've failed (probably because ContinueOnError
// was set), don't wipe the log and print "PASS".
Expand Down

0 comments on commit 1aba8f8

Please sign in to comment.