From 7e33e9e7a39de0dc384f65ddc17c00bdedf85b81 Mon Sep 17 00:00:00 2001 From: Roland Shoemaker Date: Thu, 12 May 2022 10:03:25 -0700 Subject: [PATCH] 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 #52852 Change-Id: I4640be640204ced01b4dc749c74b46da968ea7df Reviewed-on: https://go-review.googlesource.com/c/go/+/405855 Run-TryBot: Bryan Mills Reviewed-by: Bryan Mills Auto-Submit: Roland Shoemaker TryBot-Result: Gopher Robot --- src/cmd/go/testdata/script/test_fuzz_mutate_crash.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cmd/go/testdata/script/test_fuzz_mutate_crash.txt b/src/cmd/go/testdata/script/test_fuzz_mutate_crash.txt index 99bae1daf0..d2ded27f85 100644 --- a/src/cmd/go/testdata/script/test_fuzz_mutate_crash.txt +++ b/src/cmd/go/testdata/script/test_fuzz_mutate_crash.txt @@ -241,8 +241,7 @@ func FuzzBool(f *testing.F) { func FuzzFloat(f *testing.F) { f.Fuzz(func(t *testing.T, a float64) { - if a != float64(int64(a)) { - // It has a decimal, so it was mutated by division + if a != 0 { panic("this input caused a crash!") } }) -- 2.50.0