changeset 5158:b1e147f60d62

Merge with crew-stable
author Patrick Mezard <pmezard@gmail.com>
date Tue, 14 Aug 2007 16:30:38 +0200
parents ec24bfd852ab (current diff) 105d4cf7ec24 (diff)
children aba624d2301d
files tests/test-profile
diffstat 4 files changed, 38 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/demandimport.py
+++ b/mercurial/demandimport.py
@@ -108,7 +108,18 @@ def _demandimport(name, globals=None, lo
                 setattr(mod, x, _demandmod(x, mod.__dict__, locals))
         return mod
 
-ignore = ['_hashlib', '_xmlplus', 'fcntl', 'win32com.gen_py', 'pwd', 'grp']
+ignore = [
+    '_hashlib',
+    '_xmlplus',
+    'fcntl',
+    'win32com.gen_py',
+    # imported by tarfile, not available under Windows
+    'pwd',
+    'grp',
+    # imported by profile, itself imported by hotshot.stats,
+    # not available under Windows
+    'resource',
+    ]
 
 def enable():
     "enable global demand-loading of modules"
--- a/tests/hghave
+++ b/tests/hghave
@@ -35,11 +35,19 @@ def has_eol_in_paths():
     except:
         return False
 
+def has_lsprof():
+    try:
+        import _lsprof
+        return True
+    except ImportError:
+        return False
+
 checks = {
-    "symlink": (has_symlink, "symbolic links"),
+    "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"),
+    "execbit": (has_executablebit, "executable bit"),
     "fifo": (has_fifo, "named pipes"),
-    "execbit": (has_executablebit, "executable bit"),
-    "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"),
+    "lsprof": (has_lsprof, "python lsprof module"),
+    "symlink": (has_symlink, "symbolic links"),
 }
 
 def list_features():
new file mode 100755
--- /dev/null
+++ b/tests/test-profile
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+echo % test --time
+hg --time help 2>&1 | grep -q Time || echo --time failed
+
+echo % test --profile
+hg --profile help 2>&1 | grep -q ncalls || echo --profile failed
+
+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
new file mode 100644
--- /dev/null
+++ b/tests/test-profile.out
@@ -0,0 +1,3 @@
+% test --time
+% test --profile
+% test --lsprof