diff mbox series

[ovs-dev] tests-windows: Make flow extractor work on Windows

Message ID 20180306152356.668-1-aserdean@ovn.org
State Changes Requested
Headers show
Series [ovs-dev] tests-windows: Make flow extractor work on Windows | expand

Commit Message

Alin-Gabriel Serdean March 6, 2018, 3:23 p.m. UTC
42. library.at:3: testing flow extractor ...
./library.at:4: $PYTHON $srcdir/flowgen.py >/dev/null 3>flows 4>pcap

Comments

Ben Pfaff March 7, 2018, 9:07 p.m. UTC | #1
Applying this commit adds a file named
"c/_2018/march/06/ovs/tests/testsuite.dir/at-groups/42/stderr" to the
repo!  I think that the failure needs to be indented a bit to un-confuse
"git am".

When I fix that up, I get the following failure from flake8:
../tests/flowgen.py:17:1: F401 'os' imported but unused

Assuming you fix up those two little things:
Acked-by: Ben Pfaff <blp@ovn.org>

Thanks!

On Tue, Mar 06, 2018 at 05:23:56PM +0200, Alin Gabriel Serdean wrote:
> 42. library.at:3: testing flow extractor ...
> ./library.at:4: $PYTHON $srcdir/flowgen.py >/dev/null 3>flows 4>pcap
> --- /dev/null   2018-03-06 15:59:49 +0200
> +++ /c/_2018/march/06/ovs/tests/testsuite.dir/at-groups/42/stderr       2018-03-06 15:59:49 +0200
> @@ -0,0 +1,4 @@
> +Traceback (most recent call last):
> +  File "../.././flowgen.py", line 204, in <module>
> +    flows = os.fdopen(3, 'wb')
> +OSError: [Errno 9] Bad file descriptor
> ./library.at:4: exit code was 1, expected 0
> 42. library.at:3:  FAILED (library.at:4)
> 
> Unfortunately 3/4/5/.. FDs don't work on Windows. Switch to a filename open
> instead of opening the FDs.
> 
> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
> ---
>  tests/flowgen.py | 4 ++--
>  tests/library.at | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/flowgen.py b/tests/flowgen.py
> index 221a8f2bc..4d31b05a9 100755
> --- a/tests/flowgen.py
> +++ b/tests/flowgen.py
> @@ -201,8 +201,8 @@ def output(attrs):
>      packets.write(packet)
>  
>  
> -flows = os.fdopen(3, 'wb')
> -packets = os.fdopen(4, 'wb')
> +flows = open('flows', 'wb')
> +packets = open('pcap', 'wb')
>  
>  # Print pcap file header.
>  packets.write(struct.pack('>LHHLLLL',
> diff --git a/tests/library.at b/tests/library.at
> index 5efbfbb7c..5bfea2f69 100644
> --- a/tests/library.at
> +++ b/tests/library.at
> @@ -1,7 +1,7 @@
>  AT_BANNER([library unit tests])
>  
>  AT_SETUP([flow extractor])
> -AT_CHECK([$PYTHON $srcdir/flowgen.py >/dev/null 3>flows 4>pcap])
> +AT_CHECK([$PYTHON $srcdir/flowgen.py >/dev/null])
>  AT_CHECK([ovstest test-flows flows pcap], [0], [checked 247 packets, 0 errors
>  ])
>  AT_CLEANUP
> -- 
> 2.16.1.windows.1
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Alin-Gabriel Serdean March 8, 2018, 1:03 a.m. UTC | #2
Thanks for the quick review.
I removed the import and changed a bit the message.

Applied on master.
Alin.

> -----Mesaj original-----
> De la: ovs-dev-bounces@openvswitch.org <ovs-dev-
> bounces@openvswitch.org> În numele Ben Pfaff
> Trimis: Wednesday, March 7, 2018 11:07 PM
> Către: Alin Gabriel Serdean <aserdean@ovn.org>
> Cc: dev@openvswitch.org
> Subiect: Re: [ovs-dev] [PATCH] tests-windows: Make flow extractor work on
> Windows
> 
> Applying this commit adds a file named
> "c/_2018/march/06/ovs/tests/testsuite.dir/at-groups/42/stderr" to the
> repo!  I think that the failure needs to be indented a bit to un-confuse
"git
> am".
> 
> When I fix that up, I get the following failure from flake8:
> ../tests/flowgen.py:17:1: F401 'os' imported but unused
> 
> Assuming you fix up those two little things:
> Acked-by: Ben Pfaff <blp@ovn.org>
> 
> Thanks!
> 
> On Tue, Mar 06, 2018 at 05:23:56PM +0200, Alin Gabriel Serdean wrote:
> > 42. library.at:3: testing flow extractor ...
> > ./library.at:4: $PYTHON $srcdir/flowgen.py >/dev/null 3>flows 4>pcap
> > --- /dev/null   2018-03-06 15:59:49 +0200
> > +++ /c/_2018/march/06/ovs/tests/testsuite.dir/at-groups/42/stderr
> 2018-03-06 15:59:49 +0200
> > @@ -0,0 +1,4 @@
> > +Traceback (most recent call last):
> > +  File "../.././flowgen.py", line 204, in <module>
> > +    flows = os.fdopen(3, 'wb')
> > +OSError: [Errno 9] Bad file descriptor
> > ./library.at:4: exit code was 1, expected 0 42. library.at:3:  FAILED
> > (library.at:4)
> >
> > Unfortunately 3/4/5/.. FDs don't work on Windows. Switch to a filename
> > open instead of opening the FDs.
> >
> > Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
diff mbox series

Patch

--- /dev/null   2018-03-06 15:59:49 +0200
+++ /c/_2018/march/06/ovs/tests/testsuite.dir/at-groups/42/stderr       2018-03-06 15:59:49 +0200
@@ -0,0 +1,4 @@ 
+Traceback (most recent call last):
+  File "../.././flowgen.py", line 204, in <module>
+    flows = os.fdopen(3, 'wb')
+OSError: [Errno 9] Bad file descriptor
./library.at:4: exit code was 1, expected 0
42. library.at:3:  FAILED (library.at:4)

Unfortunately 3/4/5/.. FDs don't work on Windows. Switch to a filename open
instead of opening the FDs.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
---
 tests/flowgen.py | 4 ++--
 tests/library.at | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/flowgen.py b/tests/flowgen.py
index 221a8f2bc..4d31b05a9 100755
--- a/tests/flowgen.py
+++ b/tests/flowgen.py
@@ -201,8 +201,8 @@  def output(attrs):
     packets.write(packet)
 
 
-flows = os.fdopen(3, 'wb')
-packets = os.fdopen(4, 'wb')
+flows = open('flows', 'wb')
+packets = open('pcap', 'wb')
 
 # Print pcap file header.
 packets.write(struct.pack('>LHHLLLL',
diff --git a/tests/library.at b/tests/library.at
index 5efbfbb7c..5bfea2f69 100644
--- a/tests/library.at
+++ b/tests/library.at
@@ -1,7 +1,7 @@ 
 AT_BANNER([library unit tests])
 
 AT_SETUP([flow extractor])
-AT_CHECK([$PYTHON $srcdir/flowgen.py >/dev/null 3>flows 4>pcap])
+AT_CHECK([$PYTHON $srcdir/flowgen.py >/dev/null])
 AT_CHECK([ovstest test-flows flows pcap], [0], [checked 247 packets, 0 errors
 ])
 AT_CLEANUP