testing: print duration

TODO: account for time taken in Cleanup().
This commit is contained in:
Dan Kegel
2022-01-14 09:25:40 -08:00
committed by Ron Evans
parent 78a36f7724
commit 0ed34e3cb0
3 changed files with 41 additions and 18 deletions
+6
View File
@@ -15,6 +15,7 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"runtime"
"strings"
"sync"
@@ -426,6 +427,11 @@ func runTestWithConfig(name string, t *testing.T, options compileopts.Options, c
actual = bytes.Replace(actual, []byte{0x1b, '[', '0', 'm'}, nil, -1)
actual = bytes.Replace(actual, []byte{'.', '.', '\n'}, []byte{'\n'}, -1)
}
if name == "testing.go" {
// Strip actual time.
re := regexp.MustCompile(`\([0-9]\.[0-9][0-9]s\)`)
actual = re.ReplaceAllLiteral(actual, []byte{'(', '0', '.', '0', '0', 's', ')'})
}
// Check whether the command ran successfully.
fail := false