mirror of
https://github.com/golang/go
synced 2024-09-29 12:04:28 -06:00
internal/fuzz: temporarily work around test failures after dev.fuzz merge
- Skip test_fuzz_cache and test_fuzz_seed_corpus on 386. - Skip worker benchmarks when race mode is enabled. - Stub coverage function on platforms we haven't tested yet. It's causing package initialization to panic on aix/ppc64. For #48504 Change-Id: I79318b52b11a33fca66476b5050445d07422ef36 Reviewed-on: https://go-review.googlesource.com/c/go/+/351117 Trust: Jay Conrod <jayconrod@google.com> Trust: Katie Hockman <katie@golang.org> Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
This commit is contained in:
parent
fdf2053d52
commit
2f70ce36d7
@ -1,6 +1,9 @@
|
|||||||
# TODO(jayconrod): support shared memory on more platforms.
|
# TODO(jayconrod): support shared memory on more platforms.
|
||||||
[!darwin] [!linux] [!windows] skip
|
[!darwin] [!linux] [!windows] skip
|
||||||
|
|
||||||
|
# TODO(#48504): fix and re-enable.
|
||||||
|
[linux] [386] skip
|
||||||
|
|
||||||
[short] skip
|
[short] skip
|
||||||
env GOCACHE=$WORK/cache
|
env GOCACHE=$WORK/cache
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
# TODO(jayconrod): support shared memory on more platforms.
|
# TODO(jayconrod): support shared memory on more platforms.
|
||||||
[!darwin] [!linux] [!windows] skip
|
[!darwin] [!linux] [!windows] skip
|
||||||
|
|
||||||
|
# TODO(#48504): fix and re-enable.
|
||||||
|
[linux] [386] skip
|
||||||
|
|
||||||
[short] skip
|
[short] skip
|
||||||
env GOCACHE=$WORK/cache
|
env GOCACHE=$WORK/cache
|
||||||
|
|
||||||
|
29
src/internal/fuzz/counters_supported.go
Normal file
29
src/internal/fuzz/counters_supported.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// Copyright 2021 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build (darwin || linux || windows || freebsd) && (amd64 || arm64)
|
||||||
|
|
||||||
|
package fuzz
|
||||||
|
|
||||||
|
import (
|
||||||
|
"internal/unsafeheader"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// coverage returns a []byte containing unique 8-bit counters for each edge of
|
||||||
|
// the instrumented source code. This coverage data will only be generated if
|
||||||
|
// `-d=libfuzzer` is set at build time. This can be used to understand the code
|
||||||
|
// coverage of a test execution.
|
||||||
|
func coverage() []byte {
|
||||||
|
addr := unsafe.Pointer(&_counters)
|
||||||
|
size := uintptr(unsafe.Pointer(&_ecounters)) - uintptr(addr)
|
||||||
|
|
||||||
|
var res []byte
|
||||||
|
*(*unsafeheader.Slice)(unsafe.Pointer(&res)) = unsafeheader.Slice{
|
||||||
|
Data: addr,
|
||||||
|
Len: int(size),
|
||||||
|
Cap: int(size),
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
16
src/internal/fuzz/counters_unsupported.go
Normal file
16
src/internal/fuzz/counters_unsupported.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// Copyright 2021 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !((darwin || linux || windows || freebsd) && (amd64 || arm64))
|
||||||
|
|
||||||
|
package fuzz
|
||||||
|
|
||||||
|
// TODO(#48504): re-enable on platforms where instrumentation works.
|
||||||
|
// This was disabled due to an init failure on aix_ppc64.
|
||||||
|
|
||||||
|
// coverage returns a []byte containing unique 8-bit counters for each edge of
|
||||||
|
// the instrumented source code. This coverage data will only be generated if
|
||||||
|
// `-d=libfuzzer` is set at build time. This can be used to understand the code
|
||||||
|
// coverage of a test execution.
|
||||||
|
func coverage() []byte { return nil }
|
@ -6,28 +6,9 @@ package fuzz
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"internal/unsafeheader"
|
|
||||||
"math/bits"
|
"math/bits"
|
||||||
"unsafe"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// coverage returns a []byte containing unique 8-bit counters for each edge of
|
|
||||||
// the instrumented source code. This coverage data will only be generated if
|
|
||||||
// `-d=libfuzzer` is set at build time. This can be used to understand the code
|
|
||||||
// coverage of a test execution.
|
|
||||||
func coverage() []byte {
|
|
||||||
addr := unsafe.Pointer(&_counters)
|
|
||||||
size := uintptr(unsafe.Pointer(&_ecounters)) - uintptr(addr)
|
|
||||||
|
|
||||||
var res []byte
|
|
||||||
*(*unsafeheader.Slice)(unsafe.Pointer(&res)) = unsafeheader.Slice{
|
|
||||||
Data: addr,
|
|
||||||
Len: int(size),
|
|
||||||
Cap: int(size),
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
// ResetCovereage sets all of the counters for each edge of the instrumented
|
// ResetCovereage sets all of the counters for each edge of the instrumented
|
||||||
// source code to 0.
|
// source code to 0.
|
||||||
func ResetCoverage() {
|
func ResetCoverage() {
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"internal/race"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@ -27,6 +28,9 @@ func TestMain(m *testing.M) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkWorkerFuzzOverhead(b *testing.B) {
|
func BenchmarkWorkerFuzzOverhead(b *testing.B) {
|
||||||
|
if race.Enabled {
|
||||||
|
b.Skip("TODO(48504): fix and re-enable")
|
||||||
|
}
|
||||||
origEnv := os.Getenv("GODEBUG")
|
origEnv := os.Getenv("GODEBUG")
|
||||||
defer func() { os.Setenv("GODEBUG", origEnv) }()
|
defer func() { os.Setenv("GODEBUG", origEnv) }()
|
||||||
os.Setenv("GODEBUG", fmt.Sprintf("%s,fuzzseed=123", origEnv))
|
os.Setenv("GODEBUG", fmt.Sprintf("%s,fuzzseed=123", origEnv))
|
||||||
@ -65,6 +69,9 @@ func BenchmarkWorkerFuzzOverhead(b *testing.B) {
|
|||||||
// BenchmarkWorkerPing acts as the coordinator and measures the time it takes
|
// BenchmarkWorkerPing acts as the coordinator and measures the time it takes
|
||||||
// a worker to respond to N pings. This is a rough measure of our RPC latency.
|
// a worker to respond to N pings. This is a rough measure of our RPC latency.
|
||||||
func BenchmarkWorkerPing(b *testing.B) {
|
func BenchmarkWorkerPing(b *testing.B) {
|
||||||
|
if race.Enabled {
|
||||||
|
b.Skip("TODO(48504): fix and re-enable")
|
||||||
|
}
|
||||||
b.SetParallelism(1)
|
b.SetParallelism(1)
|
||||||
w := newWorkerForTest(b)
|
w := newWorkerForTest(b)
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
@ -77,6 +84,9 @@ func BenchmarkWorkerPing(b *testing.B) {
|
|||||||
// BenchmarkWorkerFuzz acts as the coordinator and measures the time it takes
|
// BenchmarkWorkerFuzz acts as the coordinator and measures the time it takes
|
||||||
// a worker to mutate a given input and call a trivial fuzz function N times.
|
// a worker to mutate a given input and call a trivial fuzz function N times.
|
||||||
func BenchmarkWorkerFuzz(b *testing.B) {
|
func BenchmarkWorkerFuzz(b *testing.B) {
|
||||||
|
if race.Enabled {
|
||||||
|
b.Skip("TODO(48504): fix and re-enable")
|
||||||
|
}
|
||||||
b.SetParallelism(1)
|
b.SetParallelism(1)
|
||||||
w := newWorkerForTest(b)
|
w := newWorkerForTest(b)
|
||||||
entry := CorpusEntry{Values: []interface{}{[]byte(nil)}}
|
entry := CorpusEntry{Values: []interface{}{[]byte(nil)}}
|
||||||
|
Loading…
Reference in New Issue
Block a user