File: dotest

package info (click to toggle)
ion 3.2.1%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,768 kB
  • ctags: 11,049
  • sloc: ansic: 141,798; sh: 22,848; makefile: 7,818; python: 1,638; sql: 311; perl: 197; awk: 178; xml: 50; java: 19
file content (84 lines) | stat: -rwxr-xr-x 2,079 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
#
# Tests that bpchat sends and receives bundles and behaves well.
#

# documentation boilerplate
CONFIGFILES=" \
./config/host1.rc \
"
echo "########################################"
echo
pwd | sed "s/\/.*\///" | xargs echo "NAME: "
echo
echo "PURPOSE: Testing the basic functionality of the bpchat application.
	Described in issue 192, bpchat is a simple utility which sends and
	receives bundles on the terminal."
echo
echo "CONFIG: Custom loopback configuration: "
echo
for N in $CONFIGFILES
do
	echo "$N:"
	cat $N
	echo "# EOF"
	echo
done
echo "OUTPUT: Bpchat and bpecho are used to ensure that bpchat can send and
	receive text messages in bundles.  The time required to close the
	bpchat program is also tested. ERROR messages are given on failure.
	No explicit PASS messages are given, but the overall test return
	value will reflect test success."
echo
echo "########################################"

FAIL=0

echo "Killing old ION..."
killm
sleep 1

# Prepare for test start
rm -f ion.log bpchatoutput bpchatinfifo

echo "Starting ION..."
srcdir=`pwd`
CONFIGDIR="config"
echo "ionstart -I ${CONFIGDIR}/host1.rc"
"ionstart" -I "${CONFIGDIR}/host1.rc"

echo "Start a bpecho."
bpecho ipn:1.1 & BPECHOPID=$!

echo "Start a bpchat, and send it the bpchatinput file without closing bpchat's
STDIN.  This allows bpchat to wait to receive some bundles before closing."
mkfifo bpchatinfifo
bpchat ipn:1.2 ipn:1.1 < bpchatinfifo > bpchatoutput & BPCHATPID=$!
exec 7> bpchatinfifo
cat bpchatinput >&7

echo "Wait to allow ION and bpecho to reflect the bundles back to bpchat."
sleep 3

echo "Close bpchat and bpecho.  Time how long it takes bpchat to close."
SECONDS=0
kill $BPECHOPID $BPCHATPID
wait $BPCHATPID
FINISHSECONDS=$SECONDS
wait $BPECHOPID

# Verify results.
if [ $FINISHSECONDS -ge 2 ]; then
    echo "ERROR: bpchat took $FINISHSECONDS seconds to finish, too long."
    FAIL=1
fi

if ! diff bpchatinput bpchatoutput > /dev/null; then
    echo "ERROR: Bpchat didn't give expected output"
    diff bpchatinput bpchatoutput
    FAIL=1
fi

ionstop

exit $FAIL