From 569b8d2c9469f0d23e5b1b6e0b30328e2ef50b77 Mon Sep 17 00:00:00 2001 From: Rob Falgout Date: Sat, 4 Mar 2017 19:10:29 -0800 Subject: [PATCH] Added a valgrind runtest and autotest feature --- AUTOTEST/machine-tux.sh | 24 ++++++++++++++++------- src/test/runtest.sh | 40 +++++++++++++++++++++++---------------- src/test/runtest.valgrind | 0 3 files changed, 41 insertions(+), 23 deletions(-) create mode 100644 src/test/runtest.valgrind diff --git a/AUTOTEST/machine-tux.sh b/AUTOTEST/machine-tux.sh index 8876a650c..30bb2b6a5 100755 --- a/AUTOTEST/machine-tux.sh +++ b/AUTOTEST/machine-tux.sh @@ -65,15 +65,25 @@ co="--enable-debug CC=mpiCC" test.sh basictest.sh $src_dir -co: $co -mo: $mo -ro: $ro -eo: $eo renametest.sh basictest $output_dir/basictest-debug-cpp -co="--with-insure --enable-debug --with-print-errors" -MO="test" -test.sh basictest.sh $src_dir -co: $co -mo: $MO -ro: $ro -renametest.sh basictest $output_dir/basictest--with-insure1 +# co="--with-insure --enable-debug --with-print-errors" +# MO="test" +# test.sh basictest.sh $src_dir -co: $co -mo: $MO -ro: $ro +# renametest.sh basictest $output_dir/basictest--with-insure1 +# +# co="--with-insure --enable-debug --enable-global-partition" +# MO="test" +# test.sh basictest.sh $src_dir -co: $co -mo: $MO -ro: $ro +# renametest.sh basictest $output_dir/basictest--with-insure2 -co="--with-insure --enable-debug --enable-global-partition" +co="--enable-debug --with-print-errors" MO="test" -test.sh basictest.sh $src_dir -co: $co -mo: $MO -ro: $ro -renametest.sh basictest $output_dir/basictest--with-insure2 +test.sh basictest.sh $src_dir -co: $co -mo: $mo -ro: $ro -rt -valgrind +renametest.sh basictest $output_dir/basictest--valgrind1 + +co="--enable-debug --enable-global-partition" +MO="test" +test.sh basictest.sh $src_dir -co: $co -mo: $mo -ro: $ro -rt -valgrind +renametest.sh basictest $output_dir/basictest--valgrind2 co="--without-MPI" test.sh basictest.sh $src_dir -co: $co -mo: $mo diff --git a/src/test/runtest.sh b/src/test/runtest.sh index 723dd6d44..db1b293c9 100755 --- a/src/test/runtest.sh +++ b/src/test/runtest.sh @@ -3,16 +3,17 @@ # global variables BatchMode=0 NoRun=0 -JobCheckInterval=10 #sleep time between jobs finished check +JobCheckInterval=10 # sleep time between jobs finished check InputString="" RunPrefix=`type -p mpirun` RunPrefix="$RunPrefix -np" RunString="" RunEcho="" -ExecFileNames="" #string of executable file names used -TestDirNames="" #string of names of TEST_* directories used +ExecFileNames="" # string of executable file names used +TestDirNames="" # string of names of TEST_* directories used HOST=`hostname` -NumThreads=0 #number of OpenMP threads to use if > 0 +NumThreads=0 # number of OpenMP threads to use if > 0 +Valgrind="" # string to add to MpirunString when using valgrind function usage { @@ -27,6 +28,7 @@ function usage printf " -mpi MPI run prefix; default is 'mpirun -np'\n" printf " -nthreads use 'n' OpenMP threads\n" printf " -tol use relative tolerance 'tol' to compare numeric test values\n" + printf " -valgrind use valgrind memory checker\n" printf " -n|-norun turn off execute mode, echo what would be run\n" printf " -t|-trace echo each command\n" printf " -D define when running tests\n" @@ -94,7 +96,9 @@ function MpirunString if [ $NumThreads -gt 0 ] ; then export OMP_NUM_THREADS=$NumThreads fi - RunString="$RunPrefix $*" + RunString="$RunPrefix $1" + shift + RunString="$RunString $Valgrind $*" ;; esac } @@ -263,12 +267,12 @@ function ExecuteJobs ;; *mpirun*) - RunCmd=`echo $InputLine| sed -e 's/^[ \t]*mpirun[ \t]*//'` - RunCmd=`echo $RunCmd | sed -e 's/[ \t]*>.*$//'` - OutFile=`echo $InputLine | sed -e 's/^.*>//'` - OutFile=`echo $OutFile | sed -e 's/ //g'` - ErrFile=`echo $OutFile | sed -e 's/\.out\./.err./'` - RunName=`echo $OutFile | sed -e 's/\.out.*$//'` + RunCmd=`echo $InputLine| sed -e 's/^[ \t]*mpirun[ \t]*//'` # remove 'mpirun' + RunCmd=`echo $RunCmd | sed -e 's/[ \t]*>.*$//'` # remove output redirect + OutFile=`echo $InputLine | sed -e 's/^.*>//'` # set output file + OutFile=`echo $OutFile | sed -e 's/ //g'` # remove extra space + ErrFile=`echo $OutFile | sed -e 's/\.out\./.err./'` # set error file + RunName=`echo $OutFile | sed -e 's/\.out.*$//'` # set test run name CheckPath $RunCmd # check path to executable if [ "$?" -gt 0 ] ; then cat >> $RunName.err <<- EOF @@ -437,6 +441,15 @@ do NumThreads=$1 shift ;; + -tol) + shift + CONVTOL=$1 + shift + ;; + -valgrind) + shift + Valgrind="valgrind -q --suppressions=`pwd`/runtest.valgrind" + ;; -n|-norun) NoRun=1 RunEcho="echo" @@ -451,11 +464,6 @@ do eval export `echo $1`=1 shift ;; - -tol) - shift - CONVTOL=$1 - shift - ;; *) InputString=$1 if [ "$InputString" ] ; then if [ -r $InputString ] ; then diff --git a/src/test/runtest.valgrind b/src/test/runtest.valgrind new file mode 100644 index 000000000..e69de29bb