hghave: checking that all targets are Exception-free
authorNicolas Dumazet <nicdumz.commits@gmail.com>
Wed, 08 Apr 2009 02:34:00 +0900
changeset 8059 41a2c5cbcb6a
parent 8058 a0555ae394b3
child 8060 84d0fe34427b
hghave: checking that all targets are Exception-free
tests/hghave
tests/test-hghave
tests/test-hghave.out
--- a/tests/hghave	Sat Apr 11 21:58:28 2009 +0200
+++ b/tests/hghave	Wed Apr 08 02:34:00 2009 +0900
@@ -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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-hghave	Wed Apr 08 02:34:00 2009 +0900
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Testing that hghave does not crash when checking features
+
+"$TESTDIR/hghave" --test-features 2>/dev/null