Skip to content

Commit 3a8b9cf

Browse files
committed
testing: add PAUSE, CONT output lines to explain Parallel execution
This should make parallel execution a bit clearer. With -p=1 it should make the execution completely unambiguous. Fixes #19280. Change-Id: Ib48cdfe96896d01b0d8f98ccb2fab614407a7d92 Reviewed-on: https://go-review.googlesource.com/49430 Run-TryBot: Russ Cox <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent f14f7b3 commit 3a8b9cf

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/testing/testing.go

+21
Original file line numberDiff line numberDiff line change
@@ -675,9 +675,30 @@ func (t *T) Parallel() {
675675
t.parent.sub = append(t.parent.sub, t)
676676
t.raceErrors += race.Errors()
677677

678+
if t.chatty {
679+
// Print directly to root's io.Writer so there is no delay.
680+
root := t.parent
681+
for ; root.parent != nil; root = root.parent {
682+
}
683+
root.mu.Lock()
684+
fmt.Fprintf(root.w, "=== PAUSE %s\n", t.name)
685+
root.mu.Unlock()
686+
}
687+
678688
t.signal <- true // Release calling test.
679689
<-t.parent.barrier // Wait for the parent test to complete.
680690
t.context.waitParallel()
691+
692+
if t.chatty {
693+
// Print directly to root's io.Writer so there is no delay.
694+
root := t.parent
695+
for ; root.parent != nil; root = root.parent {
696+
}
697+
root.mu.Lock()
698+
fmt.Fprintf(root.w, "=== CONT %s\n", t.name)
699+
root.mu.Unlock()
700+
}
701+
681702
t.start = time.Now()
682703
t.raceErrors += -race.Errors()
683704
}

0 commit comments

Comments
 (0)