tests: Get max rx socket buffer size on FreeBSD
authorEd Maste <emaste@freebsd.org>
Tue, 31 Jul 2012 18:23:35 +0000 (14:23 -0400)
committerBen Pfaff <blp@nicira.com>
Tue, 31 Jul 2012 22:55:30 +0000 (15:55 -0700)
Also remove another sed \b that FreeBSD sed doesn't handle.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
tests/ofproto.at

index 2d28131..8741a48 100644 (file)
@@ -886,14 +886,19 @@ AT_CLEANUP
 AT_SETUP([ofproto - flow monitoring pause and resume])
 AT_KEYWORDS([monitor])
 
-# With a Linux kernel, this file has the maximum socket receive buffer
-# size.  That's important for this test, which tests behavior when the
-# receive buffer overflows.
-AT_SKIP_IF([test ! -e /proc/sys/net/core/rmem_max])
-
+# The maximum socket receive buffer size is important for this test, which
+# tests behavior when the receive buffer overflows.
+if test -e /proc/sys/net/core/rmem_max; then
+    # Linux
+    rmem_max=`cat /proc/sys/net/core/rmem_max`
+elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
+    : # FreeBSD
+else
+    # Don't know how to get maximum socket receive buffer on this OS
+    AT_SKIP_IF([:])
+fi
 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
-rmem_max=`cat /proc/sys/net/core/rmem_max`
 queue_size=`expr $rmem_max + 128 \* 1024`
 echo rmem_max=$rmem_max queue_size=$queue_size
 
@@ -936,7 +941,7 @@ AT_CHECK([test $adds = $deletes])
 
 # Check that the flow monitor reported everything in the expected order.
 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
-/reg1=0x22\b/p
+/reg1=0x22$/p
 /cookie=0x[[23]]/p
 /NXT_FLOW_MONITOR_PAUSED:/p
 /NXT_FLOW_MONITOR_RESUMED:/p