diff mbox series

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

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

Commit Message

Alin-Gabriel Serdean March 8, 2018, 12:24 a.m. UTC
+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

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>
Acked-by: Ben Pfaff <blp at ovn.org>
---
 tests/flowgen.py | 5 ++---
 tests/library.at | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

Comments

Ben Pfaff March 8, 2018, 1:08 a.m. UTC | #1
On Thu, Mar 08, 2018 at 02:24:19AM +0200, Alin Gabriel Serdean wrote:
> +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
> 
> 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>
> Acked-by: Ben Pfaff <blp at ovn.org>

Acked-by: Ben Pfaff <blp@ovn.org>
diff mbox series

Patch

diff --git a/tests/flowgen.py b/tests/flowgen.py
index 221a8f2bc..976fe7a97 100755
--- a/tests/flowgen.py
+++ b/tests/flowgen.py
@@ -14,7 +14,6 @@ 
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import os
 import socket
 import struct
 
@@ -201,8 +200,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