Skip to content
Snippets Groups Projects
Commit 94d107c2 authored by an7s's avatar an7s
Browse files

Allow users to specify coverage file when in manual testing mode

Former-commit-id: 37282fe35788e62e7e92df70c8002feb9da2dc11
parent 832fc011
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
name=$1
newname=$2
test_script=$3
#
# $1 contains the user-supplied test input/output specification script
# assumption: this script is called from within the subdirectory created as part of
# ps_analyze.sh
# We support two forms of manual tests:
#
# (1) User supplies tests with input/output specifications
# - these are automatically identified by looking for the command: manual_test_import
# - coverage information is automatically computed using pin
# (2) User supplies black box regression test suite
# - coverage information is optionally supplied (format of coverage file: 1 address per line)
#
# Assumption: this script is called from within the subdirectory created as part of ps_analyze.sh
#
name=$1 # original basename of binary
newname=$2 # new name of protected binary
test_script=$3 # test script
manual_coverage_file=$4 # coverage file for black box regression test suite
PWD=`pwd`
echo "Running specified test script at: $3 Current working dir is: $PWD"
echo "Running specified test script at: $3 Current working dir is: $PWD coverage file: $4"
echo "Current working dir is: $PWD command issued: $*"
if [ ! -f $test_script ]; then
echo "Error -- could not find manual input/output testing setup script: $1"
echo "Error -- could not find testing cript: $test_script"
exit 1
else
mkdir manual_tests 2>/dev/null
grep manual_test_import $test_script
if [ $? -eq 0 ]; then
# execute the script to import manual test cases
sh $test_script
else
# setup script for black box regression testing
# currently used with P1/Pn
cp $test_script manual_test_wrapper
echo $newname > new_command_name
# optionally use coverage information (if provided)
if [ -f $manual_coverage_file ]; then
cp $manual_coverage_file manual_coverage.txt
fi
fi
ln -s $name.sh $newname
......
......@@ -99,11 +99,13 @@ do
break
done
#if no baseline comparison output exists, delete the coverage file
if [ $baseline_flag -eq 0 ]; then
#if no baseline comparison output exists, delete the coverage file (when using Grace)
if [ ! -f $EXECUTED_ADDRESSES_MANUAL ]; then
if [ $baseline_flag -eq 0 ]; then
echo "do_p1transform.sh: no valid baseline comparison output, deleting coverage file"
rm $COVERAGE_FILE
touch $COVERAGE_FILE
fi
fi
#just in case something went wrong, touch the coverage file. An empty coverage file is permissible, but a missing one will cause PN to crash
......
......@@ -73,7 +73,7 @@ check_options()
# Note that we use `"$@"' to let each command-line parameter expand to a
# separate word. The quotes around `$@' are essential!
# We need TEMP as the `eval set --' would nuke the return value of getopt.
TEMP=`getopt -o s:t: --long step: --long timeout: --long manual_test_script: -n 'ps_analyze.sh' -- "$@"`
TEMP=`getopt -o s:t: --long step: --long timeout: --long manual_test_script: --long manual_test_coverage_file: -n 'ps_analyze.sh' -- "$@"`
# error check #
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit -1 ; fi
......@@ -92,6 +92,10 @@ check_options()
manual_test_script=$2
shift 2
;;
--manual_test_coverage_file)
manual_test_coverage_file=$2
shift 2
;;
-t|--timeout)
set_timer $2 & TIMER_PID=$!
shift 2
......@@ -497,7 +501,7 @@ if [ -f $newname.ncexe.annot -a $varid -gt 0 ]; then
#
# Run script to setup manual tests
#
perform_step manual_test $PEASOUP_HOME/tools/do_manualtests.sh $name $stratafied_exe $manual_test_script
perform_step manual_test $PEASOUP_HOME/tools/do_manualtests.sh $name $stratafied_exe $manual_test_script $manual_test_coverage_file
is_step_on manual_test
if [ $? -eq 0 ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment