2005-03-13 18:27:47 +01:00
#!/bin/sh
2004-08-09 17:41:59 +02:00
2011-01-25 19:39:06 +01:00
# set -x
if [ -z " $SPICE_SCRIPTS " ] ; then
SPICE_SCRIPTS = ` dirname $0 `
export SPICE_SCRIPTS
if [ -z " $ngspice_vpath " ] ; then
ngspice_vpath = .
export ngspice_vpath
fi
fi
# ls -ld $(realpath $SPICE_SCRIPTS) $SPICE_SCRIPTS/spinit
# echo "---ngspice_vpath = $ngspice_vpath"
2005-03-13 18:27:47 +01:00
SPICE = $1
2004-08-09 17:41:59 +02:00
TEST = $2
2013-01-19 18:10:30 +01:00
FILTER = "CPU|Dynamic|Note|Circuit|Trying|Reference|Date|Doing|---|v-sweep|time|est|Error|Warning|Data|Index|trans|acan|oise|nalysis|ole|Total|memory|urrent|Got|Added|BSIM|bsim|B4SOI|b4soi|codemodel|^binary raw file|^ngspice.*done"
2004-08-09 17:41:59 +02:00
testname = ` basename $TEST .cir`
testdir = ` dirname $TEST `
2005-03-13 18:27:47 +01:00
2005-03-17 22:22:33 +01:00
HOST_TYPE = ` uname -srvm`
2005-03-13 18:27:47 +01:00
case $HOST_TYPE in
2016-07-24 22:59:48 +02:00
MINGW*| MSYS*)
2005-03-13 18:27:47 +01:00
$SPICE --batch $testdir /$testname .cir -o $testname .test && \
2012-12-31 11:17:40 +01:00
sed -e 's/e-000/e+000/g' $testname .test | sed 's/e-0/e-/g' | sed 's/e+0/e+/g' | egrep -v " $FILTER " > $testname .test_tmp && \
sed -e 's/-0$/ 0/g' $testdir /$testname .out | egrep -v " $FILTER " > $testname .out_tmp
2005-03-13 18:27:47 +01:00
if diff -B -w -u $testname .out_tmp $testname .test_tmp; then
rm $testname .test $testname .test_tmp $testname .out_tmp
exit 0
fi
rm -f $testname .test_tmp $testname .out_tmp
sed -e 's/e-000/e+000/g' $testname .test | sed 's/e-0/e-/g' | sed 's/e+0/e+/g' > $testname .test_tmp
mv $testname .test_tmp $testname .test
; ;
2009-02-21 21:52:19 +01:00
Linux*| Darwin*| CYGWIN*)
2005-03-13 18:27:47 +01:00
$SPICE --batch $testdir /$testname .cir >$testname .test && \
2012-12-31 11:17:40 +01:00
egrep -v " $FILTER " $testname .test > $testname .test_tmp && \
egrep -v " $FILTER " $testdir /$testname .out > $testname .out_tmp
2005-03-13 18:27:47 +01:00
if diff -B -w -u $testname .out_tmp $testname .test_tmp; then
rm $testname .test $testname .test_tmp $testname .out_tmp
exit 0
fi
rm -f $testname .test_tmp $testname .out_tmp
; ;
2013-08-11 11:05:49 +02:00
SunOS*| OpenBSD*)
2005-03-13 18:27:47 +01:00
$SPICE --batch $testdir /$testname .cir >$testname .test && \
2012-12-31 11:17:40 +01:00
sed -e '/^$/d' $testname .test | egrep -v " $FILTER " > $testname .test_tmp && \
sed -e '/^$/d' $testdir /$testname .out | egrep -v " $FILTER " > $testname .out_tmp
2005-03-13 18:27:47 +01:00
if diff -b -w $testname .out_tmp $testname .test_tmp; then
rm $testname .test $testname .test_tmp $testname .out_tmp
exit 0
fi
rm -f $testname .test_tmp $testname .out_tmp
; ;
2005-03-17 22:22:33 +01:00
*)
echo Unknown system type!
echo $HOST_TYPE
echo ./tests/bin/checks.sh may need updating for your system
; ;
2005-03-13 18:27:47 +01:00
esac
2004-08-09 17:41:59 +02:00
exit 1