| OLD | NEW |
| (Empty) |
| 1 #!/bin/sh | |
| 2 # | |
| 3 # Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | |
| 4 # | |
| 5 # Use of this source code is governed by a BSD-style license | |
| 6 # that can be found in the LICENSE file in the root of the source | |
| 7 # tree. An additional intellectual property rights grant can be found | |
| 8 # in the file PATENTS. All contributing project authors may | |
| 9 # be found in the AUTHORS file in the root of the source tree. | |
| 10 # | |
| 11 # This script is used to record a tcp dump of running a loop back test. | |
| 12 # Example use case: | |
| 13 # | |
| 14 # $ ./run-server.sh & # spawns a server to serve the html pages | |
| 15 # # on localhost:8080 | |
| 16 # | |
| 17 # (recording 3 tests with 5mins and bitrates 1mbps, 2mbps and 3mbps) | |
| 18 # $ sudo -v # Caches sudo credentials needed | |
| 19 # # for tcpdump | |
| 20 # $ export INTERFACE=eth1 # Defines interface to record packets | |
| 21 # $ export CHROME_UNDER_TESTING=./chrome # Define which chrome to run on tests | |
| 22 # $ export TEST="http://localhost:8080/loopback_test.html?auto-mode=true" | |
| 23 # $ record-test.sh ./record1.pcap "$TEST&duration=300&max-video-bitrate=1000" | |
| 24 # $ record-test.sh ./record2.pcap "$TEST&duration=300&max-video-bitrate=2000" | |
| 25 # $ record-test.sh ./record3.pcap "$TEST&duration=300&max-video-bitrate=3000" | |
| 26 | |
| 27 # Indicate an error and exit with a nonzero status if any of the required | |
| 28 # environment variables is Null or Unset. | |
| 29 : ${INTERFACE:?"Need to set INTERFACE env variable"} | |
| 30 : ${CHROME_UNDER_TESTING:?"Need to set CHROME_UNDER_TESTING env variable"} | |
| 31 | |
| 32 if [ ! -x "$CHROME_UNDER_TESTING" ]; then | |
| 33 echo "CHROME_UNDER_TESTING=$CHROME_UNDER_TESTING does not seem to exist." | |
| 34 exit 1 | |
| 35 fi | |
| 36 | |
| 37 if [ "$#" -ne 2 ]; then | |
| 38 echo "Usage: $0 <test-url> <network-dump>" | |
| 39 exit 1 | |
| 40 fi | |
| 41 TEST_URL=$1 | |
| 42 OUTPUT_RECORDING=$2 | |
| 43 | |
| 44 sudo -nv > /dev/null 2>&1 | |
| 45 if [ $? != 0 ]; then | |
| 46 echo "Run \"sudo -v\" to cache your credentials." \ | |
| 47 "They are needed to run tcpdump." | |
| 48 exit | |
| 49 fi | |
| 50 | |
| 51 echo "Recording $INTERFACE into ${OUTPUT_RECORDING}" | |
| 52 sudo -n tcpdump -i "$INTERFACE" -w - > "${OUTPUT_RECORDING}" & | |
| 53 TCPDUMP_PID=$! | |
| 54 | |
| 55 echo "Starting ${CHROME_UNDER_TESTING} with ${TEST_URL}." | |
| 56 # Using real camera instead of --use-fake-device-for-media-stream as it | |
| 57 # does not produces images complex enough to reach 3mbps. | |
| 58 # Flag --use-fake-ui-for-media-stream automatically allows getUserMedia calls. | |
| 59 $CHROME_UNDER_TESTING --use-fake-ui-for-media-stream "${TEST_URL}" | |
| 60 kill ${TCPDUMP_PID} | |
| OLD | NEW |