Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README: main: switch from go-fuzz to the builtin fuzzer #32

Merged
merged 2 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions 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 All @@ -16,8 +16,6 @@ git clone [email protected]:MariusVanDerWijden/FuzzyVM.git
cd FuzzyVM
# Build the binary
go build
# Create the fuzz-test generator as follows:
./FuzzyVM build
# Create an initial corpus
./FuzzyVM corpus --count 100
# Run the fuzzer
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
Loading