#!/bin/sh # # $Id: sanity_test,v 1.11 2014/11/19 00:17:39 rauch Exp $ # # Verifies the results of a small integration by comparing with a # known good result. # . ./procs.sh testing "validity of a sample integration" cleanup() { rm -f sanity.hnb sanity.log planets?.*.dat; } # Run the sample integration with a particular algorithm. # $1 = tolerance dotest() { echo ">`head -n 1 sanity.hnb`" if tryexec $BIN/hnbody -l sanity.log sanity.hnb; then echo `grep '^CPU' sanity.log` echo `grep '^Energy' sanity.log` tryexec $BIN/hnarith -s planets1.*.dat planets.txt | tryexec $BIN/hnarith -d - planets.txt | tryexec $BIN/hnstats | awk '/^data/ {printf "%-14s", $3}; \ /^ max/ {del=($3<0.0 ? -$3 : $3); \ grade=(del<'"$1"' ? "ok" : "FAIL"); \ printf "%9.2e --- %s\n", del, grade}' > sanity.log cat sanity.log grep -iq fail sanity.log && status=1 fi result "`awk '/^Integrator/ {print $2}' sanity.hnb` algorithm" cleanup } cat - >sanity.hnb <sanity.hnb <sanity.hnb <