# -*- 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; $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 -i ../$mol.xyz -A $mol.dbond --select-molecule-by-id 0 -N $RADIUS --nonconvex-file $FILENAME 2>stderr >stdout || exitcode=$? else $MOLECUILDER -i ../$mol.xyz --select-molecule-by-id 0 -N $RADIUS --nonconvex-file $FILENAME 2>stderr >stdout || exitcode=$? fi echo "Molecuilder done with exitcode $exitcode." cd ../.. grep -E "^[0-9]* [0-9]* [0-9]*$" @srcdir@/$mol/$2/${FILENAME}-$mol.dat | sort -n >$testdir/$RADIUS/reference-triangles.dat grep -E "^[0-9]* [0-9]* [0-9]*$" $testdir/$RADIUS/${FILENAME}.dat | sort -n >$testdir/$RADIUS/new-triangles.dat diff $testdir/$RADIUS/reference-triangles.dat $testdir/$RADIUS/new-triangles.dat 2>$testdir/$RADIUS/diffstderr >$testdir/$RADIUS/diffstdout || exitcode=$? if test $exitcode = $expected_exitcode; then : else CLEANUP= exit 1 fi } # can use $LN_S # vim:set ft=sh: