forked from flatironinstitute/CaImAn
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_demos.sh
executable file
·63 lines (53 loc) · 1.64 KB
/
test_demos.sh
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
#!/bin/bash
##########################
# test_demos.sh
#
# This is intended to test the python (.py) demos
#
# dependencies:
# xvfb-run - This starts a dummy X server for anything that might
# need to plot things or show movies. Note that any demos
# we test MUST NOT wait for input while showing a movie,
# because in the test environment nobody will show up to provide
# that input (like clicking things or hitting q)
# Make sure the xvfb-run command exists before starting demos, so we can give a better
# error message
OS=$(uname -s)
export MKL_NUM_THREADS=1
export OPENBLAS_NUM_THREADS=1
# On Linux we wrap our command with xvfb-run to allow X things to happen
# and make them effectively no-ops. Not necessary on other platforms.
if [ $OS == "Linux" ]; then
command -v xvfb-run
if [ $? != 0 ]; then
echo "xvfb-run command not found"
exit 1
fi
fi
# Tell matplotlib to try to plot less to begin with by specifying a postscript backend
export MPLCONFIG=ps
cd `dirname ${BASH_SOURCE[0]}`
for demo in demos/general/*; do
if [ $demo == "demos/general/demo_behavior.py" ]; then
echo " Skipping tests on $demo: This is interactive"
elif [ -d $demo ]; then
true
else
echo Testing demo [$demo]
echo Timestamp is $(date +%s)
if [ $OS == "Linux" ]; then
xvfb-run --server-args='-screen 0 1024x768x24' -a python $demo
else
python $demo
fi
err=$?
if [ $err != 0 ]; then
echo " Tests failed with returncode $err"
echo " Failed test is $demo"
echo Timestamp is $(date +%s)
exit 2
fi
echo Timestamp is $(date +%s)
echo "=========================================="
fi
done