Run the fuzz test with bash and zsh

This commit is contained in:
David Dworken 2022-09-22 23:12:41 -07:00
parent d2254d5275
commit 1df50731be

View File

@ -1648,21 +1648,10 @@ type operation struct {
cmd string
}
func FuzzTestMultipleUsers(f *testing.F) {
f.Add("a;b|2\n")
f.Add("a;b|aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n")
f.Add("a;b|aaaBBcccDD\n")
f.Add("a;a|hello\na;a|world")
f.Add("a;a|hello\na;a|world\na;b|3")
f.Add("a;a|1\na;a|2\na;b|3\nb;a|4\na;b|5")
f.Add("a;a|1\na;a|2\na;b|1\n")
f.Add("a;a|1\na;a|2\na;b|1\nz;z|1\na;a|1\n")
f.Add("a;a|hello\na;a|wobld")
f.Add("a;a|1\nb;a|2\nc;a|2\nd;a|2\na;b|2\na;b|3\na;b|4\na;b|8\na;d|2\nb;a|1")
f.Add("a;a|1\na;b|1\na;c|1\na;d|1\na;e|1\na;f|1\na;g|1\na;b|1\na;b|1\na;b|1\na;b|1")
tmp := 0
var tmp int = 0
var runCounter *int = &tmp
f.Fuzz(func(t *testing.T, input string) {
func fuzzTest(t *testing.T, tester shellTester, input string) {
*runCounter += 1
// Parse the input
if len(input) > 1_000 {
@ -1694,7 +1683,6 @@ func FuzzTestMultipleUsers(f *testing.F) {
// Set up and create the devices
defer shared.BackupAndRestore(t)()
tester := bashTester{}
var deviceMap map[device]deviceOp = make(map[device]deviceOp)
var devices deviceSet = deviceSet{}
devices.deviceMap = &deviceMap
@ -1744,6 +1732,24 @@ func FuzzTestMultipleUsers(f *testing.F) {
t.Fatalf("hishtory export mismatch for key=%s (-expected +got):\n%s\nout=%#v", op.device.key, diff, out)
}
}
}
func FuzzTestMultipleUsers(f *testing.F) {
f.Add("a;b|2\n")
f.Add("a;b|aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n")
f.Add("a;b|aaaBBcccDD\n")
f.Add("a;a|hello\na;a|world")
f.Add("a;a|hello\na;a|world\na;b|3")
f.Add("a;a|1\na;a|2\na;b|3\nb;a|4\na;b|5")
f.Add("a;a|1\na;a|2\na;b|1\n")
f.Add("a;a|1\na;a|2\na;b|1\nz;z|1\na;a|1\n")
f.Add("a;a|hello\na;a|wobld")
f.Add("a;a|hello\na;a|hello")
f.Add("a;a|1\nb;a|2\nc;a|2\nd;a|2\na;b|2\na;b|3\na;b|4\na;b|8\na;d|2\nb;a|1")
f.Add("a;a|1\na;b|1\na;c|1\na;d|1\na;e|1\na;f|1\na;g|1\na;b|1\na;b|1\na;b|1\na;b|1")
f.Fuzz(func(t *testing.T, input string) {
fuzzTest(t, bashTester{}, input)
fuzzTest(t, zshTester{}, input)
})
}