2020-10-17 00:10:49 +08:00
|
|
|
#!/bin/bash -eu
|
|
|
|
|
|
|
|
#
|
|
|
|
# This script runs the continuous fuzzing tests on OSS-Fuzz.
|
|
|
|
#
|
|
|
|
|
2020-10-16 22:33:18 +08:00
|
|
|
if [[ ${SANITIZER} = *undefined* ]]; then
|
|
|
|
CXXFLAGS="${CXXFLAGS} -fsanitize=unsigned-integer-overflow -fsanitize-trap=unsigned-integer-overflow"
|
2020-10-17 00:10:49 +08:00
|
|
|
fi
|
|
|
|
|
2021-05-26 00:52:14 +08:00
|
|
|
BUILD=cxx_build_dir
|
|
|
|
INSTALL=cxx_install_dir
|
|
|
|
|
|
|
|
mkdir ${BUILD}
|
|
|
|
cmake -S ${PWD} -B ${BUILD} \
|
|
|
|
-DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi" \
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="${INSTALL}"
|
|
|
|
cmake --build ${BUILD} --target install-cxx-headers
|
|
|
|
|
2020-10-16 22:33:18 +08:00
|
|
|
for test in libcxx/test/libcxx/fuzzing/*.pass.cpp; do
|
2020-11-06 23:06:44 +08:00
|
|
|
exe="$(basename ${test})"
|
|
|
|
exe="${exe%.pass.cpp}"
|
2020-10-16 22:33:18 +08:00
|
|
|
${CXX} ${CXXFLAGS} \
|
|
|
|
-std=c++14 \
|
|
|
|
-DLIBCPP_OSS_FUZZ \
|
2021-01-27 04:30:42 +08:00
|
|
|
-D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS \
|
2021-05-26 00:52:14 +08:00
|
|
|
-nostdinc++ -cxx-isystem ${INSTALL}/include/c++/v1 \
|
2021-01-27 04:30:42 +08:00
|
|
|
-lpthread -ldl \
|
2020-11-06 23:06:44 +08:00
|
|
|
-o "${OUT}/${exe}" \
|
2020-10-16 22:33:18 +08:00
|
|
|
${test} \
|
|
|
|
${LIB_FUZZING_ENGINE}
|
2020-10-17 00:10:49 +08:00
|
|
|
done
|