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 fc47985
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
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
4 changes: 4 additions & 0 deletions testscript/testdata/interrupt_implicit.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Let testscript stop signalcatcher at the end of the testscript.

signalcatcher &
waitfile catchsignal
6 changes: 6 additions & 0 deletions testscript/testscript.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,12 @@ func (ts *TestScript) run() {
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 fc47985

Please sign in to comment.