Debian Codegraph @

testsuite/sanitytests/messages.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}/messagesource
23 args=-b 1 ${MUSIC_DATA_PATH}/messages
24 [to]
25 binary=${TEST_BINDIR}/eventlogger
26 args=-b 2
27 from.out -> to.message [10, ${method}]
28 EOF
29 }
30
31
32 # this is input data
33 cat <<\EOF > "${MUSIC_DATA_PATH}/messages0.dat"
34 0.3 Hello
35 0.7 !
36 EOF
37
38 cat <<\EOF > "${MUSIC_DATA_PATH}/messages1.dat"
39 0.5 World
40 0.71 Hello World
41 0.72 !
42 EOF
43
44 # this is the output we should expect to see
45 cat <<\EOF > "${MUSIC_DATA_PATH}/ok"
46 Rank 0: Message (0.3, Hello) detected at 0.28
47 Rank 1: Message (0.3, Hello) detected at 0.28
48 Rank 0: Message (0.5, World) detected at 0.49
49 Rank 1: Message (0.5, World) detected at 0.49
50 Rank 0: Message (0.7, !) detected at 0.68
51 Rank 1: Message (0.7, !) detected at 0.68
52 Rank 0: Message (0.71, Hello World) detected at 0.69
53 Rank 1: Message (0.71, Hello World) detected at 0.69
54 Rank 0: Message (0.72, !) detected at 0.7
55 Rank 1: Message (0.72, !) detected at 0.7
56 EOF
57 # sort the file using locale specified by current environment
58 sort "${MUSIC_DATA_PATH}/ok" -o "${MUSIC_DATA_PATH}/ok"
59
60 cat <<\EOF > "${MUSIC_DATA_PATH}/errok"
61 EOF
62
63 for method in point-to-point collective ; do
64 write_configuration "${method}"
65
66 run_test "${NP}" "${music_conf}"
67 exit_code=$?
68
69 if test "${exit_code}" -gt 0 ; then
70 exit "${exit_code}"
71 fi
72 done
73
74 exit 0