aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-09-13 19:03:51 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-09-13 19:28:47 +0200
commit55b6cd4333071949c60b9e52b6b201b09e837a4d (patch)
tree5394ece15614aedea4c7b47fea14534e07477c23 /tools
parentc52d06e41031046b8e2a1782418fbd85f469455c (diff)
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.
Diffstat (limited to 'tools')
-rw-r--r--tools/syz-runtest/runtest.go29
1 files changed, 1 insertions, 28 deletions
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
-}