Skip to content

Commit

Permalink
Add a nix-shell fuzzing file
Browse files Browse the repository at this point in the history
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
  • Loading branch information
jsimonetti committed Oct 27, 2020
1 parent 3547e77 commit 9d24762
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions fuzz-shell.nix
@@ -0,0 +1,29 @@
with import <nixpkgs> { };
pkgs.mkShell {
name = "go-fuzz";
buildInputs = [ go ];
shellHook = ''
function setup() {
export GOPATH=/tmp/.GOPATH
export GOPATH=$(mktemp /tmp/GOPATH.XXXXXX)
mkdir -p $GOPATH/src
pushd $GOPATH/src
go get github.com/dvyukov/go-fuzz/go-fuzz
go get github.com/dvyukov/go-fuzz/go-fuzz-build
popd
}
function teardown() {
chmod -R u+w $GOPATH
rm -rf $GOPATH
}
setup
trap teardown EXIT
alias fuzzbuild="$GOPATH/bin/go-fuzz-build -tags gofuzz"
alias fuzz="$GOPATH/bin/go-fuzz -bin=./rtnetlink-fuzz.zip -workdir=testdata"
echo "Fuzz environment ready. There are 2 aliases available:"
echo ""
echo "fuzzbuild - will build the fuzzing file"
echo "fuzz - will start fuzzing"
echo ""
'';
}

0 comments on commit 9d24762

Please sign in to comment.