# -*- shell-script -*- # @configure_input@ # Set variables and functions to use in tests. # This is copied from the TREMOLO project, credits Ralf Wildenhues, modified Frederik Heber. # case $VERBOSE in x*) set -x ;; esac pathname=$0 # next two lines not portable basename=${pathname##*/} #testdir=${basename%.test} testdir=${basename%%.*} need_testdir="test -d @srcdir@/$testdir" testdir_exists="test -d $testdir" EXEEXT=@EXEEXT@ # next 2 lines not portable MOLECUILDER=${MOLECUILDER-"@abs_top_builddir@/src/molecuilder$EXEEXT"} exec_prefix="@prefix@/bin" DEBUG=${DEBUG-false} CLEANUP='rm -f stderr stdout' if $need_testdir then if $testdir_exists; then rm -rf $testdir fi mkdir $testdir CLEANUP="$CLEANUP; rm -rf $testdir" cp -r @srcdir@/$testdir/* $testdir/ CLEANUP="rm -f stderr stdout diffstderr diffstdout; cd ..; $CLEANUP" CLEANUP="rm -f *.conf*; rm -f NonConvexEnvelope*; rm -f ${testdir}.xyz; rm -f ${testdir}.dbond; $CLEANUP" fi # debug runs should keep results if $DEBUG; then :; else trap "eval \"$CLEANUP\"" 0 1 2 13 15 fi # TREMOLO_run status [options...] # Run tremolo with OPTIONS, fail if it does not exit with STATUS. Tesselation_run () { # $1 is exit code # $2 is RADIUS expected_exitcode=$1 mol=$testdir RADIUS=$2 FILENAME="NonConvexEnvelope" exitcode=0 cd $testdir/$RADIUS #echo "Current dir is `pwd`, calling $MOLECUILDER $mol.conf -e $exec_prefix -p ../$mol.xyz -N $RADIUS $FILENAME." if [ -e $mol.dbond ]; then $MOLECUILDER $mol.conf -e $exec_prefix -p ../$mol.xyz -A $mol.dbond -N 0 --sphere-radius $RADIUS --nonconvex-file $FILENAME 2>stderr >stdout || exitcode=$? else $MOLECUILDER $mol.conf -e $exec_prefix -p ../$mol.xyz -N 0 --sphere-radius $RADIUS --nonconvex-file $FILENAME 2>stderr >stdout || exitcode=$? fi #echo "Molecuilder done with exitcode $exitcode." #cat stderr #cat stdout grep -E "^[0-9]* [0-9]* [0-9]*$" ../../../../../molecuilder/tests/Tesselations/$mol/$2/${FILENAME}-$mol.dat | sort -n >reference-triangles.dat grep -E "^[0-9]* [0-9]* [0-9]*$" ${FILENAME}.dat | sort -n >new-triangles.dat diff reference-triangles.dat new-triangles.dat 2>diffstderr >diffstdout || exitcode=$? #echo "Diff done with exitcode $exitcode." #cat diffstderr #cat diffstdout cd ../.. test $exitcode = $expected_exitcode || exit 1 } # can use $LN_S # vim:set ft=sh: