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