aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/runtest/run.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-09-06 10:54:14 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-09-06 10:56:09 +0200
commit596466b38cd4e2de23df479ffd78dece9966d875 (patch)
treeade7a76b932f6311f505c4615755a56997411035 /pkg/runtest/run.go
parent873745f2ff183dcbc303a504683ccaa3a472a635 (diff)
pkg/runtest: fixes for fuchsia
Add simple fuchsia program, the one that is run during image testing. Fix csource errno printing for fuchsia. Fix creation of executable files (chmod is not implemented on fuchsia). Check that we get signal/coverage from all syscalls.
Diffstat (limited to 'pkg/runtest/run.go')
-rw-r--r--pkg/runtest/run.go29
1 files changed, 25 insertions, 4 deletions
diff --git a/pkg/runtest/run.go b/pkg/runtest/run.go
index aa090e371..68cd40ca7 100644
--- a/pkg/runtest/run.go
+++ b/pkg/runtest/run.go
@@ -100,7 +100,7 @@ func (ctx *Context) Run() error {
result = "OK"
}
}
- ctx.log("%-36v: %v", req.name, result)
+ ctx.log("%-38v: %v", req.name, result)
}
if err := <-errc; err != nil {
return err
@@ -318,7 +318,7 @@ func (ctx *Context) createSyzTest(p *prog.Prog, sandbox string, threaded, cov bo
}
if cov {
cfg.Flags |= ipc.FlagSignal
- opts.Flags |= ipc.FlagCollectCover | ipc.FlagDedupCover
+ opts.Flags |= ipc.FlagCollectCover
}
if ctx.Features[host.FeatureNetworkInjection].Enabled {
cfg.Flags |= ipc.FlagEnableTun
@@ -373,7 +373,8 @@ func (ctx *Context) createCTest(p *prog.Prog, sandbox string, threaded bool, tim
}
func checkResult(req *RunRequest) error {
- if req.Bin != "" {
+ isC := req.Bin != ""
+ if isC {
var err error
if req.Info, err = parseBinOutput(req); err != nil {
return err
@@ -383,6 +384,7 @@ func checkResult(req *RunRequest) error {
return fmt.Errorf("should repeat %v times, but repeated %v",
req.Repeat, len(req.Info))
}
+ calls := make(map[string]bool)
for run, info := range req.Info {
for i, inf := range info {
want := req.results[i]
@@ -391,7 +393,7 @@ func checkResult(req *RunRequest) error {
ipc.CallBlocked: "blocked",
ipc.CallFinished: "finished",
} {
- if flag == ipc.CallBlocked && req.Bin != "" {
+ if isC && flag == ipc.CallBlocked {
// C code does not detect when a call was blocked.
continue
}
@@ -407,6 +409,25 @@ func checkResult(req *RunRequest) error {
return fmt.Errorf("run %v: wrong call %v result %v, want %v",
run, i, inf.Errno, want.Errno)
}
+ if isC {
+ continue
+ }
+ if req.Cfg.Flags&ipc.FlagSignal != 0 {
+ // Signal is always deduplicated, so we may not get any signal
+ // on a second invocation of the same syscall.
+ callName := req.P.Calls[i].Meta.CallName
+ if len(inf.Signal) < 2 && !calls[callName] {
+ return fmt.Errorf("run %v: call %v: no signal", run, i)
+ }
+ if len(inf.Cover) == 0 {
+ return fmt.Errorf("run %v: call %v: no cover", run, i)
+ }
+ calls[callName] = true
+ } else {
+ if len(inf.Signal) == 0 {
+ return fmt.Errorf("run %v: call %v: no fallback signal", run, i)
+ }
+ }
}
}
return nil