# HG changeset patch # User Nicolas Dumazet # Date 2009-11-28 01:25:09 # Node ID b37b060d84c716ff529f4ae1a20c8dd2e94d9c57 # Parent 777c1df76ef4db0adf2de5c6503ebe747bd55cc7 run-tests: add a "--blacklist target" option to skip predefined test lists Rely on a ConfigParser file, tests/blacklist, to define blacklist targets. This allows exposing specific test suites for testing incomplete/particular features, e.g. "run-tests.py --blacklist inotify-failures --inotify *" diff --git a/tests/blacklist b/tests/blacklist new file mode 100644 --- /dev/null +++ b/tests/blacklist @@ -0,0 +1,14 @@ +# ConfigParser format +# Definitions of blacklists for run-tests.py +# +# Identify in config sections a list of tests you want to be skipped. +# Section names are meant to be used as targets for run-tests.py --blacklist +# option. +# "test-" prefixes should be omitted from test names. Values are not used. +# +# e.g. if your file looks like: +## [example] +## hgrc = +## help = "this string is not used" +# then calling "run-tests.py --blacklist example" will exclude test-hgrc and +# test-help from the list of tests to run. diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -41,6 +41,7 @@ # completes fairly quickly, includes both shell and Python scripts, and # includes some scripts that run daemon processes.) +from ConfigParser import ConfigParser import difflib import errno import optparse @@ -132,6 +133,9 @@ def parseargs(): help="enable Py3k warnings on Python 2.6+") parser.add_option("--inotify", action="store_true", help="enable inotify extension when running tests") + parser.add_option("--blacklist", action="append", + help="skip tests listed in the specified section of " + "the blacklist file") for option, default in defaults.items(): defaults[option] = int(os.environ.get(*default)) @@ -197,6 +201,14 @@ def parseargs(): if options.py3k_warnings: if sys.version_info[:2] < (2, 6) or sys.version_info[:2] >= (3, 0): parser.error('--py3k-warnings can only be used on Python 2.6+') + if options.blacklist: + configparser = ConfigParser() + configparser.read("blacklist") + blacklist = dict() + for section in options.blacklist: + for (item, value) in configparser.items(section): + blacklist["test-" + item] = section + options.blacklist = blacklist return (options, args) @@ -730,6 +742,13 @@ def runtests(options, tests): fails = [] for test in tests: + if options.blacklist: + section = options.blacklist.get(test) + if section is not None: + skips.append((test, "blacklisted (%s section)" % section)) + skipped += 1 + continue + if options.retest and not os.path.exists(test + ".err"): skipped += 1 continue