1*a65addddSAndroid Build Coastguard Worker#!/bin/bash 2*a65addddSAndroid Build Coastguard Worker 3*a65addddSAndroid Build Coastguard Workerrm -rf coverage 4*a65addddSAndroid Build Coastguard Workermkdir coverage 5*a65addddSAndroid Build Coastguard Workercd coverage 6*a65addddSAndroid Build Coastguard Workermkdir binaries 7*a65addddSAndroid Build Coastguard Worker 8*a65addddSAndroid Build Coastguard WorkerCOMPILE_COMMAND=(g++ -O0 -W -Wall -Werror -std=c++11 -fprofile-arcs -fno-exceptions -ftest-coverage -I../include) 9*a65addddSAndroid Build Coastguard WorkerFRUIT_OBJS=() 10*a65addddSAndroid Build Coastguard Worker 11*a65addddSAndroid Build Coastguard Worker 12*a65addddSAndroid Build Coastguard Workerfor s in $(cd ../src; echo *.cpp) 13*a65addddSAndroid Build Coastguard Workerdo 14*a65addddSAndroid Build Coastguard Worker "${COMPILE_COMMAND[@]}" -c ../src/"$s" -o "src-${s/.cpp/.o}" & 15*a65addddSAndroid Build Coastguard Worker FRUIT_OBJS+=("src-${s/.cpp/.o}") 16*a65addddSAndroid Build Coastguard Workerdone 17*a65addddSAndroid Build Coastguard Worker 18*a65addddSAndroid Build Coastguard Workerwait || exit 1 19*a65addddSAndroid Build Coastguard Worker 20*a65addddSAndroid Build Coastguard Workerfor testdir in $(find ../tests -type d) 21*a65addddSAndroid Build Coastguard Workerdo 22*a65addddSAndroid Build Coastguard Worker for t in $(cd $testdir; ls -1 *.cpp | fgrep -v include_test.cpp) 23*a65addddSAndroid Build Coastguard Worker do 24*a65addddSAndroid Build Coastguard Worker fgrep -q expect-compile-error $testdir/"$t" || \ 25*a65addddSAndroid Build Coastguard Worker "${COMPILE_COMMAND[@]}" $testdir/"$t" ${FRUIT_OBJS[@]} -o binaries/${t/.cpp/} & 26*a65addddSAndroid Build Coastguard Worker done 27*a65addddSAndroid Build Coastguard Workerdone 28*a65addddSAndroid Build Coastguard Worker 29*a65addddSAndroid Build Coastguard Workerwait || exit 1 30*a65addddSAndroid Build Coastguard Worker 31*a65addddSAndroid Build Coastguard Workerfor b in binaries/* 32*a65addddSAndroid Build Coastguard Workerdo 33*a65addddSAndroid Build Coastguard Worker ./"$b" || true 34*a65addddSAndroid Build Coastguard Workerdone &>/dev/null 35*a65addddSAndroid Build Coastguard Worker 36*a65addddSAndroid Build Coastguard WorkerPROJECT_DIR="$(cd ..; echo $PWD)" 37*a65addddSAndroid Build Coastguard Worker 38*a65addddSAndroid Build Coastguard Workerlcov --rc lcov_branch_coverage=1 -capture --directory . --output-file all-coverage.info 39*a65addddSAndroid Build Coastguard Workerlcov --rc lcov_branch_coverage=1 --base-directory "$PROJECT_DIR" \ 40*a65addddSAndroid Build Coastguard Worker --extract all-coverage.info "$PROJECT_DIR/src/*" \ 41*a65addddSAndroid Build Coastguard Worker --extract all-coverage.info "$PROJECT_DIR/include/*" \ 42*a65addddSAndroid Build Coastguard Worker --output-file coverage.info 43*a65addddSAndroid Build Coastguard Workergenhtml --branch-coverage --demangle-cpp coverage.info --output-directory html 44*a65addddSAndroid Build Coastguard Worker 45*a65addddSAndroid Build Coastguard Workerxdg-open html/index.html 46