From 17b1153a430c0bb8f8b2a5319c1d7a8cb187b860 Mon Sep 17 00:00:00 2001 From: bdr7fv <bdr7fv@git.zephyr-software.com> Date: Wed, 12 Jun 2013 19:19:12 +0000 Subject: [PATCH] Put in some additional sanity checking in how manual coverage is generated. Former-commit-id: c0f9d4d02cf5cc480c891645daa3bfd7f2c5b2cc --- tools/do_manual_cover.sh | 10 +++++++--- tools/do_p1transform.sh | 14 +++++++++----- tools/manual_coverage_wrapper.sh | 9 ++++++--- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/tools/do_manual_cover.sh b/tools/do_manual_cover.sh index 3c237ac84..5dcec5f46 100755 --- a/tools/do_manual_cover.sh +++ b/tools/do_manual_cover.sh @@ -20,13 +20,17 @@ if [ -f $MANUAL_TEST_SCRIPT ]; then echo "$MANUAL_COV_SCRIPT $ORIG_BIN $MANUAL_TEST_SCRIPT $AGGREGATE_COVERAGE" eval $MANUAL_COV_SCRIPT $ORIG_BIN $MANUAL_TEST_SCRIPT $AGGREGATE_COVERAGE - - + return $? fi +#the remainder of this file is for Anh's old manual tests +#which I will keep around for now, but ignore this code. + +return 0 + ls $MANUAL_TEST_DIR/* >/dev/null 2>/dev/null if [ ! $? -eq 0 ]; then - echo "do_manual_cover.sh: error: no manual test specifications found -- exiting" + echo "do_manual_cover.sh: no manual test specifications found -- exiting" exit 1 fi diff --git a/tools/do_p1transform.sh b/tools/do_p1transform.sh index 0f69684fd..2f6265abd 100755 --- a/tools/do_p1transform.sh +++ b/tools/do_p1transform.sh @@ -67,16 +67,20 @@ mkdir $P1_DIR # fi #fi +touch $EXECUTED_ADDRESSES_FINAL + # generate coverage info for manually-specified tests (if any) $PEASOUP_HOME/tools/do_manual_cover.sh +if [[ ! $? -eq 0 ]]; then + echo "ERROR: Manual coverage failed" + #continue for now, but don't encorporate manual coverage data. +else +# merge all execution traces if successfully run + cat $EXECUTED_ADDRESSES_MANUAL >> $EXECUTED_ADDRESSES_FINAL +fi echo "manual cover finished" -# merge all execution traces -touch $EXECUTED_ADDRESSES_FINAL - -cat $EXECUTED_ADDRESSES_MANUAL >> $EXECUTED_ADDRESSES_FINAL - echo "Replaying all .json files" input_cnt=0 REPLAY_DEADLINE=$(( `date +'%s'` + $COVERAGE_REPLAY_TIMEOUT )) diff --git a/tools/manual_coverage_wrapper.sh b/tools/manual_coverage_wrapper.sh index 09b91adcd..91e6dc57e 100755 --- a/tools/manual_coverage_wrapper.sh +++ b/tools/manual_coverage_wrapper.sh @@ -8,7 +8,8 @@ BENCH=$1 TEST_SCRIPT=$2 MANUAL_EXE_ADDRESS_OUTPUT_FILE=$3 - +#A coverage round that takes longer than 10 minutes is assumed to be an infinite loop. +TIMEOUT_VALUE=600 PIN_BENCH=`pwd`/pin_bench COVERAGE_RESULTS_FILE=$PEASOUP_HOME/coverage_results/itrace.out @@ -33,11 +34,13 @@ eval $TEST_SCRIPT -i $PIN_BENCH $BENCH #because I now have an ignore flag, this likely won't occur, but just in case. if [ $? -ne 0 ]; then - echo "WARNING: manual coverage failed. The running manual tests reported failure with coverage instrumentation. Continuing with coverage that was collected." + echo "ERROR: manual coverage failed. The running manual tests reported failure with coverage instrumentation. Ignoring coverage results." + + exit 1 fi # sanity filter, keep only well formed addresses -cat $COVERAGE_RESULTS_FILE | sed 's/.*\(0x.*\)/\1/' >tmp +cat $COVERAGE_RESULTS_FILE | sed 's/\(.*0x.*\)/\1/' >tmp mv tmp $COVERAGE_RESULTS_FILE cp $COVERAGE_RESULTS_FILE $MANUAL_EXE_ADDRESS_OUTPUT_FILE -- GitLab