Commit 9d6e6f61 by Ben Clayton

Regres: Post significant changes to test times

Change-Id: I3833a203ae7635845ea3b8ceb5e323565a92be18 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/33487 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com>
parent 4dafba90
...@@ -31,6 +31,7 @@ import ( ...@@ -31,6 +31,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"log" "log"
"math"
"math/rand" "math/rand"
"os" "os"
"os/exec" "os/exec"
...@@ -1115,6 +1116,44 @@ func compare(old, new *CommitTestResults) string { ...@@ -1115,6 +1116,44 @@ func compare(old, new *CommitTestResults) string {
sb.WriteString(fmt.Sprintf("\n--- No change in test results ---\n")) sb.WriteString(fmt.Sprintf("\n--- No change in test results ---\n"))
} }
type timingDiff struct {
old time.Duration
new time.Duration
relDelta float64
name string
}
timingDiffs := []timingDiff{}
for name, new := range new.Tests {
if old, ok := old.Tests[name]; ok {
old, new := old.TimeTaken, new.TimeTaken
delta := new.Seconds() - old.Seconds()
absDelta := math.Abs(delta)
relDelta := delta / old.Seconds()
if absDelta > 2.0 && math.Abs(relDelta) > 0.05 { // If change > ±2s and > than ±5% old time...
timingDiffs = append(timingDiffs, timingDiff{
old: old,
new: new,
name: name,
relDelta: relDelta,
})
}
}
}
if len(timingDiffs) > 0 {
sb.WriteString(fmt.Sprintf("\n--- Test duration changes ---\n"))
const limit = 10
if len(timingDiffs) > limit {
sort.Slice(timingDiffs, func(i, j int) bool { return math.Abs(timingDiffs[i].relDelta) > math.Abs(timingDiffs[j].relDelta) })
timingDiffs = timingDiffs[:limit]
}
sort.Slice(timingDiffs, func(i, j int) bool { return timingDiffs[i].relDelta < timingDiffs[j].relDelta })
for _, d := range timingDiffs {
percent := percent64(int64(d.new-d.old), int64(d.old))
sb.WriteString(fmt.Sprintf(" > %v: %v -> %v (%+d%%)\n", d.name, d.old, d.new, percent))
}
}
return sb.String() return sb.String()
} }
...@@ -1122,6 +1161,7 @@ func compare(old, new *CommitTestResults) string { ...@@ -1122,6 +1161,7 @@ func compare(old, new *CommitTestResults) string {
type TestResult struct { type TestResult struct {
Test string Test string
Status testlist.Status Status testlist.Status
TimeTaken time.Duration
Err string `json:",omitempty"` Err string `json:",omitempty"`
} }
...@@ -1163,6 +1203,7 @@ nextTest: ...@@ -1163,6 +1203,7 @@ nextTest:
"LIBC_FATAL_STDERR_=1", // Put libc explosions into logs. "LIBC_FATAL_STDERR_=1", // Put libc explosions into logs.
} }
start := time.Now()
outRaw, err := shell.Exec(testTimeout, exe, filepath.Dir(exe), env, outRaw, err := shell.Exec(testTimeout, exe, filepath.Dir(exe), env,
"--deqp-surface-type=pbuffer", "--deqp-surface-type=pbuffer",
"--deqp-shadercache=disable", "--deqp-shadercache=disable",
...@@ -1170,6 +1211,7 @@ nextTest: ...@@ -1170,6 +1211,7 @@ nextTest:
"--deqp-log-shader-sources=disable", "--deqp-log-shader-sources=disable",
"--deqp-log-flush=disable", "--deqp-log-flush=disable",
"-n="+name) "-n="+name)
duration := time.Since(start)
out := string(outRaw) out := string(outRaw)
out = strings.ReplaceAll(out, t.srcDir, "<SwiftShader>") out = strings.ReplaceAll(out, t.srcDir, "<SwiftShader>")
out = strings.ReplaceAll(out, exe, "<dEQP>") out = strings.ReplaceAll(out, exe, "<dEQP>")
...@@ -1189,6 +1231,7 @@ nextTest: ...@@ -1189,6 +1231,7 @@ nextTest:
results <- TestResult{ results <- TestResult{
Test: name, Test: name,
Status: test.s, Status: test.s,
TimeTaken: duration,
Err: s, Err: s,
} }
continue nextTest continue nextTest
...@@ -1197,11 +1240,13 @@ nextTest: ...@@ -1197,11 +1240,13 @@ nextTest:
results <- TestResult{ results <- TestResult{
Test: name, Test: name,
Status: testlist.Crash, Status: testlist.Crash,
TimeTaken: duration,
} }
case shell.ErrTimeout: case shell.ErrTimeout:
results <- TestResult{ results <- TestResult{
Test: name, Test: name,
Status: testlist.Timeout, Status: testlist.Timeout,
TimeTaken: duration,
} }
case nil: case nil:
toks := deqpRE.FindStringSubmatch(out) toks := deqpRE.FindStringSubmatch(out)
...@@ -1213,23 +1258,23 @@ nextTest: ...@@ -1213,23 +1258,23 @@ nextTest:
} }
switch toks[1] { switch toks[1] {
case "Pass": case "Pass":
results <- TestResult{Test: name, Status: testlist.Pass} results <- TestResult{Test: name, Status: testlist.Pass, TimeTaken: duration}
case "NotSupported": case "NotSupported":
results <- TestResult{Test: name, Status: testlist.NotSupported} results <- TestResult{Test: name, Status: testlist.NotSupported, TimeTaken: duration}
case "CompatibilityWarning": case "CompatibilityWarning":
results <- TestResult{Test: name, Status: testlist.CompatibilityWarning} results <- TestResult{Test: name, Status: testlist.CompatibilityWarning, TimeTaken: duration}
case "QualityWarning": case "QualityWarning":
results <- TestResult{Test: name, Status: testlist.QualityWarning} results <- TestResult{Test: name, Status: testlist.QualityWarning, TimeTaken: duration}
case "Fail": case "Fail":
var err string var err string
if toks[2] != "Fail" { if toks[2] != "Fail" {
err = toks[2] err = toks[2]
} }
results <- TestResult{Test: name, Status: testlist.Fail, Err: err} results <- TestResult{Test: name, Status: testlist.Fail, Err: err, TimeTaken: duration}
default: default:
err := fmt.Sprintf("Couldn't parse test output:\n%s", out) err := fmt.Sprintf("Couldn't parse test output:\n%s", out)
log.Println("Warning: ", err) log.Println("Warning: ", err)
results <- TestResult{Test: name, Status: testlist.Fail, Err: err} results <- TestResult{Test: name, Status: testlist.Fail, Err: err, TimeTaken: duration}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment