#!/usr/bin/env bash
|
|
|
|
SNUGLOG_DIR=.
|
|
|
|
if [ $# -ge 1 ]; then
|
|
SNUGLOG_DIR=$1
|
|
fi
|
|
|
|
SNUGLOG_DIR=$(realpath "$SNUGLOG_DIR")
|
|
|
|
source "$SNUGLOG_DIR/tools/config/defaults"
|
|
|
|
if [ $# -ge 2 ]; then
|
|
source "$2"
|
|
elif [ -f "$SNUGLOG_DIR/tools/config/override" ]; then
|
|
source "$SNUGLOG_DIR/tools/config/override"
|
|
fi
|
|
|
|
BUILD_DIR="$SNUGLOG_DIR/coverage"
|
|
|
|
IS_NOISY_CMAKE=""
|
|
if [ "$NOISY_CMAKE" -eq 1 ]; then
|
|
IS_NOISY_CMAKE="-DCMAKE_VERBOSE_MAKEFILE=ON"
|
|
fi
|
|
|
|
if test "$MUST_REWRITE_PATHS" -eq 1 && test ! "$REWRITE_ENABLED" && [[ ! "$1" =~ /\s/g ]] && [[ ! "$2" =~ /\s/g ]]; then
|
|
export REWRITE_ENABLED=1
|
|
(echo "$0 $@" | /usr/bin/env bash) 2>&1 | sed $REWRITE_PATHS
|
|
export REWRITE_ENABLED=0
|
|
else
|
|
rm -rf "$BUILD_DIR"
|
|
mkdir -p "$BUILD_DIR"
|
|
|
|
cd "$BUILD_DIR" || exit
|
|
|
|
cmake \
|
|
-DCODE_COVERAGE=ON \
|
|
-DCMAKE_BUILD_TYPE=Debug \
|
|
"-DCMAKE_C_COMPILER=$C_COMPILER" \
|
|
"-DCMAKE_CXX_COMPILER=$CXX_COMPILER" \
|
|
$IS_NOISY_CMAKE \
|
|
"-DLLVM_COV_PATH=$LLVM_COV" \
|
|
"-DLLVM_PROFDATA_PATH=$LLVM_PROFDATA" \
|
|
"$SNUGLOG_DIR"
|
|
|
|
make -j3 ccov-tests
|
|
fi
|