Debian Codegraph @

testsuite/sanitytests/events.test

raw
1 #!/bin/sh
2
3 NP=4
4 music_conf="$( echo "${0##*/}" | sed 's/\.test//' ).music"
5
6 abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
7 path="`dirname $abspath`"
8
9 . ${path}/run_test
10
11 write_configuration ()
12 {
13
14 method=$1
15 echo "Communication method: ${method}"
16
17 # this is music configuration file
18 cat <<EOF > "${MUSIC_DATA_PATH}/${music_conf}"
19 np=2
20 stoptime=1.0
21 [from]
22 binary=${TEST_BINDIR}/eventsource
23 args=-b 1 10 ${MUSIC_DATA_PATH}/spikes
24 [to]
25 binary=${TEST_BINDIR}/eventlogger
26 args=-b 2
27 from.out -> to.in [10, ${method}]
28 EOF
29
30 }
31
32
33 # this is input data
34 cat <<\EOF > "${MUSIC_DATA_PATH}/spikes0.dat"
35 # spikes
36 0.0 0
37 0.1 1
38 0.2 2
39 0.3 3
40 0.4 4
41 EOF
42
43 cat <<\EOF > "${MUSIC_DATA_PATH}/spikes1.dat"
44 # spikes
45 0.0 9
46 0.6 5
47 0.7 6
48 0.8 7
49 0.9 8
50 EOF
51
52 # this is the output we should expect to see
53 cat <<\EOF > "${MUSIC_DATA_PATH}/ok"
54 Rank 0: Event (0, 0) detected at 0
55 Rank 0: Event (1, 0.1) detected at 0.09
56 Rank 0: Event (2, 0.2) detected at 0.19
57 Rank 0: Event (3, 0.3) detected at 0.28
58 Rank 0: Event (4, 0.4) detected at 0.39
59 Rank 1: Event (5, 0.6) detected at 0.58
60 Rank 1: Event (6, 0.7) detected at 0.68
61 Rank 1: Event (7, 0.8) detected at 0.79
62 Rank 1: Event (8, 0.9) detected at 0.89
63 Rank 1: Event (9, 0) detected at 0
64 EOF
65 # sort the file using locale specified by current environment
66 sort "${MUSIC_DATA_PATH}/ok" -o "${MUSIC_DATA_PATH}/ok"
67
68 cat <<\EOF > "${MUSIC_DATA_PATH}/errok"
69 EOF
70
71 for method in point-to-point collective ; do
72 write_configuration "${method}"
73
74 run_test "${NP}" "${music_conf}"
75 exit_code=$?
76
77 if test "${exit_code}" -gt 0 ; then
78 exit "${exit_code}"
79 fi
80 done
81
82 exit 0