about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-06-03 14:55:37 -0700
committerEric Wong <normalperson@yhbt.net>2010-06-03 15:26:01 -0700
commit5a0a190253434d3eef5332d979d56f3e16e876bd (patch)
tree23fc4e136eafe0688260bebc27c4d05fc5c26512 /t
parentb6e354116d4da5c7c6de59f87ab5815f21e202ed (diff)
downloadrainbows-5a0a190253434d3eef5332d979d56f3e16e876bd.tar.gz
While these models are designed to work with IO.copy_stream
under Ruby 1.9, it should be possible to run them under Ruby
1.8 without returning corrupt responses.  The large file
response test is beefed up to compare SHA1 checksums of
the served file, not just sizes.
Diffstat (limited to 't')
-rwxr-xr-xt/t0005-large-file-response.sh17
1 files changed, 9 insertions, 8 deletions
diff --git a/t/t0005-large-file-response.sh b/t/t0005-large-file-response.sh
index b663e65..d709d79 100755
--- a/t/t0005-large-file-response.sh
+++ b/t/t0005-large-file-response.sh
@@ -18,7 +18,8 @@ t_begin "setup and startup" && {
         rainbows_wait_start
 }
 
-t_begin "read random blob size" && {
+t_begin "read random blob sha1 and size" && {
+        random_blob_sha1=$(rsha1 < random_blob)
         random_blob_size=$(wc -c < random_blob)
 }
 
@@ -32,18 +33,18 @@ t_begin "read current RSS" && {
 t_begin "send a series HTTP/1.1 requests sequentially" && {
         for i in a b c
         do
-                size=$( (curl -sSfv http://$listen/random_blob &&
-                         echo ok >$ok) |wc -c)
-                test $size -eq $random_blob_size
+                sha1=$( (curl -sSfv http://$listen/random_blob &&
+                         echo ok >$ok) | rsha1)
+                test $sha1 = $random_blob_sha1
                 test xok = x$(cat $ok)
         done
 }
 
 # this was a problem during development
 t_begin "HTTP/1.0 test" && {
-        size=$( (curl -0 -sSfv http://$listen/random_blob &&
-                 echo ok >$ok) |wc -c)
-        test $size -eq $random_blob_size
+        sha1=$( (curl -0 -sSfv http://$listen/random_blob &&
+                 echo ok >$ok) | rsha1)
+        test $sha1 = $random_blob_sha1
         test xok = x$(cat $ok)
 }
 
@@ -54,7 +55,7 @@ t_begin "HTTP/0.9 test" && {
                 wait
                 echo ok > $ok
         ) | socat - TCP:$listen > $fifo
-        test $(cat $tmp) = $(rsha1 < random_blob)
+        test $(cat $tmp) = $random_blob_sha1
         test xok = x$(cat $ok)
 }