pkg/runtest: allow to select a subset of tests to run

This commit is contained in:
Dmitry Vyukov 2020-07-13 10:57:31 +02:00
parent e2f6c0c1b5
commit 6b24f02a11

View File

@ -4,6 +4,7 @@
package runtest
import (
"flag"
"os"
"path/filepath"
"runtime"
@ -16,6 +17,11 @@ import (
_ "github.com/google/syzkaller/sys/test/gen" // pull in the test target
)
// Can be used as:
// go test -v -run=Test/64_fork ./pkg/runtest -filter=nonfailing
// to select a subset of tests to run.
var flagFilter = flag.String("filter", "", "prefix to match test file names")
func Test(t *testing.T) {
switch runtime.GOOS {
case "openbsd":
@ -74,6 +80,7 @@ func test(t *testing.T, sysTarget *targets.Target) {
ctx := &Context{
Dir: filepath.Join("..", "..", "sys", target.OS, "test"),
Target: target,
Tests: *flagFilter,
Features: features,
EnabledCalls: enabledCalls,
Requests: requests,