提交 4fb1400f authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

fuzzer: add corpora stuff (make @fippo happy)

上级 9fb02e61
......@@ -10,6 +10,10 @@
# clang+fuzzer stuff is too big.
/worker/deps/clang-fuzzer
# Ignore all fuzzer generated test inputs.
/worker/fuzzer/new-corpus/*
!/worker/fuzzer/new-corpus/.placeholder
# Vim temporal files.
*.swp
*.swo
......@@ -57,7 +57,15 @@ Builds the `mediasoup-worker-fuzzer` target (which uses [libFuzzer](http://llvm.
Executes the `worker/out/mediasoup-worker-fuzzer` binary.
Fuzzer command line options can be set via the `FUZZER_OPTIONS` environment variable. The `LSAN_OPTIONS` environment variable can also be used.
* Set `FUZZER_OPTIONS` environment variable to set Fuzzer command line options.
* Set `FUZZER_CORPUS_DIRS` environment variable to set Fuzzer corpus directories.
* Set `LSAN_OPTIONS` environment variable for LSAN options.
Regardless value of `FUZZER_CORPUS_DIRS`, the first corpus directory will always be `./worker/fuzzer/new-corpus`, so new generated test inputs will be written there.
```bash
$ FUZZER_CORPUS_DIRS="fuzzer/corpora/rtp-corpus" make fuzzer-exec
```
### `fuzzer-docker-build`
......@@ -76,7 +84,15 @@ $ ./scripts/get-dep.sh clang-fuzzer
Runs a container of the Docker image created with `fuzzer-docker-build` and executes `worker/out/mediasoup-worker-fuzzer` binary.
Fuzzer command line options can be set via the `FUZZER_OPTIONS` environment variable. The `LSAN_OPTIONS` environment variable can also be used.
Some environment variables than `fuzzer-exec` are supported. However:
* `FUZZER_CORPUS_DIRS` must be relative to the `worker` directory.
Example:
```bash
$ FUZZER_CORPUS_DIRS="fuzzer/corpora/rtp-corpus" make fuzzer-docker-run
```
### `make xcode`
......
......@@ -45,7 +45,10 @@ fuzzer:
$(MAKE) BUILDTYPE=Release -C out
fuzzer-exec:
./out/Release/mediasoup-worker-fuzzer ${FUZZER_OPTIONS}
./out/Release/mediasoup-worker-fuzzer \
${FUZZER_OPTIONS} \
./fuzzer/new-corpus \
${FUZZER_CORPUS_DIRS}
# Temporal: Just for making sure that fuzzer/fuzzer.cpp compiles in OSX
# (which does not have fuzzer support).
......@@ -63,7 +66,11 @@ endif
fuzzer-docker-run:
docker run \
--init --name=mediasoupFuzzer -it --rm -e FUZZER_OPTIONS -e LSAN_OPTIONS \
--init --name=mediasoupFuzzer -it --rm \
-v $(shell pwd)/fuzzer/new-corpus:/new-corpus \
-e FUZZER_OPTIONS \
-e FUZZER_CORPUS_DIRS \
-e LSAN_OPTIONS \
mediasoup/fuzzer:latest
xcode:
......
......@@ -39,4 +39,10 @@ RUN \
&& make fuzzer
# Eecute the mediasoup-worker-fuzzer binary.
CMD /mediasoup/worker/out/Release/mediasoup-worker-fuzzer ${FUZZER_OPTIONS}
CMD \
set -x \
&& cd /mediasoup/worker \
&& ./out/Release/mediasoup-worker-fuzzer \
${FUZZER_OPTIONS} \
/new-corpus \
${FUZZER_CORPUS_DIRS}
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论