ngspice/tests/bin/run_cmc_check

172 lines
4.1 KiB
Plaintext
Raw Normal View History

2011-05-29 12:43:20 +02:00
#!/bin/sh
#
2011-06-25 10:19:21 +02:00
# Example Script to run tests and check results.
2011-05-29 12:43:20 +02:00
#
2011-06-25 10:19:21 +02:00
# This is an example script for running QA tests on a
# model and then checking the simulated results against
# reference results. A separate target is defined for each
# variant of the model. The program runQaTests.pl runs the
# tests, and that program expects a perl module SIMULATOR.pm
# to be provided for each simulator that is tested.
# Examples of these are provided.
2011-05-29 12:43:20 +02:00
#
qaSpecFile="qaSpec"
qaResultsDirectory="results"
testProgramName="$(dirname $0)/runQaTests.pl"
2011-06-25 10:19:21 +02:00
if [ -z "$testProgramFlags" ] ; then
2014-05-04 11:17:31 +02:00
testProgramFlags="-nw"
2011-06-25 10:19:21 +02:00
fi
2011-05-29 12:43:20 +02:00
2014-05-04 11:17:31 +02:00
#testProgramFlags="-d -V"
2011-05-29 12:43:20 +02:00
help() {
cat <<-EOF
2011-06-25 10:19:21 +02:00
Valid targets are:
2011-05-29 12:43:20 +02:00
2011-06-25 10:19:21 +02:00
all run tests and compare results for all simulators
2011-05-29 12:43:20 +02:00
2011-06-25 10:19:21 +02:00
ngspice run tests and compare results ngspice
2011-05-29 12:43:20 +02:00
2015-03-30 16:02:41 +02:00
hspice run tests and compare results hspice
2011-06-25 10:19:21 +02:00
clean remove all previously generated simulation results
2011-05-29 12:43:20 +02:00
2011-06-25 10:19:21 +02:00
NOTE: if test results exist they are not resimulated
NOTE: to force resimulation run "make clean" first
2011-05-29 12:43:20 +02:00
EOF
}
run_test() {
simname="$1"
localPlatform=`${testProgramName} -platform`
2017-07-18 15:18:08 +02:00
localVersion=`${testProgramName} ${testProgramFlags} -sv -s ${simname} ${qaSpecFile}`
2011-05-29 12:43:20 +02:00
echo ""
echo "******"
echo "****** ${qaSpecFile} tests for ${simname}"
echo "****** (for version ${localVersion} on platform ${localPlatform})"
echo "******"
for test in `${testProgramName} -lt -s ${simname} ${qaSpecFile}` ; do
2011-06-25 10:19:21 +02:00
echo ""
echo "****** Checking test (${simname}): ${test}"
2011-05-29 12:43:20 +02:00
2011-06-25 10:19:21 +02:00
for variant in `${testProgramName} -lv -s ${simname} ${qaSpecFile}` ; do
${testProgramName} \
2011-05-29 12:43:20 +02:00
${testProgramFlags} \
-s ${simname} \
-r -t ${test} \
-var ${variant} \
--results=${qaResultsDirectory} \
2011-05-29 12:43:20 +02:00
${qaSpecFile}
2011-06-25 10:19:21 +02:00
done
2011-05-29 12:43:20 +02:00
done
for version in `ls -C1 ${qaResultsDirectory}/${simname}` ; do
2011-06-25 10:19:21 +02:00
for platform in `ls -C1 ${qaResultsDirectory}/${simname}/${version}` ; do
2011-05-29 12:43:20 +02:00
if [ "${version}" = "${localVersion}" -a "${platform}" = "${localPlatform}" ]
2011-05-29 12:43:20 +02:00
then
2011-06-25 10:19:21 +02:00
break
fi
2011-05-29 12:43:20 +02:00
2011-06-25 10:19:21 +02:00
echo ""
echo "******"
echo "****** Comparing previously run ${qaSpecFile} tests for ${simname}"
echo "****** (for version ${version} on platform ${platform})"
echo "******"
2011-05-29 12:43:20 +02:00
2011-06-25 10:19:21 +02:00
for test in `${testProgramName} -lt -s ${simname} ${qaSpecFile}` ; do
2011-05-29 12:43:20 +02:00
2011-06-25 10:19:21 +02:00
echo ""
echo "****** Checking test (${simname}): ${test}"
2011-05-29 12:43:20 +02:00
2011-06-25 10:19:21 +02:00
for variant in `${testProgramName} -lv -s ${simname} ${qaSpecFile}` ; do
${testProgramName} \
2011-05-29 12:43:20 +02:00
-c ${version} ${platform} \
-s ${simname} \
-t ${test} \
-var ${variant} \
--results=${qaResultsDirectory} \
2011-05-29 12:43:20 +02:00
${qaSpecFile}
2011-06-25 10:19:21 +02:00
done
done
done
2011-05-29 12:43:20 +02:00
done
}
#####
2015-03-30 16:02:41 +02:00
##### tests
2011-05-29 12:43:20 +02:00
#####
ngspice() {
run_test ngspice
}
2015-03-30 16:02:41 +02:00
hspice() {
run_test hspice
}
2011-05-29 12:43:20 +02:00
2015-03-30 16:02:41 +02:00
#####
##### clean
#####
2011-05-29 12:43:20 +02:00
clean() {
rm -rf ${qaResultsDirectory}/ngspice ngspiceCkt*
2015-03-30 16:02:41 +02:00
rm -rf ${qaResultsDirectory}/hspice hspiceCkt*
}
clean_ngspice() {
rm -rf ${qaResultsDirectory}/ngspice ngspiceCkt*
}
clean_hspice() {
rm -rf ${qaResultsDirectory}/hspice hspiceCkt*
2011-05-29 12:43:20 +02:00
}
all() {
2015-03-30 16:02:41 +02:00
ngspice hspice
2011-05-29 12:43:20 +02:00
}
while test $# -gt 0; do
case "$1" in
--srcdir=* | --executable=*)
testProgramFlags="$testProgramFlags $1"
shift
;;
--results)
qaResultsDirectory="$2"
shift ; shift
;;
-qa)
qaSpecFile="$2"
shift ; shift
;;
*)
break
;;
esac
done
2011-05-29 12:43:20 +02:00
for arg in $@ ; do
case "$arg" in
2015-03-30 16:02:41 +02:00
all | clean | clean_ngspice | ngspice | clean_hspice | hspice)
2011-05-29 12:43:20 +02:00
"$arg"
;;
*)
help
;;
esac
done