aboutsummaryrefslogtreecommitdiffstats
path: root/prog/minimization_test.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2021-09-03 16:20:07 +0000
committerAleksandr Nogikh <wp32pw@gmail.com>2021-09-22 15:40:02 +0200
commit1c202847db0380015a8920bfd21375c2d9f28ddb (patch)
tree6693da3a936398a9ac6678842ac181c5f0e3e429 /prog/minimization_test.go
parenta7ce77be27d8e3728b97122a005bc5b23298cfc3 (diff)
all: refactor fault injection into call props
Now that call properties mechanism is implemented, we can refactor fault injection. Unfortunately, it is impossible to remove all traces of the previous apprach. In reprolist and while performing syz-ci jobs, syzkaller still needs to parse the old format. Remove the old prog options-based approach whenever possible and replace it with the use of call properties.
Diffstat (limited to 'prog/minimization_test.go')
-rw-r--r--prog/minimization_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/prog/minimization_test.go b/prog/minimization_test.go
index 36b65763d..032b2b080 100644
--- a/prog/minimization_test.go
+++ b/prog/minimization_test.go
@@ -149,6 +149,28 @@ func TestMinimize(t *testing.T) {
"minimize$0(0x1, 0xffffffffffffffff)\n",
-1,
},
+ // Clear unneeded fault injection.
+ {
+ "linux", "amd64",
+ "pipe2(0x0, 0x0) (fail_nth: 5)\n",
+ -1,
+ func(p *Prog, callIndex int) bool {
+ return len(p.Calls) == 1 && p.Calls[0].Meta.Name == "pipe2"
+ },
+ "pipe2(0x0, 0x0)\n",
+ -1,
+ },
+ // Keep important fault injection.
+ {
+ "linux", "amd64",
+ "pipe2(0x0, 0x0) (fail_nth: 5)\n",
+ -1,
+ func(p *Prog, callIndex int) bool {
+ return len(p.Calls) == 1 && p.Calls[0].Meta.Name == "pipe2" && p.Calls[0].Props.FailNth == 5
+ },
+ "pipe2(0x0, 0x0) (fail_nth: 5)\n",
+ -1,
+ },
}
t.Parallel()
for ti, test := range tests {