From e6faf9e26bcb172026a4984ecadbaa8b6789bcb7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 4 Feb 2013 12:39:09 +0000 Subject: tests: "wc -l" portability for *BSDs On FreeBSD 9.0, "wc -l" emits leading whitespace, so filter it through tr -d '[:space:]' to eliminate it. --- t/t0402-async-keepalive.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 't/t0402-async-keepalive.sh') diff --git a/t/t0402-async-keepalive.sh b/t/t0402-async-keepalive.sh index b5976da..c507100 100644 --- a/t/t0402-async-keepalive.sh +++ b/t/t0402-async-keepalive.sh @@ -39,9 +39,9 @@ t_begin "async.callback supports pipelining" && { t1=$(unix_time) elapsed=$(( $t1 - $t0 )) t_info "elapsed=$elapsed $model.$0 ($t_current)" - test 3 -eq "$(fgrep 'HTTP/1.1 200 OK' $tmp | wc -l)" - test 3 -eq "$(grep '^Hello ' $tmp | wc -l)" - test 3 -eq "$(grep 'World ' $tmp | wc -l)" + test 3 -eq "$(fgrep 'HTTP/1.1 200 OK' $tmp | count_lines)" + test 3 -eq "$(grep '^Hello ' $tmp | count_lines)" + test 3 -eq "$(grep 'World ' $tmp | count_lines)" } t_begin "async.callback supports delayed pipelining" && { @@ -59,9 +59,9 @@ t_begin "async.callback supports delayed pipelining" && { t1=$(unix_time) elapsed=$(( $t1 - $t0 )) t_info "elapsed=$elapsed $model.$0 ($t_current)" - test 3 -eq "$(fgrep 'HTTP/1.1 200 OK' $tmp | wc -l)" - test 3 -eq "$(grep '^Hello ' $tmp | wc -l)" - test 3 -eq "$(grep 'World ' $tmp | wc -l)" + test 3 -eq "$(fgrep 'HTTP/1.1 200 OK' $tmp | count_lines)" + test 3 -eq "$(grep '^Hello ' $tmp | count_lines)" + test 3 -eq "$(grep 'World ' $tmp | count_lines)" } t_begin "async.callback supports pipelining with delay $DELAY" && { @@ -82,9 +82,9 @@ t_begin "async.callback supports pipelining with delay $DELAY" && { min=$(( $DELAY * 3 )) t_info "elapsed=$elapsed $model.$0 ($t_current) min=$min" test $elapsed -ge $min - test 3 -eq "$(fgrep 'HTTP/1.1 200 OK' $tmp | wc -l)" - test 3 -eq "$(grep '^Hello ' $tmp | wc -l)" - test 3 -eq "$(grep 'World ' $tmp | wc -l)" + test 3 -eq "$(fgrep 'HTTP/1.1 200 OK' $tmp | count_lines)" + test 3 -eq "$(grep '^Hello ' $tmp | count_lines)" + test 3 -eq "$(grep 'World ' $tmp | count_lines)" } t_begin "async.callback supports keepalive" && { @@ -94,7 +94,7 @@ t_begin "async.callback supports keepalive" && { elapsed=$(( $t1 - $t0 )) t_info "elapsed=$elapsed $model.$0 ($t_current)" cmp $expect $tmp - test 2 -eq "$(fgrep 'Re-using existing connection!' $curl_err |wc -l)" + test 2 -eq "$(fgrep 'Re-using existing connection!' $curl_err |count_lines)" rm -f $curl_err } @@ -108,7 +108,7 @@ t_begin "async.callback supports keepalive with delay $DELAY" && { t_info "elapsed=$elapsed $model.$0 ($t_current) min=$min" test $elapsed -ge $min cmp $expect $tmp - test 2 -eq "$(fgrep 'Re-using existing connection!' $curl_err |wc -l)" + test 2 -eq "$(fgrep 'Re-using existing connection!' $curl_err |count_lines)" rm -f $curl_err } -- cgit v1.2.3-24-ge0c7