mirror of https://github.com/golang/go.git
internal/lsp/regtest: only print RPC logs if asked
Sometimes one wants to run the regtests with verbose output without seeing the wall of RPC logs. Add a new flag to control the printing of logs, rather than overloading testing.Verbose(). Change-Id: Iea5727e3079005d229319cbf86f67067f7c1f85d Reviewed-on: https://go-review.googlesource.com/c/tools/+/405894 gopls-CI: kokoro <noreply+kokoro@google.com> Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Suzy Mueller <suzmue@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
44db4ebc77
commit
b55ed5ed4d
|
|
@ -26,6 +26,7 @@ var (
|
|||
regtestTimeout = flag.Duration("regtest_timeout", defaultRegtestTimeout(), "if nonzero, default timeout for each regtest; defaults to GOPLS_REGTEST_TIMEOUT")
|
||||
skipCleanup = flag.Bool("regtest_skip_cleanup", false, "whether to skip cleaning up temp directories")
|
||||
printGoroutinesOnFailure = flag.Bool("regtest_print_goroutines", false, "whether to print goroutines info on failure")
|
||||
printLogs = flag.Bool("regtest_print_logs", false, "whether to print LSP logs")
|
||||
)
|
||||
|
||||
func defaultRegtestTimeout() time.Duration {
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ func (r *Runner) Run(t *testing.T, files string, test TestFunc, opts ...RunOptio
|
|||
if t.Failed() && r.PrintGoroutinesOnFailure {
|
||||
pprof.Lookup("goroutine").WriteTo(os.Stderr, 1)
|
||||
}
|
||||
if t.Failed() || testing.Verbose() {
|
||||
if t.Failed() || *printLogs {
|
||||
ls.printBuffers(t.Name(), os.Stderr)
|
||||
}
|
||||
// For tests that failed due to a timeout, don't fail to shutdown
|
||||
|
|
|
|||
Loading…
Reference in New Issue