aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2019-09-05 19:40:50 +0200
committerAndrey Konovalov <andreyknvl@gmail.com>2019-09-17 15:58:29 +0200
commitd62be7809cc2ee034ae2d22665d79cb13a910582 (patch)
treee4e6e200ced04d43ae9609cf2e847a902ee6b027
parentd555ee7ed18477ef796885f2988f9185f02f666c (diff)
runtest: add a flag to specify tests to run
-rw-r--r--pkg/runtest/run.go4
-rw-r--r--tools/syz-runtest/runtest.go5
2 files changed, 9 insertions, 0 deletions
diff --git a/pkg/runtest/run.go b/pkg/runtest/run.go
index 46a3f09cb..e380ad490 100644
--- a/pkg/runtest/run.go
+++ b/pkg/runtest/run.go
@@ -59,6 +59,7 @@ type Context struct {
LogFunc func(text string)
Retries int // max number of test retries to deal with flaky tests
Verbose bool
+ Tests string // prefix to match test file names
}
func (ctx *Context) log(msg string, args ...interface{}) {
@@ -172,6 +173,9 @@ func (ctx *Context) generatePrograms(progs chan *RunRequest) error {
if strings.HasSuffix(file.Name(), ".swp") {
continue
}
+ if !strings.HasPrefix(file.Name(), ctx.Tests) {
+ continue
+ }
p, requires, results, err := ctx.parseProg(file.Name())
if err != nil {
return err
diff --git a/tools/syz-runtest/runtest.go b/tools/syz-runtest/runtest.go
index 61b89a809..538646a2b 100644
--- a/tools/syz-runtest/runtest.go
+++ b/tools/syz-runtest/runtest.go
@@ -33,6 +33,7 @@ import (
var (
flagConfig = flag.String("config", "", "manager config")
flagDebug = flag.Bool("debug", false, "debug mode")
+ flagTests = flag.String("tests", "", "prefix to match test file names")
)
func main() {
@@ -123,6 +124,7 @@ func main() {
Requests: mgr.requests,
LogFunc: func(text string) { fmt.Println(text) },
Verbose: false,
+ Tests: *flagTests,
}
err = ctx.Run()
close(vm.Shutdown)
@@ -287,6 +289,9 @@ func testParsing(target *prog.Target, dir string) error {
if strings.HasSuffix(file.Name(), ".swp") {
continue
}
+ if !strings.HasPrefix(file.Name(), *flagTests) {
+ continue
+ }
if err := runtest.TestParseProg(target, dir, file.Name()); err != nil {
return err
}