From 55b6cd4333071949c60b9e52b6b201b09e837a4d Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 13 Sep 2020 19:03:51 +0200 Subject: pkg/runtest: test parsing of all tests Currently we only test parsing in tools/syz-runtest and for test OS in pkg/runtest tests. This means errors in tests for other OSes won't be noticed until somebody runs tests manually. Test parsing of all tests in pkg/runtest tests. Fix up 2 broken tests. --- tools/syz-runtest/runtest.go | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) (limited to 'tools') diff --git a/tools/syz-runtest/runtest.go b/tools/syz-runtest/runtest.go index e7b41be62..d961dc867 100644 --- a/tools/syz-runtest/runtest.go +++ b/tools/syz-runtest/runtest.go @@ -15,7 +15,6 @@ import ( "net" "os" "path/filepath" - "strings" "sync" "time" @@ -47,10 +46,6 @@ 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) @@ -121,7 +116,7 @@ func main() { fmt.Printf("%-24v: %v calls enabled\n", sandbox+" sandbox", len(calls)) } ctx := &runtest.Context{ - Dir: testDir, + Dir: filepath.Join(cfg.Syzkaller, "sys", target.OS, "test"), Target: target, Features: mgr.checkResult.Features, EnabledCalls: enabledCalls, @@ -288,25 +283,3 @@ 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 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 - } - } - return nil -} -- cgit mrf-deployment