Patchwork [1,of,3] hghave: add a check for lfs-test-server

login
register
mail settings
Submitter Matt Harbison
Date Nov. 21, 2017, 6:31 a.m.
Message ID <b105c5b0f7808ba552f8.1511245872@Envy>
Download mbox | patch
Permalink /patch/25699/
State Accepted
Headers show

Comments

Matt Harbison - Nov. 21, 2017, 6:31 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1510716942 18000
#      Tue Nov 14 22:35:42 2017 -0500
# Node ID b105c5b0f7808ba552f8a0425c74f5540e82c3f5
# Parent  699b2a759319966cc496da16d3e39ad539175988
hghave: add a check for lfs-test-server

This is consistent with how the other tests require a feature.

Patch

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -284,6 +284,17 @@ 
         return (0, 0)
     return (int(m.group(1)), int(m.group(2)))
 
+# https://github.com/git-lfs/lfs-test-server
+@check("lfs-test-server", "git-lfs test server")
+def has_lfsserver():
+    exe = 'lfs-test-server'
+    if has_windows():
+        exe = 'lfs-test-server.exe'
+    return any(
+        os.access(os.path.join(path, exe), os.X_OK)
+        for path in os.environ["PATH"].split(os.pathsep)
+    )
+
 @checkvers("git", "git client (with ext::sh support) version >= %s", (1.9,))
 def has_git_range(v):
     major, minor = v.split('.')[0:2]
diff --git a/tests/test-lfs-test-server.t b/tests/test-lfs-test-server.t
--- a/tests/test-lfs-test-server.t
+++ b/tests/test-lfs-test-server.t
@@ -1,6 +1,4 @@ 
-Require lfs-test-server (https://github.com/git-lfs/lfs-test-server)
-
-  $ hash lfs-test-server || { echo 'skipped: missing lfs-test-server'; exit 80; }
+#require lfs-test-server
 
   $ LFS_LISTEN="tcp://:$HGPORT"
   $ LFS_HOST="localhost:$HGPORT"