diff options
author | David Benjamin <davidben@google.com> | 2016-07-29 01:04:43 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2016-07-29 03:08:20 +0300 |
commit | 17e1292fe43cf96fbdd633a686d718ef44ceceee (patch) | |
tree | 853ad382eab1e0c58962f0eefc901c40cc2f4b84 | |
parent | 4497e589616910b42d5fa8b84b9c5059fb9d9f42 (diff) |
Make runner's -test parameter take glob patterns.
Per request from EKR. Also we have a lot of long test names, so this
seems generally a good idea.
Change-Id: Ie463f5367ec7d33005137534836005b571c8f424
Reviewed-on: https://boringssl-review.googlesource.com/9021
Reviewed-by: Adam Langley <agl@google.com>
-rw-r--r-- | ssl/test/runner/runner.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/ssl/test/runner/runner.go b/ssl/test/runner/runner.go index cde55926..bfd9faf3 100644 --- a/ssl/test/runner/runner.go +++ b/ssl/test/runner/runner.go @@ -31,6 +31,7 @@ import ( "os" "os/exec" "path" + "path/filepath" "runtime" "strconv" "strings" @@ -48,7 +49,7 @@ var ( mallocTestDebug = flag.Bool("malloc-test-debug", false, "If true, ask bssl_shim to abort rather than fail a malloc. This can be used with a specific value for --malloc-test to identity the malloc failing that is causing problems.") jsonOutput = flag.String("json-output", "", "The file to output JSON results to.") pipe = flag.Bool("pipe", false, "If true, print status output suitable for piping into another program.") - testToRun = flag.String("test", "", "The name of a test to run, or empty to run all tests") + testToRun = flag.String("test", "", "The pattern to filter tests to run, or empty to run all tests") numWorkers = flag.Int("num-workers", runtime.NumCPU(), "The number of workers to run in parallel.") shimPath = flag.String("shim-path", "../../../build/ssl/test/bssl_shim", "The location of the shim binary.") resourceDir = flag.String("resource-dir", ".", "The directory in which to find certificate and key files.") @@ -7828,13 +7829,24 @@ func main() { var foundTest bool for i := range testCases { - if len(*testToRun) == 0 || *testToRun == testCases[i].name { + matched := true + if len(*testToRun) != 0 { + var err error + matched, err = filepath.Match(*testToRun, testCases[i].name) + if err != nil { + fmt.Fprintf(os.Stderr, "Error matching pattern: %s\n", err) + os.Exit(1) + } + } + + if matched { foundTest = true testChan <- &testCases[i] } } + if !foundTest { - fmt.Fprintf(os.Stderr, "No test named '%s'\n", *testToRun) + fmt.Fprintf(os.Stderr, "No tests matched %q\n", *testToRun) os.Exit(1) } |