Add a --skip-tests option to the unittest_suite this can be used with --full to limit tests on a conditional basis (it is mostly used inside of other scripts).
Signed-off-by: Scott Zawalski <scottz@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@4259 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/utils/unittest_suite.py b/utils/unittest_suite.py
index 4ef8f7e..969c47e 100755
--- a/utils/unittest_suite.py
+++ b/utils/unittest_suite.py
@@ -13,6 +13,9 @@
help="whether to run the shortened version of the test")
parser.add_option("--debug", action="store_true", dest="debug", default=False,
help="run in debug mode")
+parser.add_option("--skip-tests", dest="skip_tests", default=[],
+ help="A space separated list of tests to skip")
+
LONG_TESTS = set((
'monitor_db_unittest.py',
@@ -31,6 +34,7 @@
'scheduler_models_unittest.py',
))
+
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
@@ -69,6 +73,9 @@
@param options: optparse options.
"""
modules = []
+ skip_tests = set()
+ if options.skip_tests:
+ skip_tests.update(options.skip_tests.split())
for dirpath, subdirs, filenames in os.walk(start):
# Only look in and below subdirectories that are python modules.
@@ -88,6 +95,8 @@
if fname.endswith('_unittest.py') or fname.endswith('_test.py'):
if not options.full and fname in LONG_TESTS:
continue
+ if fname in skip_tests:
+ continue
path_no_py = os.path.join(dirpath, fname).rstrip('.py')
assert path_no_py.startswith(ROOT)
names = path_no_py[len(ROOT)+1:].split('/')