]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: fix TestScript/test_fuzz_mutate_crash for shorter fuzz names
authorRuss Cox <rsc@golang.org>
Mon, 17 Oct 2022 20:25:33 +0000 (16:25 -0400)
committerGopher Robot <gobot@golang.org>
Mon, 17 Oct 2022 20:42:20 +0000 (20:42 +0000)
Fixes longtest builders.

Change-Id: I8b375bcfc91695d5810493b972801df82c6c1b7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/443381
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/cmd/go/testdata/script/test_fuzz_mutate_crash.txt

index d2ded27f856a794793318ef7dceeedb78ea3a841..aa4aa854d0c7a63114dc68865c729aabb5cf63e7 100644 (file)
@@ -20,7 +20,7 @@ go run check_testdata.go FuzzWithBug
 # Now, the failing bytes should have been added to the seed corpus for
 # the target, and should fail when run without fuzzing.
 ! go test
-stdout 'FuzzWithBug/[a-f0-9]{64}'
+stdout 'FuzzWithBug/[a-f0-9]{16}'
 stdout 'this input caused a crash!'
 
 ! go test -run=FuzzWithNilPanic -fuzz=FuzzWithNilPanic -fuzztime=100x -fuzzminimizetime=1000x
@@ -315,7 +315,7 @@ func main() {
        }
        // The hash of the bytes in the file should match the filename.
        h := []byte(fmt.Sprintf("%x", sha256.Sum256(contents)))
-       if !bytes.Equal([]byte(fname), h) {
+       if !bytes.HasPrefix(h, []byte(fname)) {
                fmt.Fprintf(os.Stderr, "hash of bytes %q does not match filename %q\n", h, fname)
                os.Exit(1)
        }