Patchwork test-template: fix stdio mode on Windows

login
register
mail settings
Submitter Yuya Nishihara
Date March 23, 2019, 12:08 p.m.
Message ID <a669654065284444bc75.1553342893@mimosa>
Download mbox | patch
Permalink /patch/39366/
State Accepted
Headers show

Comments

Yuya Nishihara - March 23, 2019, 12:08 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1553342347 -32400
#      Sat Mar 23 20:59:07 2019 +0900
# Node ID a669654065284444bc75ea8654b9e05928bcbb48
# Parent  ba064f95175e6cb1467401a3a536d8c32229d4b1
test-template: fix stdio mode on Windows

Otherwise, CBOR data would be corrupted. Spotted by Matt Harbison.
Gregory Szorc - March 23, 2019, 3:23 p.m.
On Sat, Mar 23, 2019 at 6:11 AM Yuya Nishihara <yuya@tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1553342347 -32400
> #      Sat Mar 23 20:59:07 2019 +0900
> # Node ID a669654065284444bc75ea8654b9e05928bcbb48
> # Parent  ba064f95175e6cb1467401a3a536d8c32229d4b1
> test-template: fix stdio mode on Windows
>

Queued, thanks.


>
> Otherwise, CBOR data would be corrupted. Spotted by Matt Harbison.
>
> diff --git a/tests/test-template-functions.t
> b/tests/test-template-functions.t
> --- a/tests/test-template-functions.t
> +++ b/tests/test-template-functions.t
> @@ -1499,11 +1499,15 @@ Test cbor filter:
>
>    $ cat <<'EOF' > "$TESTTMP/decodecbor.py"
>    > from __future__ import absolute_import
> -  > from mercurial import pycompat
> +  > from mercurial import (
> +  >     dispatch,
> +  >     pycompat,
> +  > )
>    > from mercurial.utils import (
>    >     cborutil,
>    >     stringutil,
>    > )
> +  > dispatch.initstdio()
>    > items = cborutil.decodeall(pycompat.stdin.read())
>    > pycompat.stdout.write(stringutil.pprint(items, indent=1) + b'\n')
>    > EOF
> diff --git a/tests/test-template-map.t b/tests/test-template-map.t
> --- a/tests/test-template-map.t
> +++ b/tests/test-template-map.t
> @@ -673,11 +673,15 @@ test CBOR style:
>
>    $ cat <<'EOF' > "$TESTTMP/decodecborarray.py"
>    > from __future__ import absolute_import
> -  > from mercurial import pycompat
> +  > from mercurial import (
> +  >     dispatch,
> +  >     pycompat,
> +  > )
>    > from mercurial.utils import (
>    >     cborutil,
>    >     stringutil,
>    > )
> +  > dispatch.initstdio()
>    > data = pycompat.stdin.read()
>    > # our CBOR decoder doesn't support parsing indefinite-length arrays,
>    > # but the log output is indefinite stream by nature.
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/tests/test-template-functions.t b/tests/test-template-functions.t
--- a/tests/test-template-functions.t
+++ b/tests/test-template-functions.t
@@ -1499,11 +1499,15 @@  Test cbor filter:
 
   $ cat <<'EOF' > "$TESTTMP/decodecbor.py"
   > from __future__ import absolute_import
-  > from mercurial import pycompat
+  > from mercurial import (
+  >     dispatch,
+  >     pycompat,
+  > )
   > from mercurial.utils import (
   >     cborutil,
   >     stringutil,
   > )
+  > dispatch.initstdio()
   > items = cborutil.decodeall(pycompat.stdin.read())
   > pycompat.stdout.write(stringutil.pprint(items, indent=1) + b'\n')
   > EOF
diff --git a/tests/test-template-map.t b/tests/test-template-map.t
--- a/tests/test-template-map.t
+++ b/tests/test-template-map.t
@@ -673,11 +673,15 @@  test CBOR style:
 
   $ cat <<'EOF' > "$TESTTMP/decodecborarray.py"
   > from __future__ import absolute_import
-  > from mercurial import pycompat
+  > from mercurial import (
+  >     dispatch,
+  >     pycompat,
+  > )
   > from mercurial.utils import (
   >     cborutil,
   >     stringutil,
   > )
+  > dispatch.initstdio()
   > data = pycompat.stdin.read()
   > # our CBOR decoder doesn't support parsing indefinite-length arrays,
   > # but the log output is indefinite stream by nature.