Debian Codegraph @

testsuite/sanitytests/fork.test

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