changeset 16319:ac0da5caebec stable

tests: teach hghave to actually test for symlink support
author Matt Mackall <mpm@selenic.com>
date Sat, 31 Mar 2012 10:44:31 -0500
parents 80a6a68906bf
children e11ab387e89c
files tests/hghave
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/hghave	Fri Mar 30 14:29:50 2012 -0500
+++ b/tests/hghave	Sat Mar 31 10:44:31 2012 -0500
@@ -161,6 +161,15 @@
     return matchoutput('p4 -V', r'Rev\. P4/') and matchoutput('p4d -V', r'Rev\. P4D/')
 
 def has_symlink():
+    if not hasattr(os, "symlink"):
+        return False
+    name = tempfile.mktemp(dir=".", prefix='hg-checklink-')
+    try:
+        os.symlink(".", name)
+        os.unlink(name)
+        return True
+    except (OSError, AttributeError):
+        return False
     return hasattr(os, "symlink") # FIXME: should also check file system and os
 
 def has_tla():