1
0
mirror of https://github.com/golang/go synced 2024-11-17 15:34:42 -07:00

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 <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Roland Shoemaker 2022-05-12 10:03:25 -07:00 committed by Gopher Robot
parent ece6ac4d4d
commit 7e33e9e7a3

View File

@ -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!")
}
})