summaryrefslogtreecommitdiff
path: root/test_bandwidth_limit
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2011-09-04 18:44:50 +0300
committerAlon Levy <alevy@redhat.com>2011-09-04 18:44:50 +0300
commit99c9549a96bdb1e4c876cc0b9b52fe1aa57757c0 (patch)
treeca6efaac0c224eeeef5a94c96ce8e5cc73bf7a86 /test_bandwidth_limit
parent1e60f86302026184e9301ae6171654342458abc2 (diff)
adding --bandwidth-limit, but not working right. tester freezes uiHEADmaster
Diffstat (limited to 'test_bandwidth_limit')
-rwxr-xr-xtest_bandwidth_limit39
1 files changed, 39 insertions, 0 deletions
diff --git a/test_bandwidth_limit b/test_bandwidth_limit
new file mode 100755
index 0000000..8669768
--- /dev/null
+++ b/test_bandwidth_limit
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# Doesn't actually work but gives a usage example
+
+if [ "x$1" == "xpv" ]; then
+ nc -l 15000 | pv > /dev/null
+ exit 0
+fi
+
+if [ "x$1" == "xcat" ]; then
+ cat /dev/zero | nc localhost 13300
+ exit 0
+fi
+
+gnome-terminal --geometry 80x5 -e "./test_bandwidth_limit pv"
+PID1=$!
+echo PID1 = $PID1
+# --bandwidth-limit 1024
+./bandwidthmon --listen-port 13300 --remote-port 15000 --bandwidth-limit 1024 &
+PID2=$!
+sleep 1
+gnome-terminal --geometry 80x3 -e "./test_bandwidth_limit cat"
+PID3=$!
+echo PID3 = $PID3
+
+function sigint {
+ echo "SIGINT caught"
+ if [ "x$PID1" != "x" ]; then
+ kill $PID1
+ fi
+ kill $PID2
+ kill $PID3
+}
+
+# SIGINT
+trap sigint SIGINT
+
+wait
+echo "all processes exited"