1*5c90c05cSAndroid Build Coastguard Worker# Running the fuzzers locally 2*5c90c05cSAndroid Build Coastguard Worker 3*5c90c05cSAndroid Build Coastguard WorkerThere is a [helper script](build.sh) to build the fuzzers, which has only been 4*5c90c05cSAndroid Build Coastguard Workertested on Debian and Ubuntu linux so far. There should be no problems fuzzing on 5*5c90c05cSAndroid Build Coastguard WorkerWindows (using clang>=8) or on Mac, but the script will probably not work out of 6*5c90c05cSAndroid Build Coastguard Workerthe box. 7*5c90c05cSAndroid Build Coastguard Worker 8*5c90c05cSAndroid Build Coastguard WorkerSomething along 9*5c90c05cSAndroid Build Coastguard Worker```sh 10*5c90c05cSAndroid Build Coastguard Workermkdir build 11*5c90c05cSAndroid Build Coastguard Workercd build 12*5c90c05cSAndroid Build Coastguard Workerexport CXX=clang++ 13*5c90c05cSAndroid Build Coastguard Workerexport CXXFLAGS="-fsanitize=fuzzer-no-link -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION= -g" 14*5c90c05cSAndroid Build Coastguard Workercmake .. -DFMT_SAFE_DURATION_CAST=On -DFMT_FUZZ=On -DFMT_FUZZ_LINKMAIN=Off -DFMT_FUZZ_LDFLAGS="-fsanitize=fuzzer" 15*5c90c05cSAndroid Build Coastguard Workercmake --build . 16*5c90c05cSAndroid Build Coastguard Worker``` 17*5c90c05cSAndroid Build Coastguard Workershould work to build the fuzzers for all platforms which clang supports. 18*5c90c05cSAndroid Build Coastguard Worker 19*5c90c05cSAndroid Build Coastguard WorkerExecute a fuzzer with for instance 20*5c90c05cSAndroid Build Coastguard Worker```sh 21*5c90c05cSAndroid Build Coastguard Workercd build 22*5c90c05cSAndroid Build Coastguard Workerexport UBSAN_OPTIONS=halt_on_error=1 23*5c90c05cSAndroid Build Coastguard Workermkdir out_chrono 24*5c90c05cSAndroid Build Coastguard Workerbin/fuzzer_chrono_duration out_chrono 25*5c90c05cSAndroid Build Coastguard Worker``` 26