Add scripts for running the paranoia tests in parallel on Linux with valgrind.

This commit is contained in:
Brian Taylor 2023-12-01 15:54:17 -08:00 committed by Holger Vogt
parent 3cf8fe8c41
commit 1adee64224
3 changed files with 109 additions and 0 deletions

View File

@ -0,0 +1,26 @@
To run the paranoia test suite in parallel on Linux with valgrind:
1. Download the paranoia tests (paranoia.7z) from the ngspice Quality web page.
2. p7zip -d paranoia.7z
Rename the the unzipped directory to a name without spaces which would
otherwise confuse valgrind.
3. cd into the renamed unzipped directory.
4. copy runtests.sh and textract.py from the examples/paranoia directory in
your git repository to the current directory.
5. If your computer has several cores, you can modify the -j4 in the line
time parallel -j4 bash ::: $2/*
in runtests.sh and increase the number of parallel jobs.
6. ./runtests.sh <paranoia_shell_script> <test_area_directory>
For example:
./runtests.sh paranoia_test.sh testdir
Note that the test area directory must not exist before you invoke runtests.sh.
Now relax and drink a cup of coffee. If you don't want to run the tests in
parallel, it will take several cups.

39
examples/paranoia/runtests.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/bash
if test -n "$1" && test -n "$2" ; then
if test -d "$2" || test -e "$2" ; then
echo "$2 already exists, remove it first"
exit 1
fi
python3 textract.py $1 $2
else
echo "arg 1 is the paranoia test script"
echo "arg 2 is the test script working directory"
exit 1
fi
SECONDS=0
time parallel -j4 bash ::: $2/*
wait
NGSPICE_OK="`ngspice -v | awk '/level/ {print $2;}'` done"
echo "*******************************************"
echo "vlog files with errors found by valgrind:"
grep -L "ERROR SUMMARY: 0 errors from 0 context" ./*.vlog
echo "*******************************************"
echo "log files with ngspice errors:"
grep -L "$NGSPICE_OK" ./*.log
echo "*******************************************"
echo "log files with convergence issues:"
grep -l "Too many iterations without convergence" ./*.log
echo "*******************************************"
echo "log files with messages containing 'error':"
grep -i -l "error" ./*.log
echo "*******************************************"
ELAPSED="Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec"
echo
echo $ELAPSED

View File

@ -0,0 +1,44 @@
import os
import sys
testnum = 1
def writeit(cd, cmd, outd):
global testnum
pwd = os.getcwd()
outfname = outd + '/testfile' + str(testnum) + '.sh'
outf = open(outfname, 'w')
testnum = testnum + 1
outf.write('#!/bin/bash\n')
outf.write('NGSPICE="ngspice -i "\n')
p1 = 'VALGRIND="valgrind --leak-check=full --suppressions='
p2 = p1 + pwd + '/ignore_shared_libs.supp"\n'
outf.write(p2)
outf.write(cd)
if cmd.endswith('&\n'):
outf.write(cmd[:-2] + '\n')
else:
outf.write(cmd)
os.chmod(outfname, 0o777)
outf.close()
return 0
def main():
infile = sys.argv[1]
outdir = sys.argv[2]
os.mkdir(outdir)
inp = open(infile, 'r')
for line in inp:
if line.startswith('cd '):
cdname = line
elif line.startswith('$VALGRIND'):
writeit(cdname, line, outdir)
inp.close()
return 0
if __name__ == '__main__':
main()