[libc++] Move the oss-fuzz script to libc++

Instead of having this script be part of the OSS-Fuzz repository, I think
it makes more sense to have it alongside the rest of the fuzzing targets
in libc++.
This commit is contained in:
Louis Dionne 2020-10-16 12:10:49 -04:00
parent 1417abe54c
commit e1612c3866
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
#!/bin/bash -eu
#
# This script runs the continuous fuzzing tests on OSS-Fuzz.
#
if [[ $SANITIZER = *undefined* ]]; then
CXXFLAGS="$CXXFLAGS -fsanitize=unsigned-integer-overflow -fsanitize-trap=unsigned-integer-overflow"
fi
for f in $(grep -v "#" libcxx/fuzzing/RoutineNames.txt); do
cat > ${f}_fuzzer.cc <<EOF
#include "fuzzing/fuzzing.h"
#include <cassert>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
int result = fuzzing::$f(data, size);
assert(result == 0); return 0;
}
EOF
$CXX $CXXFLAGS -std=c++11 ${f}_fuzzer.cc ./libcxx/fuzzing/fuzzing.cpp \
-nostdinc++ -cxx-isystem ./libcxx/include -iquote ./libcxx \
-o $OUT/$f $LIB_FUZZING_ENGINE
done