aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ipc
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-02-20 10:54:03 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-02-20 10:54:03 +0100
commitc8e73b95c61fa26c0f6c2d0b96dee38ba1b13958 (patch)
tree6383958a3a66477c92ad15a426d82de02b7ccf08 /pkg/ipc
parentc1f526e3e53eb3a29ad71b866b67ec0c2bab5e82 (diff)
sys/linux: fix mmap call args
Also add a test for this.
Diffstat (limited to 'pkg/ipc')
-rw-r--r--pkg/ipc/ipc_test.go22
1 files changed, 15 insertions, 7 deletions
diff --git a/pkg/ipc/ipc_test.go b/pkg/ipc/ipc_test.go
index b4648f9a7..03de4ebf1 100644
--- a/pkg/ipc/ipc_test.go
+++ b/pkg/ipc/ipc_test.go
@@ -63,7 +63,7 @@ func initTest(t *testing.T) (*prog.Target, rand.Source, int, EnvFlags) {
return target, rs, iters, flags
}
-func TestEmptyProg(t *testing.T) {
+func TestSimpleProg(t *testing.T) {
target, _, _, flags0 := initTest(t)
bin := buildExecutor(t, target)
@@ -79,19 +79,27 @@ func TestEmptyProg(t *testing.T) {
t.Fatalf("failed to create env: %v", err)
}
defer env.Close()
-
- p := new(prog.Prog)
+ p := target.GenerateSimpleProg()
opts := &ExecOpts{}
- output, _, failed, hanged, err := env.Exec(opts, p)
+ output, info, failed, hanged, err := env.Exec(opts, p)
if err != nil {
t.Fatalf("failed to run executor: %v", err)
}
+ if hanged {
+ t.Fatalf("program hanged:\n%s", output)
+ }
+ if failed {
+ t.Fatalf("program failed:\n%s", output)
+ }
+ if len(info) == 0 {
+ t.Fatalf("no calls executed:\n%s", output)
+ }
+ if info[0].Errno != 0 {
+ t.Fatalf("simple call failed: %v\n%s", info[0].Errno, output)
+ }
if len(output) != 0 {
t.Fatalf("output on empty program")
}
- if failed || hanged {
- t.Fatalf("empty program failed")
- }
}
func TestExecute(t *testing.T) {