aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-12-10 15:10:33 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-12-10 16:37:02 +0100
commitc7ba317e9bfa7672d851df1217c2c3ea045c55f1 (patch)
tree8ccc14054d803776a152a4603c7bfff6576e382b /tools
parent593b260b0233013ce7bbd5acf39263ab83244a14 (diff)
tools/syz-runtest: test program parsing before booting VMs
It sucks to wait for VMs to boot just to discover that programs don't parse.
Diffstat (limited to 'tools')
-rw-r--r--tools/syz-runtest/runtest.go23
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/syz-runtest/runtest.go b/tools/syz-runtest/runtest.go
index c1a1525d2..a84bc005d 100644
--- a/tools/syz-runtest/runtest.go
+++ b/tools/syz-runtest/runtest.go
@@ -15,6 +15,7 @@ import (
"net"
"os"
"path/filepath"
+ "strings"
"sync"
"time"
@@ -44,6 +45,10 @@ func main() {
if err != nil {
log.Fatal(err)
}
+ testDir := filepath.Join(cfg.Syzkaller, "sys", target.OS, "test")
+ if err := testParsing(target, testDir); err != nil {
+ log.Fatal(err)
+ }
vmPool, err := vm.Create(cfg, *flagDebug)
if err != nil {
log.Fatal(err)
@@ -111,7 +116,7 @@ func main() {
fmt.Printf("%-24v: %v calls enabled\n", sandbox+" sandbox", len(calls))
}
ctx := &runtest.Context{
- Dir: filepath.Join(cfg.Syzkaller, "sys", target.OS, "test"),
+ Dir: testDir,
Target: target,
Features: mgr.checkResult.Features,
EnabledCalls: enabledCalls,
@@ -268,3 +273,19 @@ func (mgr *Manager) Done(a *rpctype.RunTestDoneArgs, r *int) error {
close(req.Done)
return nil
}
+
+func testParsing(target *prog.Target, dir string) error {
+ files, err := ioutil.ReadDir(dir)
+ if err != nil {
+ return fmt.Errorf("failed to read %v: %v", dir, err)
+ }
+ for _, file := range files {
+ if strings.HasSuffix(file.Name(), "~") {
+ continue
+ }
+ if err := runtest.TestParseProg(target, dir, file.Name()); err != nil {
+ return err
+ }
+ }
+ return nil
+}