Skip to content
Snippets Groups Projects
Commit 8a1c962a authored by Kostyantyn Vorobyov's avatar Kostyantyn Vorobyov
Browse files

[tests] Enable testing using all supported memory models

parent 2a3da5cf
No related branches found
No related tags found
No related merge requests found
...@@ -52,11 +52,13 @@ GMP="$3" # Whether to issue an additional run with -e-acsl-gmp-only ...@@ -52,11 +52,13 @@ GMP="$3" # Whether to issue an additional run with -e-acsl-gmp-only
EXTRA="$4" # Extra e-acsl-gcc.sh flags EXTRA="$4" # Extra e-acsl-gcc.sh flags
DEBUG="$5" # Debug option DEBUG="$5" # Debug option
EACSLGCC="$(dirname $0)/e-acsl-gcc.sh" # E-ACSL wrapper script
MODELS="$($EACSLGCC --print-mmodels)" # Supported memory models
ROOTDIR="`readlink -f $(dirname $0)/../`" # Root directory of the repository ROOTDIR="`readlink -f $(dirname $0)/../`" # Root directory of the repository
TESTDIR="$ROOTDIR/tests/$PREFIX" # Test suite directory TESTDIR="$ROOTDIR/tests/$PREFIX" # Test suite directory
RESDIR=$TESTDIR/result # Result directory within the test suite RESDIR=$TESTDIR/result # Result directory within the test suite
TESTFILE=`ls $TESTDIR/$TEST.[ic]` # Source test file TESTFILE=`ls $TESTDIR/$TEST.[ic]` # Source test file
MODEL="bittree" # Memory model to link against
LOG="$RESDIR/$TEST.testrun" # Base name for log files LOG="$RESDIR/$TEST.testrun" # Base name for log files
OUT="$RESDIR/gen_$TEST" # Base name for instrumented files OUT="$RESDIR/gen_$TEST" # Base name for instrumented files
...@@ -95,16 +97,15 @@ trap "clean" EXIT HUP INT QUIT TERM ...@@ -95,16 +97,15 @@ trap "clean" EXIT HUP INT QUIT TERM
# Run executable and report results # Run executable and report results
# $1 - path to an executable # $1 - path to an executable
# $2 - path to a log file # $2 - path to a log file
# $3 - type of the executable (i.e., generated from original or instrumented # $3 - memory model the executable has been linked against
# sources)
run_executable() { run_executable() {
local executable="$1" local executable="$1"
local log="$2" local log="$2"
local type="$3" local model="$3"
debug "Run and log $executable" debug "Run and log $executable"
if ! `$executable > $log 2>&1`; then if ! `$executable > $log 2>&1`; then
error "[$3 run]: Runtime failure in test case $TEST:" $log error "[$3 model] Runtime failure in test case '$TEST'" $log
fi fi
} }
...@@ -115,26 +116,30 @@ run_test() { ...@@ -115,26 +116,30 @@ run_test() {
local logfile=$LOG.$RUNS.elog # Log file for e-acsl-gcc.sh output local logfile=$LOG.$RUNS.elog # Log file for e-acsl-gcc.sh output
local oexec=$OUT.$RUNS.out # Generated executable name local oexec=$OUT.$RUNS.out # Generated executable name
local oexeclog=$LOG.$RUNS.rlog # Log for executable output local oexeclog=$LOG.$RUNS.rlog # Log for executable output
local extra="$1" # Additional arguments to e-acsl-gcc.sh local model="$1" # Memory model to link against
local extra="$2" # Additional arguments to e-acsl-gcc.sh
# Command for instrumenting the source file and compiling the original # Command for instrumenting the source file and compiling the original
# and the instrumented code # and the instrumented code
EACSL_GCC="./scripts/e-acsl-gcc.sh \ COMMAND="$EACSLGCC \
--compile $TESTFILE --ocode=$ocode --logfile=$logfile \ --compile $TESTFILE --ocode=$ocode --logfile=$logfile \
--instrumented-only --memory-model=$MODEL --oexec=$oexec $extra" --instrumented-only --memory-model=$model --oexec=$oexec $extra"
debug "Run $EACSL_GCC" debug "Run $COMMAND"
$EACSL_GCC || error "Command $EACSL_GCC failed" "$logfile" $COMMAND || error "Command $COMMAND failed" "$logfile"
# Log outputs of the generated executables # Log outputs of the generated executables
run_executable $oexec.e-acsl $oexeclog.e-acsl "Instrumented" run_executable "$oexec.e-acsl" "$oexeclog.e-acsl" "$model"
RUNS=$((RUNS+1)) RUNS=$((RUNS+1))
} }
# Run GMP tests if specified for model in $MODELS; do
run_test "$EXTRA" run_test $model "$EXTRA"
if [ -n "$GMP" ]; then # Run GMP tests if specified
run_test "--gmp $EXTRA" if [ -n "$GMP" ]; then
fi run_test $model "--gmp $EXTRA"
fi
done
exit 0 exit 0
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