3 # Detect number of cores with Python >= 2.6.
4 # For Python 2.5, you'll have to hard-code the value (or sed /proc/cpuinfo ;).
5 CORES=$(python -c 'from multiprocessing import cpu_count; print cpu_count()' \
9 NOSE="nosetests --with-doctest --doctest-tests --processes $CORES"
11 HAS_MPD=$(which mpdallexit 2>/dev/null)
13 if [ -n "$HAS_MPD" ]; then
14 echo "Running nosetests with $CORES processes via MPI."
18 mpdtrace >/dev/null 2>&1
19 if [ "$?" -ne 0 ]; then
21 mpd & # start an mpd instance
22 sleep 1 # give mpd some time to start up
23 fi # otherwise there is an mpd instance already running
25 mpiexec -n 1 $NOSE pysawsim
28 if [ -n "$LOCAL_MPD" ]; then
32 if [ "$RESULT" -ne 0 ]; then
37 echo "Running nosetests with $CORES processes without MPI."
39 $NOSE pysawsim || exit 1