/
runtests
executable file
·93 lines (77 loc) · 2.03 KB
/
runtests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
CURRENT_DIR="$(cd -- "$(dirname -- "$0")" &> /dev/null && pwd)"
sh "$CURRENT_DIR/testutil/clean"
neurondemo -c 'quit()'
have_nrnpython=yes
have_nrnmpi=yes
have_coreneuron=no
if nrniv -nobanner -nogui -c 'nrnversion(6)' | grep "NRN_ENABLE_PYTHON=OFF" > /dev/null ; then
have_nrnpython=no
echo "Python is disabled: NRN_ENABLE_PYTHON=OFF"
fi
if nrniv -nobanner -nogui -c 'nrnversion(6)' | grep "NRN_ENABLE_MPI=OFF" > /dev/null ; then
have_nrnmpi=no
echo "MPI is disabled: NRN_ENABLE_MPI=OFF"
fi
if nrniv -nobanner -nogui -c 'nrnversion(6)' | grep -i -E "NRN_ENABLE_CORENEURON=(ON|TRUE|YES|Y|1)" > /dev/null ; then
have_coreneuron=yes
echo "CORENEURON is enabled: NRN_ENABLE_CORENEURON=ON"
fi
export have_nrnpython
export have_nrnmpi
export have_coreneuron
#list in "scripts", the scripts to run tests in subdirectories.
#list in "compare", the folders to execute comparison tests
# for all the *.cmp files in those folders
#
scripts=(
"${CURRENT_DIR}/fast/Readme" "${CURRENT_DIR}/nrniv/Parallel/recv/test.sh"
)
if [[ "$have_nrnpython" = yes ]] && [[ "$have_nrnmpi" = yes ]] ; then
scripts="${CURRENT_DIR}/nrniv/Parallel/dotests.sh $scripts"
fi
compare=(
"ivoc/Random" "ivoc/Pointer" "ivoc/Vector" "ivoc/Matrix"
"nrniv" "nrniv/NetCon" "nrniv/SaveState"
"nmodl" "nmodl/FOR_NETCONS" "nmodl/functiontable" "nmodl/LONGDIFUS"
"nmodl/order" "nmodl/WATCH"
"nmodl/CONDUCTANCE"
)
cmpprog="$CURRENT_DIR/testutil/cmpdatfile"
err=0
runscript()
{
working_dir=$(dirname "$1")
script=$(basename "$1")
echo "
Running test $1"
(cd "$working_dir" && bash "$script")
return $?
}
runcompare()
{
working_dir=$1
echo "
Running cmpdatfile in $1"
(cd "$working_dir" && "$cmpprog" *.cmp)
return $?
}
for i in ${scripts[@]} ; do
runscript "$i"
if [ $? -ne 0 ] ; then
err=1
fi
done
for i in ${compare[@]} ; do
runcompare "$CURRENT_DIR/$i"
if [ $? -ne 0 ] ; then
err=1
fi
done
echo ""
if [ $err -eq 0 ] ; then
echo "All tests successful"
else
echo "One or more tests failed"
fi
exit $err