diff tests/test-symlink-os-yes-fs-no.py @ 30448:8836f13e3c5b

posix: give checklink a fast path that cache the check file and is read only util.checklink would create a symlink and remove it again. That would sometimes happen multiple times. Write operations are relatively expensive and give disk tear and noise for applications monitoring file system activity. Instead of creating a symlink and deleting it again, just create it once and leave it in .hg/cache/check-link . If the file exists, just verify that os.islink reports true. We will assume that this check is as good as symlink creation not failing. Note: The symlink left in .hg/cache has to resolve to a file - otherwise 'make dist' will fail ... test-symlink-os-yes-fs-no.py does some monkey patching to simulate a platform without symlink support. The slightly different testing method requires additional monkeying.
author Mads Kiilerich <madski@unity3d.com>
date Wed, 14 Jan 2015 01:15:26 +0100
parents 3b453513f1fe
children d83ca854fa21
line wrap: on
line diff
--- a/tests/test-symlink-os-yes-fs-no.py	Thu Nov 17 12:59:36 2016 +0100
+++ b/tests/test-symlink-os-yes-fs-no.py	Wed Jan 14 01:15:26 2015 +0100
@@ -35,6 +35,9 @@
 def symlink_failure(src, dst):
     raise OSError(1, "Operation not permitted")
 os.symlink = symlink_failure
+def islink_failure(path):
+    return False
+os.path.islink = islink_failure
 
 # dereference links as if a Samba server has exported this to a
 # Windows client