Skip to content

Commit

Permalink
logictest: improve progress output
Browse files Browse the repository at this point in the history
Logictests would print some progress messages to stdout as they run.
Each file prints when it ends and, while it's running, it prints
messages when statements finish successfully (but only up to once per
2s). This patch adds a second-level timestamp to those messages, in
order to provide more clues in the output of timed out logictest
packages. Otherwise, I'm always left guessing if the package had been
making constant progress until the timeout, or if it got stuck at some
point.

Release note: None
  • Loading branch information
andreimatei committed Jan 22, 2022
1 parent 90db97c commit 3145a90
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/sql/logictest/logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -1325,11 +1325,13 @@ func (t *logicTest) close() {
// out emits a message both on stdout and the log files if
// verbose is set.
func (t *logicTest) outf(format string, args ...interface{}) {
if t.verbose {
fmt.Printf(format, args...)
fmt.Println()
log.Infof(context.Background(), format, args...)
if !t.verbose {
return
}
log.Infof(context.Background(), format, args...)
msg := fmt.Sprintf(format, args...)
now := timeutil.Now().Format("15:04:05")
fmt.Printf("[%s] %s\n", now, msg)
}

// setUser sets the DB client to the specified user.
Expand Down

0 comments on commit 3145a90

Please sign in to comment.