Add network-attach tests
PATCH 1/1 Add network-attach tests
Add some network-attach tests
Signed-off-by Murillo Fernandes Bernardes <[email protected]>
Signature · 2 lines
Murillo Fernandes Bernardes IBM Linux Technology Center
# HG changeset patch
# User [email protected]
# Node ID 5fcbd8885523fae79eb192c180a9311b6ac71830 # Parent 29b6de0d503ef068609f2c60d54bc00d52b7cbdb
xm-test: add tests for network-attach command
Signed-off-by Murillo Fernandes Bernardes <[email protected]>
tools/xm-test/configure.ac +1 -0
@@ -50,6 +50,7 @@ tests/memmax/Makefile tests/memset/Makefile tests/migrate/Makefile + tests/network-attach/Makefile tests/pause/Makefile tests/reboot/Makefile tests/restore/Makefile
tools/xm-test/tests/Makefile.am +1 -0
@@ -13,6 +13,7 @@ list \ memmax \ memset \ + network-attach \ pause \ reboot \ sedf \
tools/xm-test/tests/network-attach/01_network_attach_pos.py new file +48 -0
48 lines not on this page · raw message
tools/xm-test/tests/network-attach/02_network_attach_detach_pos.py new file +54 -0
54 lines not on this page · raw message
tools/xm-test/tests/network-attach/03_network_attach_detach_multiple_pos.py new file +54 -0
54 lines not on this page · raw message
tools/xm-test/tests/network-attach/04_network_attach_baddomain_neg.py new file +17 -0
@@ -0,0 +1,17 @@ +#!/usr/bin/python + +# Copyright (C) International Business Machines Corp., 2005 +# Author: Murillo F. Bernardes <[email protected]> + +from XmTestLib import * + +status, output = traceCommand("xm network-attach NOT-EXIST") + +eyecatcher = "Error" +where = output.find(eyecatcher) +if status == 0: + FAIL("xm block-attach returned bad status, expected non 0, status is: %i" % status ) +elif where == -1: + FAIL("xm block-attach returned bad output, expected Error, output is: %s" % output ) + +
tools/xm-test/tests/network-attach/Makefile.am new file +24 -0
@@ -0,0 +1,24 @@ + +SUBDIRS = + +TESTS = 01_network_attach_pos.test \ + 02_network_attach_detach_pos.test \ + 03_network_attach_detach_multiple_pos.test \ + 04_network_attach_baddomain_neg.test + +DISABLED = + +EXTRA_DIST = $(TESTS) $(XFAIL_TESTS) network_utils.py + +TESTS_ENVIRONMENT=@TENV@ + +%.test: %.py + cp $< $@ + chmod +x $@ + +clean-local: am_config_clean-local + +am_config_clean-local: + rm -f *test + rm -f *log + rm -f *~
tools/xm-test/tests/network-attach/network_utils.py new file +37 -0
@@ -0,0 +1,37 @@ +#!/usr/bin/python + +# Copyright (C) International Business Machines Corp., 2005 +# Author: Murillo F. Bernardes <[email protected]> + +from XmTestLib import * + +def count_eth(console): + try: + run = console.runCmd("ifconfig -a | grep eth") + except ConsoleError, e: + FAIL(str(e)) + return = len(run['output'].splitlines()) + +def network_attach(domain_name, console): + eths_before = count_eth(console) + status, output = traceCommand("xm network-attach %s" % domain_name) + if status != 0: + return -1, "xm network-attach returned invalid %i != 0" % status + + eths_after = count_eth(console) + if (eths_after != (eths_before+1)): + return -2, "Network device is not actually connected to domU" + + return 0, None + +def network_detach(domain_name, console, num=0): + eths_before = count_eth(console) + status, output = traceCommand("xm network-detach %s %d" % (domain_name, num)) + if status != 0: + return -1, "xm network-attach returned invalid %i != 0" % status + + eths_after = count_eth(console) + if eths_after != (eths_before-1): + return -2, "Network device was not actually disconnected from domU" + + return 0, None
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Ewan Mellor
AppliedQuoted 3 lines · Murillo Fernandes Bernardes
Add some network-attach tests
Signed-off-by Murillo Fernandes Bernardes <[email protected]>
Applied. Thank you!
Ewan.