Skip to content

Commit

Permalink
README: main: switch from go-fuzz to the builtin fuzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusVanDerWijden committed Dec 8, 2023
1 parent 97c0701 commit 5918658
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 29 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FuzzyVM creates state tests that can be used to differential fuzz EVM implementa
It only focus on the test generation part, the test execution is handled by [goevmlab](https://github.com/holiman/goevmlab).

## Environment
You need to have golang, go-fuzz, go-fuzz-build, and go-ethereum installed
You need to have golang and go-ethereum installed

## Install instructions

Expand Down
34 changes: 6 additions & 28 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ var minCorpusCommand = &cli.Command{
Action: minimizeCorpus,
}

var buildCommand = &cli.Command{
Name: "build",
Usage: "Builds the fuzzer",
Action: build,
}

var runCommand = &cli.Command{
Name: "run",
Usage: "Runs the fuzzer",
Expand All @@ -79,7 +73,6 @@ func initApp() *cli.App {
benchCommand,
corpusCommand,
minCorpusCommand,
buildCommand,
runCommand,
}
return app
Expand Down Expand Up @@ -125,24 +118,6 @@ func corpus(c *cli.Context) error {
return nil
}

func build(c *cli.Context) error {
cmdName := "go-fuzz-build"
// ignore x/exp/rand, otherwise the build will fail, see also https://github.com/dvyukov/go-fuzz/issues/331
args := []string{
"-preserve",
"golang.org/x/exp/rand",
}
cmd := exec.Command(cmdName, args...)
cmd.Dir = "fuzzer"
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
// We have to disable CGO
cgo := "CGO_ENABLED=0"
env := append(os.Environ(), cgo)
cmd.Env = env
return cmd.Run()
}

func run(c *cli.Context) error {
directories := []string{
outputRootDir,
Expand All @@ -158,9 +133,12 @@ func run(c *cli.Context) error {
}

func startGenerator(genThreads int) *exec.Cmd {
cmdName := "go-fuzz"
dir := "./fuzzer/fuzzer-fuzz.zip"
cmd := exec.Command(cmdName, "--bin", dir, "--procs", fmt.Sprint(genThreads))
var (
cmdName = "go"
target = "FuzzVM"
dir = "./fuzzer/..."
)
cmd := exec.Command(cmdName, "test", "--fuzz", target, "--parallel", fmt.Sprint(genThreads), dir)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Start(); err != nil {
Expand Down

0 comments on commit 5918658

Please sign in to comment.