OLD | NEW |
| (Empty) |
1 #!/bin/sh | |
2 # | |
3 # usage: rtpw_test <rtpw_commands> | |
4 # | |
5 # tests the rtpw sender and receiver functions | |
6 # | |
7 # Copyright (c) 2001-2006, Cisco Systems, Inc. | |
8 # All rights reserved. | |
9 # | |
10 # Redistribution and use in source and binary forms, with or without | |
11 # modification, are permitted provided that the following conditions | |
12 # are met: | |
13 # | |
14 # Redistributions of source code must retain the above copyright | |
15 # notice, this list of conditions and the following disclaimer. | |
16 # | |
17 # Redistributions in binary form must reproduce the above | |
18 # copyright notice, this list of conditions and the following | |
19 # disclaimer in the documentation and/or other materials provided | |
20 # with the distribution. | |
21 # | |
22 # Neither the name of the Cisco Systems, Inc. nor the names of its | |
23 # contributors may be used to endorse or promote products derived | |
24 # from this software without specific prior written permission. | |
25 # | |
26 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
27 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
28 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | |
29 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |
30 # COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
31 # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
32 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
33 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
34 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
35 # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
36 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | |
37 # OF THE POSSIBILITY OF SUCH DAMAGE. | |
38 # | |
39 | |
40 RTPW=./rtpw | |
41 DEST_PORT=9999 | |
42 DURATION=3 | |
43 | |
44 key=Ky7cUDT2GnI0XKWYbXv9AYmqbcLsqzL9mvdN9t/G | |
45 | |
46 ARGS="-b $key -a -e 128" | |
47 | |
48 # First, we run "killall" to get rid of all existing rtpw processes. | |
49 # This step also enables this script to clean up after itself; if this | |
50 # script is interrupted after the rtpw processes are started but before | |
51 # they are killed, those processes will linger. Re-running the script | |
52 # will get rid of them. | |
53 | |
54 killall rtpw 2>/dev/null | |
55 | |
56 if test -x $RTPW; then | |
57 | |
58 echo $0 ": starting rtpw receiver process... " | |
59 | |
60 $RTPW $* $ARGS -r 0.0.0.0 $DEST_PORT & | |
61 | |
62 receiver_pid=$! | |
63 | |
64 echo $0 ": receiver PID = $receiver_pid" | |
65 | |
66 sleep 1 | |
67 | |
68 # verify that the background job is running | |
69 ps | grep -q $receiver_pid | |
70 retval=$? | |
71 echo $retval | |
72 if [ $retval != 0 ]; then | |
73 echo $0 ": error" | |
74 exit 254 | |
75 fi | |
76 | |
77 echo $0 ": starting rtpw sender process..." | |
78 | |
79 $RTPW $* $ARGS -s 127.0.0.1 $DEST_PORT & | |
80 | |
81 sender_pid=$! | |
82 | |
83 echo $0 ": sender PID = $sender_pid" | |
84 | |
85 # verify that the background job is running | |
86 ps | grep -q $sender_pid | |
87 retval=$? | |
88 echo $retval | |
89 if [ $retval != 0 ]; then | |
90 echo $0 ": error" | |
91 exit 255 | |
92 fi | |
93 | |
94 sleep $DURATION | |
95 | |
96 kill $receiver_pid | |
97 kill $sender_pid | |
98 | |
99 wait $receiver_pid | |
100 wait $sender_pid | |
101 | |
102 | |
103 key=033490ba9e82994fc21013395739038992b2edc5034f61a72345ca598d7bfd0189aa6dc2ecab
32fd9af74df6dfc6 | |
104 | |
105 ARGS="-k $key -a -e 256" | |
106 | |
107 echo $0 ": starting rtpw receiver process... " | |
108 | |
109 $RTPW $* $ARGS -r 0.0.0.0 $DEST_PORT & | |
110 | |
111 receiver_pid=$! | |
112 | |
113 echo $0 ": receiver PID = $receiver_pid" | |
114 | |
115 sleep 1 | |
116 | |
117 # verify that the background job is running | |
118 ps | grep -q $receiver_pid | |
119 retval=$? | |
120 echo $retval | |
121 if [ $retval != 0 ]; then | |
122 echo $0 ": error" | |
123 exit 254 | |
124 fi | |
125 | |
126 echo $0 ": starting rtpw sender process..." | |
127 | |
128 $RTPW $* $ARGS -s 127.0.0.1 $DEST_PORT & | |
129 | |
130 sender_pid=$! | |
131 | |
132 echo $0 ": sender PID = $sender_pid" | |
133 | |
134 # verify that the background job is running | |
135 ps | grep -q $sender_pid | |
136 retval=$? | |
137 echo $retval | |
138 if [ $retval != 0 ]; then | |
139 echo $0 ": error" | |
140 exit 255 | |
141 fi | |
142 | |
143 sleep $DURATION | |
144 | |
145 kill $receiver_pid | |
146 kill $sender_pid | |
147 | |
148 wait $receiver_pid | |
149 wait $sender_pid | |
150 | |
151 echo $0 ": done (test passed)" | |
152 | |
153 else | |
154 | |
155 echo "error: can't find executable" $RTPW | |
156 exit 1 | |
157 | |
158 fi | |
159 | |
160 # EOF | |
161 | |
162 | |
OLD | NEW |