diff mbox series

[ovs-dev] ovsdb-client.at: Fix ovsdb-client backup test on Win

Message ID 20180114182647.13736-1-aserdean@ovn.org
State Changes Requested
Headers show
Series [ovs-dev] ovsdb-client.at: Fix ovsdb-client backup test on Win | expand

Commit Message

Alin-Gabriel Serdean Jan. 14, 2018, 6:26 p.m. UTC
The test:
1948. ovsdb-client.at:15: testing ovsdb-client backup and restore
fails on Windows with:

Comments

Ben Pfaff Jan. 23, 2018, 12:23 a.m. UTC | #1
On Sun, Jan 14, 2018 at 08:26:47PM +0200, Alin Gabriel Serdean wrote:
> The test:
> 1948. ovsdb-client.at:15: testing ovsdb-client backup and restore
> fails on Windows with:
> --- /dev/null   2018-01-14 20:09:57 +0200
> +++ /c/_2018/january/14/ovs/tests/testsuite.dir/at-groups/1948/stderr
> @@ -0,0 +1,3 @@
> +ovsdb-server: ovsdb error: backup: unexpected file format
> +ovsdb-server: Failed to read from child (The pipe has been ended.
> +)
> ./ovsdb-client.at:111: exit code was 1, expected 0
> 
> The root cause is that when redirecting output defaults to the Windows line
> endings(CRLF):
> $ file db
> db: ASCII text, with very long lines
> $ file backup
> backup: ASCII text, with very long lines, with CRLF line terminators
> 
> Add a `dos2unix` command to convert to the line endings expected by
> ovsdb-server.
> 
> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>

Thank you for the fix.

Hmm, maybe this is a bug in "ovsdb-client backup".  Maybe it should do
something like:

#ifdef _WIN32
        fflush(stdout);
        _setmode(STDOUT_FILENO, _O_BINARY);
#endif

and then the test wouldn't have to change at all?  What do you think?

I don't know whether anything similar is needed for stdin for
"ovsdb-client restore".
Alin-Gabriel Serdean Jan. 23, 2018, 9:01 p.m. UTC | #2
(facepalm). Thanks for pointing me to the right direction. I will look into
it.

Thanks,
Alin.

> -----Original Message-----
> From: Ben Pfaff [mailto:blp@ovn.org]
> Sent: Tuesday, January 23, 2018 2:24 AM
> To: Alin Gabriel Serdean <aserdean@ovn.org>
> Cc: dev@openvswitch.org
> Subject: Re: [ovs-dev] [PATCH] ovsdb-client.at: Fix ovsdb-client backup
test
> on Win
> 
> On Sun, Jan 14, 2018 at 08:26:47PM +0200, Alin Gabriel Serdean wrote:
> > The test:
> > 1948. ovsdb-client.at:15: testing ovsdb-client backup and restore
> > fails on Windows with:
> > --- /dev/null   2018-01-14 20:09:57 +0200
> > +++ /c/_2018/january/14/ovs/tests/testsuite.dir/at-groups/1948/stderr
> > @@ -0,0 +1,3 @@
> > +ovsdb-server: ovsdb error: backup: unexpected file format
> > +ovsdb-server: Failed to read from child (The pipe has been ended.
> > +)
> > ./ovsdb-client.at:111: exit code was 1, expected 0
> >
> > The root cause is that when redirecting output defaults to the Windows
> > line
> > endings(CRLF):
> > $ file db
> > db: ASCII text, with very long lines
> > $ file backup
> > backup: ASCII text, with very long lines, with CRLF line terminators
> >
> > Add a `dos2unix` command to convert to the line endings expected by
> > ovsdb-server.
> >
> > Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
> 
> Thank you for the fix.
> 
> Hmm, maybe this is a bug in "ovsdb-client backup".  Maybe it should do
> something like:
> 
> #ifdef _WIN32
>         fflush(stdout);
>         _setmode(STDOUT_FILENO, _O_BINARY); #endif
> 
> and then the test wouldn't have to change at all?  What do you think?
> 
> I don't know whether anything similar is needed for stdin for
"ovsdb-client
> restore".
Alin-Gabriel Serdean March 8, 2018, 6:33 p.m. UTC | #3
It's been a while 😊.

I sent a patch as you suggested: https://patchwork.ozlabs.org/patch/883250/ .
Mind taking a look?

Alin.

> -----Mesaj original-----
> De la: ovs-dev-bounces@openvswitch.org <ovs-dev-
> bounces@openvswitch.org> ÃŽn numele aserdean@ovn.org
> Trimis: Tuesday, January 23, 2018 11:01 PM
> Către: 'Ben Pfaff' <blp@ovn.org>; 'Alin Gabriel Serdean'
> <aserdean@ovn.org>
> Cc: dev@openvswitch.org
> Subiect: Re: [ovs-dev] [PATCH] ovsdb-client.at: Fix ovsdb-client backup test
> on Win
> 
> (facepalm). Thanks for pointing me to the right direction. I will look into it.
> 
> Thanks,
> Alin.
> 
> > -----Original Message-----
> > From: Ben Pfaff [mailto:blp@ovn.org]
> > Sent: Tuesday, January 23, 2018 2:24 AM
> > To: Alin Gabriel Serdean <aserdean@ovn.org>
> > Cc: dev@openvswitch.org
> > Subject: Re: [ovs-dev] [PATCH] ovsdb-client.at: Fix ovsdb-client
> > backup
> test
> > on Win
> >
> > On Sun, Jan 14, 2018 at 08:26:47PM +0200, Alin Gabriel Serdean wrote:
> > > The test:
> > > 1948. ovsdb-client.at:15: testing ovsdb-client backup and restore
> > > fails on Windows with:
> > > --- /dev/null   2018-01-14 20:09:57 +0200
> > > +++ /c/_2018/january/14/ovs/tests/testsuite.dir/at-groups/1948/stder
> > > +++ r
> > > @@ -0,0 +1,3 @@
> > > +ovsdb-server: ovsdb error: backup: unexpected file format
> > > +ovsdb-server: Failed to read from child (The pipe has been ended.
> > > +)
> > > ./ovsdb-client.at:111: exit code was 1, expected 0
> > >
> > > The root cause is that when redirecting output defaults to the
> > > Windows line
> > > endings(CRLF):
> > > $ file db
> > > db: ASCII text, with very long lines $ file backup
> > > backup: ASCII text, with very long lines, with CRLF line terminators
> > >
> > > Add a `dos2unix` command to convert to the line endings expected by
> > > ovsdb-server.
> > >
> > > Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
> >
> > Thank you for the fix.
> >
> > Hmm, maybe this is a bug in "ovsdb-client backup".  Maybe it should do
> > something like:
> >
> > #ifdef _WIN32
> >         fflush(stdout);
> >         _setmode(STDOUT_FILENO, _O_BINARY); #endif
> >
> > and then the test wouldn't have to change at all?  What do you think?
> >
> > I don't know whether anything similar is needed for stdin for
> "ovsdb-client
> > restore".
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Ben Pfaff March 8, 2018, 6:45 p.m. UTC | #4
On Thu, Mar 08, 2018 at 08:33:20PM +0200, aserdean@ovn.org wrote:
> It's been a while 😊.
> 
> I sent a patch as you suggested: https://patchwork.ozlabs.org/patch/883250/ .
> Mind taking a look?

I reviewed it now.
Alin-Gabriel Serdean March 8, 2018, 6:49 p.m. UTC | #5
> -----Mesaj original-----
> De la: ovs-dev-bounces@openvswitch.org <ovs-dev-
> bounces@openvswitch.org> ÃŽn numele Ben Pfaff
> Trimis: Thursday, March 8, 2018 8:45 PM
> Către: aserdean@ovn.org
> Cc: dev@openvswitch.org
> Subiect: Re: [ovs-dev] [PATCH] ovsdb-client.at: Fix ovsdb-client backup test
> on Win
> 
> On Thu, Mar 08, 2018 at 08:33:20PM +0200, aserdean@ovn.org wrote:
> > It's been a while 😊.
> >
> > I sent a patch as you suggested:
> https://patchwork.ozlabs.org/patch/883250/ .
> > Mind taking a look?
> 
> I reviewed it now.
That was quick!
Ben Pfaff March 8, 2018, 6:54 p.m. UTC | #6
On Thu, Mar 08, 2018 at 08:49:07PM +0200, aserdean@ovn.org wrote:
> 
> 
> > -----Mesaj original-----
> > De la: ovs-dev-bounces@openvswitch.org <ovs-dev-
> > bounces@openvswitch.org> ÃŽn numele Ben Pfaff
> > Trimis: Thursday, March 8, 2018 8:45 PM
> > Către: aserdean@ovn.org
> > Cc: dev@openvswitch.org
> > Subiect: Re: [ovs-dev] [PATCH] ovsdb-client.at: Fix ovsdb-client backup test
> > on Win
> > 
> > On Thu, Mar 08, 2018 at 08:33:20PM +0200, aserdean@ovn.org wrote:
> > > It's been a while 😊.
> > >
> > > I sent a patch as you suggested:
> > https://patchwork.ozlabs.org/patch/883250/ .
> > > Mind taking a look?
> > 
> > I reviewed it now.
> That was quick!
> 

You caught me at a good time.  Now I'm AFK for a bit...
Alin-Gabriel Serdean March 13, 2018, 10:09 p.m. UTC | #7
> -----Mesaj original-----
> De la: ovs-dev-bounces@openvswitch.org <ovs-dev-
> bounces@openvswitch.org> ÃŽn numele Ben Pfaff
> Trimis: Thursday, March 8, 2018 8:55 PM
> Către: aserdean@ovn.org
> Cc: dev@openvswitch.org
> Subiect: Re: [ovs-dev] [PATCH] ovsdb-client.at: Fix ovsdb-client backup test
> on Win
> 
> On Thu, Mar 08, 2018 at 08:49:07PM +0200, aserdean@ovn.org wrote:
> >
> >
> > > -----Mesaj original-----
> > > De la: ovs-dev-bounces@openvswitch.org <ovs-dev-
> > > bounces@openvswitch.org> ÃŽn numele Ben Pfaff
> > > Trimis: Thursday, March 8, 2018 8:45 PM
> > > Către: aserdean@ovn.org
> > > Cc: dev@openvswitch.org
> > > Subiect: Re: [ovs-dev] [PATCH] ovsdb-client.at: Fix ovsdb-client
> > > backup test on Win
> > >
> > > On Thu, Mar 08, 2018 at 08:33:20PM +0200, aserdean@ovn.org wrote:
> > > > It's been a while 😊.
> > > >
> > > > I sent a patch as you suggested:
> > > https://patchwork.ozlabs.org/patch/883250/ .
> > > > Mind taking a look?
> > >
> > > I reviewed it now.
> > That was quick!
> >
> 
> You caught me at a good time.  Now I'm AFK for a bit...
[Alin Serdean] Can you take a look over the next incremental: https://patchwork.ozlabs.org/patch/884591/ when you have time?
diff mbox series

Patch

--- /dev/null   2018-01-14 20:09:57 +0200
+++ /c/_2018/january/14/ovs/tests/testsuite.dir/at-groups/1948/stderr
@@ -0,0 +1,3 @@ 
+ovsdb-server: ovsdb error: backup: unexpected file format
+ovsdb-server: Failed to read from child (The pipe has been ended.
+)
./ovsdb-client.at:111: exit code was 1, expected 0

The root cause is that when redirecting output defaults to the Windows line
endings(CRLF):
$ file db
db: ASCII text, with very long lines
$ file backup
backup: ASCII text, with very long lines, with CRLF line terminators

Add a `dos2unix` command to convert to the line endings expected by
ovsdb-server.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
---
 tests/ovsdb-client.at | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/ovsdb-client.at b/tests/ovsdb-client.at
index 467175f..2f1f63b 100644
--- a/tests/ovsdb-client.at
+++ b/tests/ovsdb-client.at
@@ -49,6 +49,9 @@  AT_CAPTURE_FILE([ovsdb-server.log])
 dnl Dump a copy of the data and a backup of it.
 AT_CHECK([ovsdb-client dump > dump1])
 AT_CHECK([ovsdb-client backup > backup])
+if test "$IS_WIN32" = "yes"; then
+    dos2unix backup
+fi
 
 dnl Mess up the data a little, verify that it changed, then restore it
 dnl and verify restoration.