From e69a5b17e386dd98aef3fe5d003c8bdc96ec7973 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 22 Jul 2010 20:18:35 +0000 Subject: t0501: workarounds for non-GNU awks While gawk can handle binary data, other awks cannot, so use tr(1) to filter out non-printable characters from the WebSocket message. We need to send a bigger message, too, since tr(1) output is buffered and there's no portable way to unbuffer it :< --- t/cramp/rainsocket.ru | 2 +- t/t0501-cramp-rainsocket.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/t/cramp/rainsocket.ru b/t/cramp/rainsocket.ru index 0d26f70..dd1b229 100644 --- a/t/cramp/rainsocket.ru +++ b/t/cramp/rainsocket.ru @@ -19,7 +19,7 @@ class WelcomeController < Cramp::Controller::Websocket end def send_hello_world - render "Hello from the Server!\n" + render("Hello from the Server!\n" * 256) end end diff --git a/t/t0501-cramp-rainsocket.sh b/t/t0501-cramp-rainsocket.sh index 6e3aea4..a64145a 100755 --- a/t/t0501-cramp-rainsocket.sh +++ b/t/t0501-cramp-rainsocket.sh @@ -24,6 +24,7 @@ t_begin "setup and start" && { t_begin "wait for server to say hello to us" && { ok=$((curl --no-buffer -sS http://$listen/ || :) | \ + (tr -d '\0\0377' || :) | \ awk '/Hello from the Server/ { print "ok"; exit 0 }') test x"$ok" = xok -- cgit v1.2.3-24-ge0c7