summaryrefslogtreecommitdiff
path: root/multinetwork/quick_test.sh
diff options
context:
space:
mode:
authorErik Kline <ek@google.com>2016-01-22 09:07:44 +0900
committerErik Kline <ek@google.com>2016-05-30 17:56:18 +0900
commit871e63d9b7e584bc398dd4aa983cf561a5e8394e (patch)
treea3208bbc5055f235241938a6fd1238b2bd522197 /multinetwork/quick_test.sh
parent27879586fff26d5ac1864f57bf441a39f8ab9315 (diff)
downloadextras-871e63d9b7e584bc398dd4aa983cf561a5e8394e.tar.gz
Add multinetwork debugging tools, dnschk and httpurl
Bug: 19537384 Bug: 27199751 Bug: 28719525 Change-Id: Ie983ec12ac6c550fa76c89cd44343220688a99b4
Diffstat (limited to 'multinetwork/quick_test.sh')
-rwxr-xr-xmultinetwork/quick_test.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/multinetwork/quick_test.sh b/multinetwork/quick_test.sh
new file mode 100755
index 00000000..f586bae8
--- /dev/null
+++ b/multinetwork/quick_test.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+nethandle=0
+
+readonly TEST_HOST="connectivitycheck.gstatic.com"
+readonly TEST_PATH="/generate_204"
+readonly PREFIX=">>>"
+
+function getUrls() {
+ if [ ! -z $(echo "$1" | sed -e 's/[^:]//g') ]; then
+ echo "http://[$1]$TEST_PATH"
+ echo "http://[$1]:80$TEST_PATH"
+ else
+ echo "http://$1$TEST_PATH"
+ echo "http://$1:80$TEST_PATH"
+ fi
+}
+
+function toHex() {
+ readonly local hexValue=$(bc -q 2>/dev/null << EOT
+obase=16
+$1
+EOT
+)
+ if [ ! -z "$hexValue" ]; then
+ echo "0x$hexValue"
+ fi
+}
+
+
+if [ ! -z "$1" ]; then
+ nethandle="$1"
+fi
+echo "$PREFIX Using nethandle $nethandle ($(toHex $nethandle))"
+echo ""
+
+readonly IPADDRESSES=$(
+ adb shell /system/xbin/dnschk --nethandle $nethandle $TEST_HOST |
+ sed -e 's/#.*//' -e '/^$/d')
+
+
+for host in $TEST_HOST $IPADDRESSES; do
+ urls=$(getUrls $host)
+ for url in $urls; do
+ echo "$PREFIX Checking $url" >&2
+ adb shell /system/xbin/httpurl --nethandle $nethandle "$url"
+ done
+done