[ovs-dev] [PATCH 05/16] test-flows: Change the way flows are read.

Gurucharan Shetty shettyg at nicira.com
Fri May 30 19:06:13 UTC 2014


With Visual Studio and Msys combination, something is going
wrong when we do a '3<pcap' followed by fdopen(3, 'rb'). fdopen
fails. I do not know the exact reason for the failure. But the
workaround is straightforward.

Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 tests/library.at   |    2 +-
 tests/test-flows.c |    9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/library.at b/tests/library.at
index e3e8df2..bea9feb 100644
--- a/tests/library.at
+++ b/tests/library.at
@@ -2,7 +2,7 @@ AT_BANNER([library unit tests])
 
 AT_SETUP([test flow extractor])
 AT_CHECK([$PERL `which flowgen.pl` >/dev/null 3>flows 4>pcap])
-AT_CHECK([ovstest test-flows <flows 3<pcap], [0], [checked 247 packets, 0 errors
+AT_CHECK([ovstest test-flows flows pcap], [0], [checked 247 packets, 0 errors
 ])
 AT_CLEANUP
 
diff --git a/tests/test-flows.c b/tests/test-flows.c
index 522fa44..5f5dc43 100644
--- a/tests/test-flows.c
+++ b/tests/test-flows.c
@@ -43,10 +43,13 @@ test_flows_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
 
     set_program_name(argv[0]);
 
-    flows = stdin;
-    pcap = fdopen(3, "rb");
+    flows = fopen(argv[1], "rb");
+    if (!flows) {
+        ovs_fatal(errno, "failed to open %s", argv[1]);
+    }
+    pcap = fopen(argv[2], "rb");
     if (!pcap) {
-        ovs_fatal(errno, "failed to open fd 3 for reading");
+        ovs_fatal(errno, "failed to open %s", argv[2]);
     }
 
     retval = ovs_pcap_read_header(pcap);
-- 
1.7.9.5




More information about the dev mailing list