Updated README; added test descriptions to --list
diff --git a/README b/README
index 4f74942..b27ad5b 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
OpenFlow Testing Framework
-February, 2010
+March, 2010
Warning
+++++++
@@ -135,6 +135,12 @@
parameters this way. Each test case in the new file must derive
from unittest.TestCase.
+ CONVENTIONS:
+
+ The first line of the doc string for a file and for a test class is
+ displayed in the list command. Please keep it clear and under 50
+ characters.
+
Using CentOS/RHEL
+++++++++++++++++
diff --git a/tests/basic.py b/tests/basic.py
index 9110f1f..cc0bea4 100644
--- a/tests/basic.py
+++ b/tests/basic.py
@@ -1,5 +1,5 @@
"""
-Basic test cases for the oftest OpenFlow test framework
+Basic protocol and dataplane test cases
It is recommended that these definitions be kept in their own
namespace as different groups of tests will likely define
diff --git a/tests/oft b/tests/oft
index 0b54a99..0ccebda 100755
--- a/tests/oft
+++ b/tests/oft
@@ -311,6 +311,16 @@
logging.info("Adding test " + mod.__name__ + "." + name)
suite.addTest(eval("mod." + name)())
+def _space_to(n, str):
+ """
+ Generate a string of spaces to achieve width n given string str
+ If length of str >= n, return one space
+ """
+ spaces = n - len(str)
+ if spaces > 0:
+ return " " * spaces
+ return " "
+
#
# Main script
#
@@ -322,11 +332,25 @@
# Check if test list is requested; display and exit if so
if config["list"]:
+ did_print = False
print "\nTest List:"
for mod in config["all_tests"].keys():
- print " Module: " + mod.__name__
+ if config["test_spec"] != "all" and \
+ config["test_spec"] != mod.__name__:
+ continue
+ did_print = True
+ desc = mod.__doc__.strip()
+ desc = desc.split('\n')[0]
+ start_str = " Module " + mod.__name__ + ": "
+ print start_str + _space_to(22, start_str) + desc
for test in config["all_tests"][mod]:
- print " " + test
+ desc = eval('mod.' + test + '.__doc__.strip()')
+ desc = desc.split('\n')[0]
+ start_str = " " + test + ":"
+ print start_str + _space_to(22, start_str) + desc
+ print
+ if not did_print:
+ print "No tests found for " + config["test_spec"]
sys.exit(0)
logging_setup(config)