aboutsummaryrefslogtreecommitdiffstats
path: root/prog/minimization_test.go
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2018-11-15 20:16:20 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-11-21 05:30:44 +0100
commit5a0d6e039dc1a8bdf3e14650f0eb106e0196e178 (patch)
tree671299895fb86020f1ee8f2210c9d5158d3542ae /prog/minimization_test.go
parent846317099cc35cf590d6bea9950ca5e8ce51664d (diff)
prog: try to nullify pointers when minimizing
This patch changes minimization routines to try assigning a.Res to nil for each pointer arg.
Diffstat (limited to 'prog/minimization_test.go')
-rw-r--r--prog/minimization_test.go26
1 files changed, 23 insertions, 3 deletions
diff --git a/prog/minimization_test.go b/prog/minimization_test.go
index d41663e70..a34ce1f3a 100644
--- a/prog/minimization_test.go
+++ b/prog/minimization_test.go
@@ -47,7 +47,7 @@ func TestMinimize(t *testing.T) {
return len(p.Calls) == 2 && p.Calls[0].Meta.Name == "mmap" && p.Calls[1].Meta.Name == "pipe2"
},
"mmap(&(0x7f0000000000/0x1000)=nil, 0x1000, 0x0, 0x10, 0xffffffffffffffff, 0x0)\n" +
- "pipe2(&(0x7f0000000000), 0x0)\n",
+ "pipe2(0x0, 0x0)\n",
1,
},
// Remove two dependent calls.
@@ -80,7 +80,7 @@ func TestMinimize(t *testing.T) {
return p.String() == "mmap-write-sched_yield"
},
"mmap(&(0x7f0000000000/0x1000)=nil, 0x1000, 0x0, 0x10, 0xffffffffffffffff, 0x0)\n" +
- "write(0xffffffffffffffff, &(0x7f0000000000), 0x0)\n" +
+ "write(0xffffffffffffffff, 0x0, 0x0)\n" +
"sched_yield()\n",
2,
},
@@ -95,10 +95,30 @@ func TestMinimize(t *testing.T) {
return p.String() == "mmap-write-sched_yield"
},
"mmap(&(0x7f0000000000/0x1000)=nil, 0x1000, 0x0, 0x10, 0xffffffffffffffff, 0x0)\n" +
- "write(0xffffffffffffffff, &(0x7f0000000000), 0x0)\n" +
+ "write(0xffffffffffffffff, 0x0, 0x0)\n" +
"sched_yield()\n",
-1,
},
+ // Minimize pointer.
+ {
+ "pipe2(&(0x7f0000001000)={0xffffffffffffffff, 0xffffffffffffffff}, 0x0)\n",
+ -1,
+ func(p *Prog, callIndex int) bool {
+ return len(p.Calls) == 1 && p.Calls[0].Meta.Name == "pipe2"
+ },
+ "pipe2(0x0, 0x0)\n",
+ -1,
+ },
+ // Minimize pointee.
+ {
+ "pipe2(&(0x7f0000001000)={0xffffffffffffffff, 0xffffffffffffffff}, 0x0)\n",
+ -1,
+ func(p *Prog, callIndex int) bool {
+ return len(p.Calls) == 1 && p.Calls[0].Meta.Name == "pipe2" && p.Calls[0].Args[0].(*PointerArg).Address != 0
+ },
+ "pipe2(&(0x7f0000001000), 0x0)\n",
+ -1,
+ },
}
target, _, _ := initTest(t)
for ti, test := range tests {