mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
test: Update fuzz tests to use the built-in infrastructure
Go 1.18 supports fuzzing natively, so this patch migrates our fuzzing tests to make use of it.
This commit is contained in:
@@ -285,3 +285,10 @@ func TestReload(t *testing.T) {
|
||||
t.Errorf("unexpected error reloading wrapped backend: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Fuzz testing for the response decoder, which handles user-provided data.
|
||||
func FuzzDecodeResponse(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, response string) {
|
||||
DecodeResponse(response)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
// Fuzz testing for package aliases.
|
||||
|
||||
//go:build gofuzz
|
||||
// +build gofuzz
|
||||
|
||||
package auth
|
||||
|
||||
func Fuzz(data []byte) int {
|
||||
// user, domain, passwd, err := DecodeResponse(string(data))
|
||||
interesting := 0
|
||||
_, _, _, err := DecodeResponse(string(data))
|
||||
if err == nil {
|
||||
interesting = 1
|
||||
}
|
||||
|
||||
return interesting
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("@\xed\x88̥̥̥̥̥̥̄̈́̈́̈́̈́̈́̈́̈́̈́ͥ̈́̈́ͥ̓\x00\x00")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("AHVAZABwYXNz")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("dUBkAHVAZABwYXNz")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("\xeb̥̥̥̥̥̥̥̈́ͥ̈́̈́̈́̈́̈́̈́̈́̈́̈́ͥ̓@\x00\x00")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("this is not base64 encoded")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("\xeb̥̥̥̥̥̥ͯ̈́̈́̈́̈́̈́ͯ̈́̈́̈́̈́̈́̈́@\x00\x00")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("\xeb̥̥̥̥̥̥̈́̈́̈́̈́̈́ͯ̈́̈́̈́̈́̈́̈́̈́@\x00\x00")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("dUBkAABwYXNz")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("w7FhY2FAw7FlcXVlAABjbGF2YXLDqQ==")
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
string("dUBkAABwYXNz/w==")
|
||||
1
internal/auth/testdata/fuzz/corpus/t-001
vendored
1
internal/auth/testdata/fuzz/corpus/t-001
vendored
@@ -1 +0,0 @@
|
||||
dUBkAHVAZABwYXNz
|
||||
1
internal/auth/testdata/fuzz/corpus/t-002
vendored
1
internal/auth/testdata/fuzz/corpus/t-002
vendored
@@ -1 +0,0 @@
|
||||
dUBkAABwYXNz
|
||||
1
internal/auth/testdata/fuzz/corpus/t-003
vendored
1
internal/auth/testdata/fuzz/corpus/t-003
vendored
@@ -1 +0,0 @@
|
||||
AHVAZABwYXNz
|
||||
1
internal/auth/testdata/fuzz/corpus/t-004
vendored
1
internal/auth/testdata/fuzz/corpus/t-004
vendored
@@ -1 +0,0 @@
|
||||
dUBkAABwYXNz/w==
|
||||
1
internal/auth/testdata/fuzz/corpus/t-005
vendored
1
internal/auth/testdata/fuzz/corpus/t-005
vendored
@@ -1 +0,0 @@
|
||||
w7FhY2FAw7FlcXVlAABjbGF2YXLDqQ==
|
||||
1
internal/auth/testdata/fuzz/corpus/t-006
vendored
1
internal/auth/testdata/fuzz/corpus/t-006
vendored
@@ -1 +0,0 @@
|
||||
this is not base64 encoded
|
||||
BIN
internal/auth/testdata/fuzz/corpus/x-001
vendored
BIN
internal/auth/testdata/fuzz/corpus/x-001
vendored
Binary file not shown.
BIN
internal/auth/testdata/fuzz/corpus/x-002
vendored
BIN
internal/auth/testdata/fuzz/corpus/x-002
vendored
Binary file not shown.
BIN
internal/auth/testdata/fuzz/corpus/x-003
vendored
BIN
internal/auth/testdata/fuzz/corpus/x-003
vendored
Binary file not shown.
BIN
internal/auth/testdata/fuzz/corpus/x-004
vendored
BIN
internal/auth/testdata/fuzz/corpus/x-004
vendored
Binary file not shown.
Reference in New Issue
Block a user