blob: 0d0b02aad72c4a435a12001aba306fd922c83124 (
plain)
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
|
#!/bin/sh
clean_up() {
rm -f batch.stdout shell.stdout shell.returns batch.returns
rm -fr test-home
}
clean_up
# create temporary home
export HOME=$PWD/test-home
mkdir $HOME
export ICEAUTHORITY=$HOME/.ICEauthority
echo '* Starting dcop server'
../dcopserver --nofork &
DCOP_SERVER_PID=$!
die() {
kill $DCOP_SERVER_PID
[ -n $DCOP_TEST_PID ] && kill $DCOP_TEST_PID
echo "$1"
exit 1;
}
trap 'die "The script interrupted by user"' 2 15
while ! ../dcopserver --serverid 2>/dev/null; do
echo '* Wait for the dcop server'
sleep 2
done
echo '* Running batch mode'
./dcop_test --batch >batch.stdout || die "Failed to run dcop_test"
echo -n '* Starting test app '
./dcop_test >shell.stdout &
DCOP_TEST_PID=$!
cnt=0
while ! ../client/dcop | grep -q "TestApp-$DCOP_TEST_PID"; do
echo -n '.'
cnt=$((cnt+1))
if [ "$cnt" -gt 15 ] ; then
kill "$DCOP_TEST_PID"
die "dcop_test seems to hanged up"
fi
kill -0 "$DCOP_TEST_PID" || die "dcop_test died unexpectadly"
sleep 1
done
echo ' started'
echo '* Running driver mode'
./driver "TestApp-$DCOP_TEST_PID" >driver.stdout || die "Failed to start driver"
echo '* Running shell mode'
. ./shell.generated >shell.returns
echo -n '* Comparing ... '
compare()
{
if ! diff -q --strip-trailing-cr $1 $2; then
echo "FAILED:"
diff -u $1 $2
die "$1 and $2 are different";
fi
}
compare batch.stdout shell.stdout
compare batch.stdout driver.stdout
compare batch.returns shell.returns
compare batch.returns driver.returns
clean_up
kill $DCOP_SERVER_PID
echo "Passed"
exit 0;
|