Signed-off-by: YAMADA Hideki <[email protected]>
---
run_tests.sh | 34 +++++++++++++++++++++++++++++++++
ryu/tests/gui/run_servers.sh | 43 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 77 insertions(+), 0 deletions(-)
create mode 100755 ryu/tests/gui/run_servers.sh
diff --git a/run_tests.sh b/run_tests.sh
index bf703a6..6c3ced6 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -12,6 +12,7 @@ usage() {
echo " -P, --no-pep8 Don't run pep8"
echo " -l, --pylint Just run pylint"
echo " -i, --integrated Run integrated test"
+ echo " -g, --gui Run GUI test"
echo " -v, --verbose Run verbose pylint analysis"
echo " -h, --help Print this usage message"
echo ""
@@ -31,6 +32,7 @@ process_option() {
-P|--no-pep8) no_pep8=1;;
-l|--pylint) just_pylint=1;;
-i|--integrated) integrated=1;;
+ -g|--gui) gui=1;;
-c|--coverage) coverage=1;;
-v|--verbose) verbose=1;;
-*) noseopts="$noseopts $1";;
@@ -46,6 +48,7 @@ just_pep8=0
no_pep8=0
just_pylint=0
integrated=0
+gui=0
force=0
noseargs=
wrapper=""
@@ -115,6 +118,31 @@ run_integrated() {
INTEGRATED_TEST_RUNNER="./ryu/tests/integrated/run_tests_with_ovs12.py"
sudo PYTHONPATH=. nosetests -s $INTEGRATED_TEST_RUNNER
}
+
+run_gui() {
+ echo "Running GUI test ..."
+
+ ./ryu/tests/gui/run_servers.sh &
+ servers_pid=$!
+
+ # wait for servers coming up
+ sleep 10
+
+ ${wrapper} ./ryu/tests/gui/run_tests_with_chrome.py
+ RV1=$?
+ ${wrapper} ./ryu/tests/gui/run_tests_with_firefox.py
+ RV2=$?
+
+ kill $servers_pid
+ wait
+
+ if [ $RV1 -eq 0 -a $RV2 -eq 0 ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
#NOSETESTS="nosetests $noseopts $noseargs"
NOSETESTS="python ./ryu/tests/run_tests.py $noseopts $noseargs"
@@ -172,6 +200,12 @@ if [ $integrated -eq 1 ]; then
exit
fi
+if [ $gui -eq 1 ]; then
+ run_gui
+ RV=$?
+ exit $RV
+fi
+
run_tests
RV=$?
if [ $no_pep8 -eq 0 ]; then
diff --git a/ryu/tests/gui/run_servers.sh b/ryu/tests/gui/run_servers.sh
new file mode 100755
index 0000000..5f09913
--- /dev/null
+++ b/ryu/tests/gui/run_servers.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+set -e
+
+function run_servers() {
+ echo "Run servers..."
+
+ . $RYU_HOME/.venv/bin/activate
+ $RYU_HOME/bin/ryu-manager --verbose --observe-links --noinstall-lldp-flow \
+ $RYU_HOME/ryu/topology/switches.py \
+ $RYU_HOME/ryu/app/rest_topology.py \
+ $RYU_HOME/ryu/app/ofctl_rest.py \
+ 1>/dev/null 2>/dev/null &
+ ryu_pid=$!
+ echo "Ryu server's pid $ryu_pid"
+
+ $RYU_HOME/ryu/gui/controller.py 1>/dev/null 2>/dev/null &
+ gui_pid=$!
+ echo "GUI server's pid $gui_pid"
+
+ deactivate
+
+ sudo $RYU_HOME/ryu/tests/gui/tools/mn_ctl.py 1>/dev/null 2>/dev/null &
+ mn_pid=$!
+ echo "Mininet controll server's pid $mn_pid"
+}
+
+function kill_servers() {
+ echo "Kill servers..."
+
+ kill $ryu_pid
+ kill $gui_pid
+ sudo kill $mn_pid
+
+ echo "Done."
+}
+
+RYU_HOME=$(cd $(dirname $0) && cd ../../../ && pwd)
+
+run_servers
+
+trap "kill_servers" HUP INT QUIT TERM
+
+wait
--
1.7.1
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel