[PATCH] run-tests: split tests/blacklist in tests/blacklists/*

Nicolas Dumazet nicdumz at gmail.com
Wed Dec 16 22:30:58 CST 2009


# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1260433291 -32400
# Node ID 6e0fd424cff1a999fea8d286c5222441efe96389
# Parent  ceae6ff0555208531dc996a64bf268e5bde4dd4c
run-tests: split tests/blacklist in tests/blacklists/*

Following discussions with Gilles Morris [1], it seems that it is preferable to
use several blacklist files in a blacklists/ directory. It is easier to add an
unversioned file for experiments than modifying a tracked file.

Also fall back to a simpler syntax, giving up ConfigParser, now that section
names are not needed anymore.

And allow --blacklist parameter to be a complete path, instead of only one
of the filenames contained in tests/blacklists/


[1] http://www.selenic.com/pipermail/mercurial-devel/2009-December/017317.html

diff --git a/tests/blacklists/README b/tests/blacklists/README
new file mode 100644
--- /dev/null
+++ b/tests/blacklists/README
@@ -0,0 +1,14 @@
+Put here definitions of blacklists for run-tests.py
+
+Create a file per blacklist. Each file should list the names of tests that you
+want to be skipped.
+File names are meant to be used as targets for run-tests.py --blacklist
+option.
+Lines starting with # are ignored. White spaces are stripped.
+
+e.g. if you create a blacklist/example file containing:
+ hgrc
+ # some comment
+ help
+then calling "run-tests.py --blacklist blacklists/example" will exclude
+test-hgrc and test-help from the list of tests to run.
diff --git a/tests/blacklist b/tests/blacklists/inotify-failures
rename from tests/blacklist
rename to tests/blacklists/inotify-failures
--- a/tests/blacklist
+++ b/tests/blacklists/inotify-failures
@@ -1,37 +1,21 @@
-# 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.
-
-[inotify-failures]
 # When --inotify is activated, help output and config changes:
-debugcomplete =
-empty =
-fncache =
-globalopts =
-help =
-hgrc =
-inherit-mode =
-qrecord =
-strict =
+test-debugcomplete
+test-empty
+test-fncache
+test-globalopts
+test-help
+test-hgrc
+test-inherit-mode
+test-qrecord
+test-strict
 
 # --inotify activates de facto the inotify extension. It does not play well
 # with inotify-specific tests, which activate/desactivate inotify at will:
-inotify =
-inotify-debuginotify =
-inotify-dirty-dirstate =
-inotify-issue1208 =
-inotify-issue1371 =
-inotify-issue1542 =
-inotify-issue1556 =
-inotify-lookup =
+test-inotify
+test-inotify-debuginotify
+test-inotify-dirty-dirstate
+test-inotify-issue1208
+test-inotify-issue1371
+test-inotify-issue1542
+test-inotify-issue1556
+test-inotify-lookup
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -41,7 +41,6 @@
 # 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
@@ -134,8 +133,7 @@
     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")
+        help="skip tests listed in the specified blacklist file")
 
     for option, default in defaults.items():
         defaults[option] = int(os.environ.get(*default))
@@ -202,12 +200,22 @@
         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
+        for filename in options.blacklist:
+            try:
+                path = os.path.expanduser(os.path.expandvars(filename))
+                f = open(path, "r")
+            except IOError, err:
+                if err.errno != errno.ENOENT:
+                    raise
+                print "warning: no such blacklist file: %s" % filename
+                continue
+
+            for line in f.readlines():
+                line = line.strip()
+                if line and not line.startswith('#'):
+                    blacklist[line] = filename
+
         options.blacklist = blacklist
 
     return (options, args)
@@ -744,9 +752,9 @@
 
         for test in tests:
             if options.blacklist:
-                section = options.blacklist.get(test)
-                if section is not None:
-                    skips.append((test, "blacklisted (%s section)" % section))
+                filename = options.blacklist.get(test)
+                if filename is not None:
+                    skips.append((test, "blacklisted (%s)" % filename))
                     skipped += 1
                     continue
 


More information about the Mercurial-devel mailing list