OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 # | 2 # |
3 # usage: rtpw_test <rtpw_commands> | 3 # usage: rtpw_test <rtpw_commands> |
4 # | 4 # |
5 # tests the rtpw sender and receiver functions | 5 # tests the rtpw sender and receiver functions |
| 6 # |
6 # Copyright (c) 2001-2006, Cisco Systems, Inc. | 7 # Copyright (c) 2001-2006, Cisco Systems, Inc. |
7 # All rights reserved. | 8 # All rights reserved. |
8 # | 9 # |
9 # Redistribution and use in source and binary forms, with or without | 10 # Redistribution and use in source and binary forms, with or without |
10 # modification, are permitted provided that the following conditions | 11 # modification, are permitted provided that the following conditions |
11 # are met: | 12 # are met: |
12 # | 13 # |
13 # Redistributions of source code must retain the above copyright | 14 # Redistributions of source code must retain the above copyright |
14 # notice, this list of conditions and the following disclaimer. | 15 # notice, this list of conditions and the following disclaimer. |
15 # | 16 # |
(...skipping 11 matching lines...) Expand all Loading... |
27 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 28 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
28 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | 29 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
29 # COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | 30 # COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
30 # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 31 # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
31 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 32 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
32 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 33 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
33 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 34 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
34 # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 35 # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
35 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 36 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
36 # OF THE POSSIBILITY OF SUCH DAMAGE. | 37 # OF THE POSSIBILITY OF SUCH DAMAGE. |
| 38 # |
37 | 39 |
38 RTPW=./rtpw | 40 RTPW=./rtpw |
39 DEST_PORT=9999 | 41 DEST_PORT=9999 |
40 DURATION=3 | 42 DURATION=3 |
41 | 43 |
42 key=2b2edc5034f61a72345ca5986d7bfd0189aa6dc2ecab32fd9af74df6dfc6 | 44 key=Ky7cUDT2GnI0XKWYbXv9AYmqbcLsqzL9mvdN9t/G |
43 | 45 |
44 ARGS="-k $key -ae" | 46 ARGS="-b $key -a -e 128" |
45 | 47 |
46 # First, we run "killall" to get rid of all existing rtpw processes. | 48 # First, we run "killall" to get rid of all existing rtpw processes. |
47 # This step also enables this script to clean up after itself; if this | 49 # This step also enables this script to clean up after itself; if this |
48 # script is interrupted after the rtpw processes are started but before | 50 # script is interrupted after the rtpw processes are started but before |
49 # they are killed, those processes will linger. Re-running the script | 51 # they are killed, those processes will linger. Re-running the script |
50 # will get rid of them. | 52 # will get rid of them. |
51 | 53 |
52 killall rtpw 2>/dev/null | 54 killall rtpw 2>/dev/null |
53 | 55 |
54 if test -x $RTPW; then | 56 if test -x $RTPW; then |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 fi | 92 fi |
91 | 93 |
92 sleep $DURATION | 94 sleep $DURATION |
93 | 95 |
94 kill $receiver_pid | 96 kill $receiver_pid |
95 kill $sender_pid | 97 kill $sender_pid |
96 | 98 |
97 wait $receiver_pid | 99 wait $receiver_pid |
98 wait $sender_pid | 100 wait $sender_pid |
99 | 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 |
100 echo $0 ": done (test passed)" | 151 echo $0 ": done (test passed)" |
101 | 152 |
102 else | 153 else |
103 | 154 |
104 echo "error: can't find executable" $RTPW | 155 echo "error: can't find executable" $RTPW |
105 exit 1 | 156 exit 1 |
106 | 157 |
107 fi | 158 fi |
108 | 159 |
109 # EOF | 160 # EOF |
110 | 161 |
111 | 162 |
OLD | NEW |