]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: don't assume decimal in test_fuzz_mutate_crash
authorRoland Shoemaker <roland@golang.org>
Thu, 12 May 2022 17:03:25 +0000 (10:03 -0700)
committerGopher Robot <gobot@golang.org>
Fri, 13 May 2022 16:22:05 +0000 (16:22 +0000)
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>

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

index 99bae1daf07a1d09cdc4b95bdd8ba24091bbbce0..d2ded27f856a794793318ef7dceeedb78ea3a841 100644 (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!")
                }
        })