[PATCH 1 of 2] hghave: checking that all targets are Exception-free

Nicolas Dumazet nicdumz at gmail.com
Tue Apr 7 12:35:28 CDT 2009


# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1239125640 -32400
# Node ID 70061f224d7920b2db2600d418d977f2364fdc22
# Parent  75c20420875e7fbb6e29c061f40a38288f07d6f1
hghave: checking that all targets are Exception-free

diff --git a/tests/hghave b/tests/hghave
--- a/tests/hghave
+++ b/tests/hghave
@@ -190,7 +190,20 @@
         desc = feature[1]
         print name + ':', desc
 
+def test_features():
+    failed = 0
+    for name, feature in checks.iteritems():
+        check, _ = feature
+        try:
+            check()
+        except Exception, e:
+            print "feature %s failed:  %s" % (name, e)
+            failed += 1
+    return failed
+
 parser = optparse.OptionParser("%prog [options] [features]")
+parser.add_option("--test-features", action="store_true",
+                  help="test available features")
 parser.add_option("--list-features", action="store_true",
                   help="list available features")
 parser.add_option("-q", "--quiet", action="store_true",
@@ -202,6 +215,9 @@
         list_features()
         sys.exit(0)
 
+    if options.test_features:
+        sys.exit(test_features())
+
     quiet = options.quiet
 
     failures = 0
diff --git a/tests/test-hghave b/tests/test-hghave
new file mode 100755
--- /dev/null
+++ b/tests/test-hghave
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Testing that hghave does not crash when checking features
+
+"$TESTDIR/hghave" --test-features 2>/dev/null
diff --git a/tests/test-hghave.out b/tests/test-hghave.out
new file mode 100644


More information about the Mercurial-devel mailing list