test-profile: fix grep, check hotshot availability
authorPatrick Mezard <pmezard@gmail.com>
Tue, 14 Aug 2007 18:53:45 +0200
changeset 5102 9b0efeb725f4
parent 5101 24d306834de5
child 5103 e5b21a549cc5
child 5168 8114142092a8
test-profile: fix grep, check hotshot availability
tests/hghave
tests/test-profile
--- a/tests/hghave	Tue Aug 14 17:20:51 2007 +0200
+++ b/tests/hghave	Tue Aug 14 18:53:45 2007 +0200
@@ -35,6 +35,13 @@
     except:
         return False
 
+def has_hotshot():
+    try:
+        import hotshot
+        return True
+    except ImportError:
+        return False
+
 def has_lsprof():
     try:
         import _lsprof
@@ -46,6 +53,7 @@
     "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"),
     "execbit": (has_executablebit, "executable bit"),
     "fifo": (has_fifo, "named pipes"),
+    "hotshot": (has_hotshot, "python hotshot module"),
     "lsprof": (has_lsprof, "python lsprof module"),
     "symlink": (has_symlink, "symbolic links"),
 }
--- a/tests/test-profile	Tue Aug 14 17:20:51 2007 +0200
+++ b/tests/test-profile	Tue Aug 14 18:53:45 2007 +0200
@@ -1,12 +1,15 @@
 #!/bin/sh
 
 echo % test --time
-hg --time help 2>&1 | grep -q Time || echo --time failed
+hg --time help -q help 2>&1 | grep Time > /dev/null || echo --time failed
 
 echo % test --profile
-hg --profile help 2>&1 | grep -q ncalls || echo --profile failed
+if "$TESTDIR/hghave" -q hotshot; then
+    # hotshot might be missing for licensing issues
+    hg --profile help -q help 2>&1 | grep ncalls > /dev/null || echo --profile failed
+fi
 
 echo % test --lsprof
 if "$TESTDIR/hghave" -q lsprof; then
-    hg --lsprof help 2>&1 | grep -q CallCount || echo --lsprof failed
-fi
\ No newline at end of file
+    hg --lsprof help -q help 2>&1 | grep CallCount > /dev/null || echo --lsprof failed
+fi