Commit 540bdf92 by Ben Clayton

Regres: Add new run_testlist flags

`shuffle` will randomize the order in which the tests are run. `limit` will run (post-shuffle) at most this number of tests. `no-results` will disable emission of the `results.json` file. These are useful for testing a random subset of the filtered test list. Change-Id: Ied54b4fd57c9e02fa6a9e63b808417fdc8f73a43 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42710Tested-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 3decd1af
...@@ -25,6 +25,7 @@ import ( ...@@ -25,6 +25,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"log" "log"
"math/rand"
"os" "os"
"path/filepath" "path/filepath"
"regexp" "regexp"
...@@ -44,6 +45,9 @@ var ( ...@@ -44,6 +45,9 @@ var (
maxProcMemory = flag.Uint64("max-proc-mem", shell.MaxProcMemory, "maximum virtual memory per child process") maxProcMemory = flag.Uint64("max-proc-mem", shell.MaxProcMemory, "maximum virtual memory per child process")
output = flag.String("output", "results.json", "path to an output JSON results file") output = flag.String("output", "results.json", "path to an output JSON results file")
filter = flag.String("filter", "", "filter for test names. Start with a '/' to indicate regex") filter = flag.String("filter", "", "filter for test names. Start with a '/' to indicate regex")
limit = flag.Int("limit", 0, "only run a maximum of this number of tests")
shuffle = flag.Bool("shuffle", false, "shuffle tests")
noResults = flag.Bool("no-results", false, "disable generation of results.json file")
) )
const testTimeout = time.Minute * 2 const testTimeout = time.Minute * 2
...@@ -70,10 +74,19 @@ func run() error { ...@@ -70,10 +74,19 @@ func run() error {
} }
} }
testLists := testlist.Lists{group}
shell.MaxProcMemory = *maxProcMemory shell.MaxProcMemory = *maxProcMemory
if *shuffle {
rnd := rand.New(rand.NewSource(time.Now().UnixNano()))
rnd.Shuffle(len(group.Tests), func(i, j int) { group.Tests[i], group.Tests[j] = group.Tests[j], group.Tests[i] })
}
if *limit != 0 && len(group.Tests) > *limit {
group.Tests = group.Tests[:*limit]
}
log.Printf("Running %d tests...\n", len(group.Tests))
config := deqp.Config{ config := deqp.Config{
ExeEgl: "", ExeEgl: "",
ExeGles2: "", ExeGles2: "",
...@@ -81,12 +94,10 @@ func run() error { ...@@ -81,12 +94,10 @@ func run() error {
ExeVulkan: *deqpVkBinary, ExeVulkan: *deqpVkBinary,
Env: os.Environ(), Env: os.Environ(),
NumParallelTests: *numThreads, NumParallelTests: *numThreads,
TestLists: testLists, TestLists: testlist.Lists{group},
TestTimeout: testTimeout, TestTimeout: testTimeout,
} }
log.Printf("Running %d tests...\n", len(group.Tests))
res, err := config.Run() res, err := config.Run()
if err != nil { if err != nil {
return err return err
...@@ -102,10 +113,12 @@ func run() error { ...@@ -102,10 +113,12 @@ func run() error {
} }
} }
if !*noResults {
err = res.Save(*output) err = res.Save(*output)
if err != nil { if err != nil {
return err return err
} }
}
return nil return nil
} }
......
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