Skip to content

Commit 7e33e9e

Browse files
rolandshoemakergopherbot
authored andcommitted
cmd/go: don't assume decimal in test_fuzz_mutate_crash
In the float test in test_fuzz_mutate_crash, don't assume the mutator will generate a decimal during mutation. The probability it will is quite high, but it is not guaranteed, which can cause a flake. Since we are not really testing that the mutator will do this kind of mutation, just that a mutation happens, just check that the input is not the zero value like the rest of the targets. Fixes golang#52852 Change-Id: I4640be640204ced01b4dc749c74b46da968ea7df Reviewed-on: https://go-review.googlesource.com/c/go/+/405855 Run-TryBot: Bryan Mills <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Auto-Submit: Roland Shoemaker <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent ece6ac4 commit 7e33e9e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/cmd/go/testdata/script/test_fuzz_mutate_crash.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,7 @@ func FuzzBool(f *testing.F) {
241241

242242
func FuzzFloat(f *testing.F) {
243243
f.Fuzz(func(t *testing.T, a float64) {
244-
if a != float64(int64(a)) {
245-
// It has a decimal, so it was mutated by division
244+
if a != 0 {
246245
panic("this input caused a crash!")
247246
}
248247
})

0 commit comments

Comments
 (0)