Create a separate coverage build.

First part of #191.
This commit is contained in:
Oliver Chang 2017-05-08 11:17:27 -07:00
parent a83ce13c54
commit 4896be51cd
3 changed files with 13 additions and 3 deletions

View File

@ -26,6 +26,9 @@ ENV SANITIZER_FLAGS_memory "-fsanitize=memory -fsanitize-memory-track-origins"
# Default build flags for coverage.
ENV COVERAGE_FLAGS="-fsanitize-coverage=trace-pc-guard,trace-cmp"
# Coverage flags for generating coverage reports.
ENV COVERAGE_FLAGS_coverage="-fsanitize-coverage=bb,no-prune,trace-pc-guard"
# Default sanitizer and fuzzing engine to use.
ENV SANITIZER="address"
ENV FUZZING_ENGINE="libfuzzer"

View File

@ -19,7 +19,7 @@ echo "---------------------------------------------------------------"
if [ -z "${SANITIZER_FLAGS-}" ]; then
FLAGS_VAR="SANITIZER_FLAGS_${SANITIZER}"
export SANITIZER_FLAGS=$(echo ${!FLAGS_VAR})
export SANITIZER_FLAGS=${!FLAGS_VAR-}
fi
# compile script might override environment, use . to call it.
@ -32,10 +32,16 @@ then
cp -R /usr/msan/lib/* /usr/lib/
fi
# Coverage flag overrides.
COVERAGE_FLAGS_VAR="COVERAGE_FLAGS_$SANITIZER"
if [[ -n ${!COVERAGE_FLAGS_VAR-} ]]
then
export COVERAGE_FLAGS="${!COVERAGE_FLAGS_VAR}"
fi
export CFLAGS="$CFLAGS $SANITIZER_FLAGS $COVERAGE_FLAGS"
export CXXFLAGS="$CFLAGS $CXXFLAGS_EXTRA"
echo "CC=$CC"
echo "CXX=$CXX"
echo "CFLAGS=$CFLAGS"

View File

@ -24,6 +24,7 @@ CONFIGURATIONS = {
'sanitizer-address' : [ 'SANITIZER=address' ],
'sanitizer-memory' : [ 'SANITIZER=memory' ],
'sanitizer-undefined' : [ 'SANITIZER=undefined' ],
'sanitizer-coverage' : [ 'SANITIZER=coverage' ],
'engine-libfuzzer' : [ 'FUZZING_ENGINE=libfuzzer' ],
'engine-afl' : [ 'FUZZING_ENGINE=afl' ],
}
@ -34,7 +35,7 @@ EngineInfo = collections.namedtuple(
ENGINE_INFO = {
'libfuzzer': EngineInfo(
upload_bucket='clusterfuzz-builds',
supported_sanitizers=['address', 'memory', 'undefined']),
supported_sanitizers=['address', 'memory', 'undefined', 'coverage']),
'afl': EngineInfo(
upload_bucket='clusterfuzz-builds-afl',
supported_sanitizers=['address']),