Patchwork [5,of,5,STABLE] tests: add daytime port have clause

login
register
mail settings
Submitter Sean Farley
Date April 17, 2016, 7:12 a.m.
Message ID <4fdc9a491b58f472bf29.1460877141@laptop.local>
Download mbox | patch
Permalink /patch/14702/
State Superseded
Headers show

Comments

Sean Farley - April 17, 2016, 7:12 a.m.
# HG changeset patch
# User Sean Farley <sean@farley.io>
# Date 1460844307 25200
#      Sat Apr 16 15:05:07 2016 -0700
# Branch stable
# Node ID 4fdc9a491b58f472bf29ec81bf6f2acd3e108916
# Parent  aacc82cc8cde7803d9ff9d17452a67cde0610171
# EXP-Topic ppa
tests: add daytime port have clause

Apparently, some machines don't have this service (launchpad builders are one
such example). Let's add a simple guard around the test.
Julien Cristau - April 17, 2016, 7:39 a.m.
On Sun, Apr 17, 2016 at 00:12:21 -0700, Sean Farley wrote:

> # HG changeset patch
> # User Sean Farley <sean@farley.io>
> # Date 1460844307 25200
> #      Sat Apr 16 15:05:07 2016 -0700
> # Branch stable
> # Node ID 4fdc9a491b58f472bf29ec81bf6f2acd3e108916
> # Parent  aacc82cc8cde7803d9ff9d17452a67cde0610171
> # EXP-Topic ppa
> tests: add daytime port have clause
> 
> Apparently, some machines don't have this service (launchpad builders are one
> such example). Let's add a simple guard around the test.
> 
If it's lack of /etc/services, a build-dependency on netbase might fix
it.

Cheers,
Julien
Sean Farley - April 17, 2016, 5:25 p.m.
Julien Cristau <jcristau@debian.org> writes:

> On Sun, Apr 17, 2016 at 00:12:21 -0700, Sean Farley wrote:
>
>> # HG changeset patch
>> # User Sean Farley <sean@farley.io>
>> # Date 1460844307 25200
>> #      Sat Apr 16 15:05:07 2016 -0700
>> # Branch stable
>> # Node ID 4fdc9a491b58f472bf29ec81bf6f2acd3e108916
>> # Parent  aacc82cc8cde7803d9ff9d17452a67cde0610171
>> # EXP-Topic ppa
>> tests: add daytime port have clause
>> 
>> Apparently, some machines don't have this service (launchpad builders are one
>> such example). Let's add a simple guard around the test.
>> 
> If it's lack of /etc/services, a build-dependency on netbase might fix
> it.

Ah, ok, I'll test that.

Patch

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -514,5 +514,14 @@  def has_hypothesis():
         import hypothesis
         hypothesis.given
         return True
     except ImportError:
         return False
+
+@check("daytime", "daytime service exists")
+def has_daytime():
+    try:
+        with open('/etc/services') as fp:
+            return 'daytime' in fp.read()
+    except (IOError, OSError):
+        pass
+    return False
diff --git a/tests/test-serve.t b/tests/test-serve.t
--- a/tests/test-serve.t
+++ b/tests/test-serve.t
@@ -43,11 +43,11 @@  With -v and -p HGPORT2
   listening at http://localhost/ (bound to 127.0.0.1:HGPORT2)
   % errors
 
 With -v and -p daytime (should fail because low port)
 
-#if no-root
+#if no-root daytime
   $ KILLQUIETLY=Y
   $ hgserve -p daytime
   abort: cannot start server at 'localhost:13': Permission denied
   abort: child process failed to start
   % errors