-
Notifications
You must be signed in to change notification settings - Fork 17.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testing: show in-progress tests upon SIGINT
Because of parallel tests, which have stalled executions, the RUN output of a test can be much earlier than its completion output resulting in hard-to-read verbose output. The tests are displayed in the order in which the output shows that they began, to make it easy to line up with the "RUN" output. Similarly, the definitions of when tests begin and complete is determined by when RUN and FAIL/SKIP/PASS are output since the focus of this code is on enhancing readability. Fixes #19397 Change-Id: I4d0ca3fd268b620484e7a190117f79a33b3dc461 Reviewed-on: https://go-review.googlesource.com/44352 Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
- Loading branch information
1 parent
760636d
commit 11c61eb
Showing
7 changed files
with
123 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
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,40 @@ | ||
// Copyright 2017 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
package inprogress_interrupt_test | ||
|
||
import ( | ||
"os" | ||
"os/signal" | ||
"sync" | ||
"syscall" | ||
"testing" | ||
) | ||
|
||
func TestParallel(t *testing.T) { | ||
t.Parallel() | ||
} | ||
|
||
func TestSerial(t *testing.T) { | ||
sigCh := make(chan os.Signal, 1) | ||
signal.Notify(sigCh, os.Interrupt) | ||
|
||
var wg sync.WaitGroup | ||
wg.Add(1) | ||
go func() { | ||
<-sigCh // catch initial signal | ||
<-sigCh // catch propagated signal | ||
wg.Done() | ||
}() | ||
|
||
proc, err := os.FindProcess(syscall.Getpid()) | ||
if err != nil { | ||
t.Fatalf("unable to find current process: %v", err) | ||
} | ||
err = proc.Signal(os.Interrupt) | ||
if err != nil { | ||
t.Fatalf("failed to interrupt current process: %v", err) | ||
} | ||
|
||
wg.Wait() | ||
} |
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
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
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