Debian Codegraph @

testsuite/sanitytests/chain.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 stoptime=1.0
20 [from]
21 np=2
22 binary=${TEST_BINDIR}/eventsource
23 args=-b 2 10 ${MUSIC_DATA_PATH}/spikes
24 [mid]
25 np=1
26 binary=${TEST_EXTRABINDIR}/eventdelay
27 args=-d 0.3
28 [to]
29 np=1
30 binary=${TEST_BINDIR}/eventlogger
31 args=-b 2
32 from.out -> mid.in [10, ${method}]
33 mid.out -> to.in [10, ${method}]
34 EOF
35 }
36
37 # this is input data
38 cat <<\EOF > "${MUSIC_DATA_PATH}/spikes0.dat"
39 # spikes
40 0.0 0
41 0.1 1
42 0.2 2
43 0.3 3
44 0.4 4
45 0.5 5
46 0.6 6
47 0.7 7
48 0.8 8
49 0.9 9
50 EOF
51
52 cat <<\EOF > "${MUSIC_DATA_PATH}/spikes1.dat"
53 # spikes
54 0.0 9
55 0.1 0
56 0.2 1
57 0.3 2
58 0.4 3
59 0.5 4
60 0.6 5
61 0.7 6
62 0.8 7
63 0.9 8
64 EOF
65
66
67 # this is the output we should expect to see
68 cat <<\EOF > "${MUSIC_DATA_PATH}/ok"
69 Rank 0: Event (9, 0.3) detected at 0.29
70 Rank 0: Event (0, 0.3) detected at 0.29
71 Rank 0: Event (1, 0.4) detected at 0.39
72 Rank 0: Event (2, 0.5) detected at 0.49
73 Rank 0: Event (3, 0.6) detected at 0.57
74 Rank 0: Event (4, 0.7) detected at 0.67
75 Rank 0: Event (5, 0.9) detected at 0.87
76 EOF
77 # sort the file using locale specified by current environment
78 sort "${MUSIC_DATA_PATH}/ok" -o "${MUSIC_DATA_PATH}/ok"
79
80 cat <<\EOF > "${MUSIC_DATA_PATH}/errok"
81 EOF
82
83 for method in point-to-point collective ; do
84 write_configuration "${method}"
85
86 run_test "${NP}" "${music_conf}"
87 exit_code=$?
88
89 if test "${exit_code}" -gt 0 ; then
90 exit "${exit_code}"
91 fi
92 done
93
94 exit 0