diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-06-10 14:32:30 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-06-10 14:32:30 +0000 |
commit | 858c90f69646776847b2b940679361b88bceab43 (patch) | |
tree | af4440e08b484c9c4e544a985925899aaacfcbca /src | |
parent | 663f23d7c45185faf7cdb863ad2758808415e4fc (diff) | |
download | gnunet-858c90f69646776847b2b940679361b88bceab43.tar.gz gnunet-858c90f69646776847b2b940679361b88bceab43.zip |
improving script
Diffstat (limited to 'src')
-rwxr-xr-x | src/arm/test_gnunet_arm.sh | 83 |
1 files changed, 51 insertions, 32 deletions
diff --git a/src/arm/test_gnunet_arm.sh b/src/arm/test_gnunet_arm.sh index 72f7a176b..7586d78bb 100755 --- a/src/arm/test_gnunet_arm.sh +++ b/src/arm/test_gnunet_arm.sh | |||
@@ -3,6 +3,7 @@ | |||
3 | rm -rf /tmp/test-gnunetd-arm/ | 3 | rm -rf /tmp/test-gnunetd-arm/ |
4 | exe="./gnunet-arm -c test_arm_api_data.conf" | 4 | exe="./gnunet-arm -c test_arm_api_data.conf" |
5 | base=/tmp/gnunet-test-arm | 5 | base=/tmp/gnunet-test-arm |
6 | out=/tmp/test-gnunetd-arm.log | ||
6 | #DEBUG="-L DEBUG" | 7 | #DEBUG="-L DEBUG" |
7 | 8 | ||
8 | # ---------------------------------------------------------------------------------- | 9 | # ---------------------------------------------------------------------------------- |
@@ -17,31 +18,39 @@ echo "PASS" | |||
17 | # ---------------------------------------------------------------------------------- | 18 | # ---------------------------------------------------------------------------------- |
18 | echo -n "TEST: Start ARM... " | 19 | echo -n "TEST: Start ARM... " |
19 | 20 | ||
20 | if ! $exe $DEBUG -s > /dev/null ; then | 21 | if ! $exe $DEBUG -s > $out ; then |
21 | echo "FAIL: error running $exe" | 22 | echo "FAIL: error running $exe" |
23 | echo "Command output was:" | ||
24 | cat $out | ||
22 | exit 1 | 25 | exit 1 |
23 | fi | 26 | fi |
24 | LINES=`ps ax | grep gnunet-service-arm | grep -v grep | wc -l` | 27 | LINES=`ps ax | grep gnunet-service-arm | grep -v grep | wc -l` |
25 | if test $LINES -eq 0; then | 28 | if test $LINES -eq 0; then |
26 | echo "FAIL: found $LINES gnunet-service-arm processes" | 29 | echo "FAIL: found $LINES gnunet-service-arm processes" |
27 | exit 1 | 30 | echo "Command output was:" |
31 | cat $out | ||
32 | exit 1 | ||
28 | fi | 33 | fi |
29 | echo "PASS" | 34 | echo "PASS" |
30 | 35 | ||
31 | # ---------------------------------------------------------------------------------- | 36 | # ---------------------------------------------------------------------------------- |
32 | echo -n "TEST: Start another service... " | 37 | echo -n "TEST: Start another service... " |
33 | 38 | ||
34 | if ! $exe $DEBUG -i resolver > /dev/null ; then | 39 | if ! $exe $DEBUG -i resolver > $out ; then |
35 | echo "FAIL: error running $exe" | 40 | echo "FAIL: error running $exe" |
41 | echo "Command output was:" | ||
42 | cat $out | ||
36 | kill %% | 43 | kill %% |
37 | exit 1 | 44 | exit 1 |
38 | fi | 45 | fi |
39 | sleep 1 | 46 | sleep 1 |
40 | LINES=`ps ax | grep gnunet-service-resolver | grep -v grep | wc -l` | 47 | LINES=`ps ax | grep gnunet-service-resolver | grep -v grep | wc -l` |
41 | if test $LINES -ne 1; then | 48 | if test $LINES -ne 1; then |
42 | echo "FAIL: unexpected output (got $LINES lines, wanted 1)" | 49 | echo "FAIL: unexpected output (got $LINES lines, wanted 1)" |
43 | $exe -e | 50 | echo "Command output was:" |
44 | exit 1 | 51 | cat $out |
52 | $exe -e > /dev/null | ||
53 | exit 1 | ||
45 | fi | 54 | fi |
46 | echo "PASS" | 55 | echo "PASS" |
47 | 56 | ||
@@ -54,32 +63,36 @@ if ! $exe $DEBUG -t resolver > $base.out; then | |||
54 | fi | 63 | fi |
55 | LINES=`cat $base.out | grep resolver | grep not | wc -l` | 64 | LINES=`cat $base.out | grep resolver | grep not | wc -l` |
56 | if test $LINES -ne 0; then | 65 | if test $LINES -ne 0; then |
57 | echo "FAIL: unexpected output" | 66 | echo "FAIL: unexpected output:" |
58 | $exe -e | 67 | cat $base.out |
59 | exit 1 | 68 | $exe -e |
69 | exit 1 | ||
60 | fi | 70 | fi |
61 | LINES=`cat $base.out | grep resolver | grep -v not | wc -l` | 71 | LINES=`cat $base.out | grep resolver | grep -v not | wc -l` |
62 | if test $LINES -ne 1; then | 72 | if test $LINES -ne 1; then |
63 | echo "FAIL: unexpected output" | 73 | echo "FAIL: unexpected output" |
64 | $exe -e | 74 | cat $base.out |
65 | exit 1 | 75 | $exe -e |
76 | exit 1 | ||
66 | fi | 77 | fi |
67 | echo "PASS" | 78 | echo "PASS" |
68 | 79 | ||
69 | # ---------------------------------------------------------------------------------- | 80 | # ---------------------------------------------------------------------------------- |
70 | echo -n "TEST: Stop a service... " | 81 | echo -n "TEST: Stop a service... " |
71 | 82 | ||
72 | if ! $exe $DEBUG -k resolver > /dev/null; then | 83 | if ! $exe $DEBUG -k resolver > $out; then |
73 | echo "FAIL: error running $exe" | 84 | echo "FAIL: error running $exe" |
74 | $exe -e | 85 | $exe -e |
75 | exit 1 | 86 | exit 1 |
76 | fi | 87 | fi |
77 | sleep 1 | 88 | sleep 1 |
78 | LINES=`ps ax | grep gnunet-service-resolver | grep -v grep | wc -l` | 89 | LINES=`ps ax | grep gnunet-service-resolver | grep -v grep | wc -l` |
79 | if test $LINES -ne 0; then | 90 | if test $LINES -ne 0; then |
80 | echo "FAIL: unexpected output" | 91 | echo "FAIL: unexpected output" |
81 | $exe -e | 92 | echo "Command output was:" |
82 | exit 1 | 93 | cat $out |
94 | $exe -e > /dev/null | ||
95 | exit 1 | ||
83 | fi | 96 | fi |
84 | echo "PASS" | 97 | echo "PASS" |
85 | 98 | ||
@@ -87,31 +100,37 @@ echo "PASS" | |||
87 | echo -n "TEST: Test -t on stopped service... " | 100 | echo -n "TEST: Test -t on stopped service... " |
88 | 101 | ||
89 | if ! $exe $DEBUG -t resolver > $base.out; then | 102 | if ! $exe $DEBUG -t resolver > $base.out; then |
90 | echo "FAIL: error running $exe" | 103 | echo "FAIL: error running $exe" |
91 | $exe -e | 104 | cat $base.out |
92 | exit 1 | 105 | $exe -e > /dev/null |
106 | exit 1 | ||
93 | fi | 107 | fi |
94 | LINES=`cat $base.out | grep resolver | grep not | wc -l` | 108 | LINES=`cat $base.out | grep resolver | grep not | wc -l` |
95 | if test $LINES -ne 1; then | 109 | if test $LINES -ne 1; then |
96 | echo "FAIL: unexpected output" | 110 | echo "FAIL: unexpected output" |
97 | $exe -e | 111 | cat $base.out |
98 | exit 1 | 112 | $exe -e > /dev/null |
113 | exit 1 | ||
99 | fi | 114 | fi |
100 | echo "PASS" | 115 | echo "PASS" |
101 | 116 | ||
102 | # ---------------------------------------------------------------------------------- | 117 | # ---------------------------------------------------------------------------------- |
103 | echo -n "TEST: Stop ARM... " | 118 | echo -n "TEST: Stop ARM... " |
104 | 119 | ||
105 | if ! $exe $DEBUG -e > /dev/null; then | 120 | if ! $exe $DEBUG -e > $out; then |
106 | echo "FAIL: error running $exe" | 121 | echo "FAIL: error running $exe" |
107 | exit 1 | 122 | exit 1 |
108 | fi | 123 | fi |
124 | sleep 1 | ||
109 | LINES=`ps ax | grep gnunet-service-arm | grep -v grep | wc -l` | 125 | LINES=`ps ax | grep gnunet-service-arm | grep -v grep | wc -l` |
110 | if test $LINES -ne 0; then | 126 | if test $LINES -ne 0; then |
111 | echo "FAIL: unexpected output" | 127 | echo "FAIL: unexpected output, still have $LINES gnunet-service-arm processes" |
112 | exit 1 | 128 | echo "Command output was:" |
129 | cat $out | ||
130 | exit 1 | ||
113 | fi | 131 | fi |
114 | echo "PASS" | 132 | echo "PASS" |
115 | 133 | ||
116 | rm -rf /tmp/test-gnunetd-arm/ | 134 | rm -rf /tmp/test-gnunetd-arm/ |
117 | rm -f $base.out | 135 | rm -f $base.out $out |
136 | |||