Patchwork [9,of,9,v2] stdio: add Linux-specific tests for error checking

login
register
mail settings
Submitter Bryan O'Sullivan
Date April 14, 2017, 4:29 a.m.
Message ID <19530f1d18bc0b6697f2.1492144187@jsdf-mbp.dhcp.thefacebook.com>
Download mbox | patch
Permalink /patch/20192/
State Accepted
Headers show

Comments

Bryan O'Sullivan - April 14, 2017, 4:29 a.m.
# HG changeset patch
# User Bryan O'Sullivan <bryano@fb.com>
# Date 1491947652 25200
#      Tue Apr 11 14:54:12 2017 -0700
# Node ID 19530f1d18bc0b6697f2996f089c614548f90269
# Parent  800f9ec2664e515d8ad807c0df1efaccda8ff5e5
stdio: add Linux-specific tests for error checking
Sean Farley - April 14, 2017, 6:44 p.m.
Bryan O'Sullivan <bos@serpentine.com> writes:

> # HG changeset patch
> # User Bryan O'Sullivan <bryano@fb.com>
> # Date 1491947652 25200
> #      Tue Apr 11 14:54:12 2017 -0700
> # Node ID 19530f1d18bc0b6697f2996f089c614548f90269
> # Parent  800f9ec2664e515d8ad807c0df1efaccda8ff5e5
> stdio: add Linux-specific tests for error checking

It seems like this series addresses Yuya's feedback, so this seems good
to me.
Yuya Nishihara - April 15, 2017, 7:30 a.m.
On Fri, 14 Apr 2017 11:44:25 -0700, Sean Farley wrote:
> Bryan O'Sullivan <bos@serpentine.com> writes:
> 
> > # HG changeset patch
> > # User Bryan O'Sullivan <bryano@fb.com>
> > # Date 1491947652 25200
> > #      Tue Apr 11 14:54:12 2017 -0700
> > # Node ID 19530f1d18bc0b6697f2996f089c614548f90269
> > # Parent  800f9ec2664e515d8ad807c0df1efaccda8ff5e5
> > stdio: add Linux-specific tests for error checking
> 
> It seems like this series addresses Yuya's feedback, so this seems good
> to me.

Yeah, queued, thanks.

Patch

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -634,3 +634,7 @@  def has_zstd():
         return True
     except ImportError:
         return False
+
+@check("devfull", "/dev/full special file")
+def has_dev_full():
+    return os.path.exists('/dev/full')
diff --git a/tests/test-basic.t b/tests/test-basic.t
--- a/tests/test-basic.t
+++ b/tests/test-basic.t
@@ -16,10 +16,31 @@  Create a repository:
   $ hg init t
   $ cd t
 
-Make a changeset:
+Prepare a changeset:
 
   $ echo a > a
   $ hg add a
+
+  $ hg status
+  A a
+
+Writes to stdio succeed and fail appropriately
+
+#if devfull
+  $ hg status 2>/dev/full
+  A a
+
+  $ hg status >/dev/full
+  abort: No space left on device
+  [255]
+
+  $ hg status >/dev/full 2>&1
+  [1]
+
+  $ hg status ENOENT 2>/dev/full
+  [1]
+#endif
+
   $ hg commit -m test
 
 This command is ancient: