diff --git a/samples/js/apprtc/turn-prober/README b/samples/js/apprtc/turn-prober/README new file mode 100644 index 0000000000..58ba3398ab --- /dev/null +++ b/samples/js/apprtc/turn-prober/README @@ -0,0 +1,9 @@ +This script contains a simple prober that verifies that: +- CEOD vends TURN server URIs with credentials on demand (mimicking apprtc) +- rfc5766-turn-server vends TURN candidates from the servers vended by CEOD. + +To use simply run ./turn-prober.sh +If it prints "PASS" (and exits 0) then all is well. +If it prints a mess of logs (and exits non-0) then something has gone sideways +and apprtc.appspot.com is probably not working well (b/c of missing TURN +functionality). diff --git a/samples/js/apprtc/turn-prober/turn-prober.html b/samples/js/apprtc/turn-prober/turn-prober.html new file mode 100644 index 0000000000..94cf68ecfc --- /dev/null +++ b/samples/js/apprtc/turn-prober/turn-prober.html @@ -0,0 +1,132 @@ + +
+ + + + + diff --git a/samples/js/apprtc/turn-prober/turn-prober.sh b/samples/js/apprtc/turn-prober/turn-prober.sh new file mode 100755 index 0000000000..2006dccb4f --- /dev/null +++ b/samples/js/apprtc/turn-prober/turn-prober.sh @@ -0,0 +1,45 @@ +#!/bin/bash -e + +function chrome_pids() { + ps axuwww|grep $D|grep c[h]rome|awk '{print $2}' +} + +cd $(dirname $0) +export D=$(mktemp -d) + +CHROME_LOG_FILE="${D}/chrome_debug.log" +touch $CHROME_LOG_FILE + +chrome \ + --enable-logging=stderr \ + --no-first-run \ + --disable-web-security \ + --user-data-dir=$D \ + --vmodule="*media/*=3,*turn*=3" \ + "file://${PWD}/turn-prober.html" > $CHROME_LOG_FILE 2>&1 & +CHROME_PID=$! + +while ! grep -q DONE $CHROME_LOG_FILE && chrome_pids|grep -q .; do + sleep 0.1 +done + +# Suppress bash's Killed message for the chrome above. +exec 3>&2 +exec 2>/dev/null +while [ ! -z "$(chrome_pids)" ]; do + kill -9 $(chrome_pids) +done +exec 2>&3 +exec 3>&- + +DONE=$(grep DONE $CHROME_LOG_FILE) +EXIT_CODE=0 +if grep -q "DONE: PASS" $CHROME_LOG_FILE; then + echo "PASS" +else + cat $CHROME_LOG_FILE + EXIT_CODE=1 +fi + +rm -rf $D +exit $EXIT_CODE