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

login
register
mail settings
Submitter Bryan O'Sullivan
Date April 10, 2017, 6:51 p.m.
Message ID <0137657c5b5ffc114b4f.1491850299@bryano-mbp.local>
Download mbox | patch
Permalink /patch/20095/
State Changes Requested
Headers show

Comments

Bryan O'Sullivan - April 10, 2017, 6:51 p.m.
# HG changeset patch
# User Bryan O'Sullivan <bryano@fb.com>
# Date 1490915085 25200
#      Thu Mar 30 16:04:45 2017 -0700
# Node ID 0137657c5b5ffc114b4f654278b41a8e2d48ca93
# Parent  fd3b4caa7c4fca4c7df1bdf9110ca0b8f56b1677
stdio: add Linux-specific tests for error checking
Jun Wu - April 10, 2017, 8:07 p.m.
The stdio series look good and is a clear win to me. I also verified that
it's chg compatible.

Excerpts from Bryan O'Sullivan's message of 2017-04-10 11:51:39 -0700:
> # HG changeset patch
> # User Bryan O'Sullivan <bryano@fb.com>
> # Date 1490915085 25200
> #      Thu Mar 30 16:04:45 2017 -0700
> # Node ID 0137657c5b5ffc114b4f654278b41a8e2d48ca93
> # Parent  fd3b4caa7c4fca4c7df1bdf9110ca0b8f56b1677
> stdio: add Linux-specific tests for error checking
> 
> 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:

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: