couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r797053 - in /couchdb/trunk: src/couchdb/couch_file.erl test/etap/031-doc-to-json.t test/etap/050-stream.t test/etap/080-config-get-set.t test/etap/081-config-override.t
Date Thu, 23 Jul 2009 13:01:26 GMT
Author: davisp
Date: Thu Jul 23 13:01:26 2009
New Revision: 797053

URL: http://svn.apache.org/viewvc?rev=797053&view=rev
Log:
Fixes etap tests for recent updates.

Thanks Bob Dionne


Modified:
    couchdb/trunk/src/couchdb/couch_file.erl
    couchdb/trunk/test/etap/031-doc-to-json.t
    couchdb/trunk/test/etap/050-stream.t
    couchdb/trunk/test/etap/080-config-get-set.t
    couchdb/trunk/test/etap/081-config-override.t

Modified: couchdb/trunk/src/couchdb/couch_file.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_file.erl?rev=797053&r1=797052&r2=797053&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_file.erl (original)
+++ couchdb/trunk/src/couchdb/couch_file.erl Thu Jul 23 13:01:26 2009
@@ -116,26 +116,23 @@
     {ok, L} = pread_iolist(Fd, Pos),
     {ok, iolist_to_binary(L)}.
 
+
 pread_iolist(Fd, Pos) ->
-    {ok, LenIolist, NextPos} =read_raw_iolist(Fd, Pos, 20),
+    {ok, LenIolist, NextPos} = read_raw_iolist(Fd, Pos, 4),
     case iolist_to_binary(LenIolist) of
-    <<1:1/integer,Len:31/integer,Md5/binary>> ->
-        {ok, Iolist, _} = read_raw_iolist(Fd, NextPos, Len),
-        case erlang:md5(Iolist) of
+    <<1:1/integer,Len:31/integer>> ->
+        {ok, Md5List, ValPos} = read_raw_iolist(Fd, NextPos, 16),
+        Md5 = iolist_to_binary(Md5List),
+        {ok, IoList, _} = read_raw_iolist(Fd,ValPos,Len),
+        case erlang:md5(IoList) of
         Md5 -> ok;
         _ ->  throw(file_corruption)
         end, 
-        {ok, Iolist};
-    <<0:1/integer,Len:31/integer,First16Bytes/binary>> ->
-        if Len =< 16 ->
-            <<Final:Len/binary,_/binary>> = First16Bytes,
-            {ok, Final};
-        true ->
-            {ok, Iolist, _} = read_raw_iolist(Fd, NextPos, Len - 16),
-            {ok, [First16Bytes, Iolist]}
-        end
+        {ok, IoList};
+    <<0:1/integer,Len:31/integer>> ->
+        {ok, Iolist, _} = read_raw_iolist(Fd, NextPos, Len),
+        {ok, Iolist} 
     end.
-            
        
 
 read_raw_iolist(Fd, Pos, Len) ->

Modified: couchdb/trunk/test/etap/031-doc-to-json.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/031-doc-to-json.t?rev=797053&r1=797052&r2=797053&view=diff
==============================================================================
--- couchdb/trunk/test/etap/031-doc-to-json.t (original)
+++ couchdb/trunk/test/etap/031-doc-to-json.t Thu Jul 23 13:01:26 2009
@@ -120,7 +120,8 @@
                 #att{
                     name = <<"fast.json">>, 
                     type = <<"json/ftw">>, 
-                    data = <<"{\"so\": \"there!\"}">>
+                    data = <<"{\"so\": \"there!\"}">>,
+                    len = 16
                 }
             ]},
             {[

Modified: couchdb/trunk/test/etap/050-stream.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/050-stream.t?rev=797053&r1=797052&r2=797053&view=diff
==============================================================================
--- couchdb/trunk/test/etap/050-stream.t (original)
+++ couchdb/trunk/test/etap/050-stream.t Thu Jul 23 13:01:26 2009
@@ -42,7 +42,7 @@
     etap:is(ok, couch_stream:write(Stream, <<>>),
         "Writing an empty binary does nothing."),
 
-    {Ptrs, Length} = couch_stream:close(Stream),
+    {Ptrs, Length, _} = couch_stream:close(Stream),
     etap:is(Ptrs, [0], "Close returns the file pointers."),
     etap:is(Length, 8, "Close also returns the number of bytes written."),
     etap:is(<<"foodfoob">>, read_all(Fd, Ptrs), "Returned pointers are valid."),
@@ -58,7 +58,7 @@
     etap:is(ok, couch_stream:write(Stream2, ZeroBits),
         "Successfully wrote 80 0 bits."),
 
-    {Ptrs2, Length2} = couch_stream:close(Stream2),
+    {Ptrs2, Length2, _} = couch_stream:close(Stream2),
     etap:is(Ptrs2, [ExpPtr], "Closing stream returns the file pointers."),
     etap:is(Length2, 20, "Length written is 160 bytes."),
 
@@ -73,7 +73,7 @@
         couch_stream:write(Stream3, Data),
         [Data | Acc]
     end, [], lists:seq(1, 1024)),
-    {Ptrs3, Length3} = couch_stream:close(Stream3),
+    {Ptrs3, Length3, _} = couch_stream:close(Stream3),
 
     % 4095 because of 5 * 4096 rem 5 (last write before exceeding threshold)
     % + 5 puts us over the threshold

Modified: couchdb/trunk/test/etap/080-config-get-set.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/080-config-get-set.t?rev=797053&r1=797052&r2=797053&view=diff
==============================================================================
--- couchdb/trunk/test/etap/080-config-get-set.t (original)
+++ couchdb/trunk/test/etap/080-config-get-set.t Thu Jul 23 13:01:26 2009
@@ -105,7 +105,7 @@
     ok = couch_config:delete("new_section", "bizzle", false),
     etap:is(
         couch_config:get("new_section", "bizzle"),
-        "",
+        undefined,
         "Deleting sets the value to \"\""
     ),
 
@@ -121,7 +121,7 @@
     ok = couch_config:delete(<<"foo">>, <<"bar">>, false),
     etap:is(
         couch_config:get(<<"foo">>, <<"bar">>),
-        "",
+        undefined,
         "Deleting with binary section/key pairs sets the value to \"\""
     ),
 

Modified: couchdb/trunk/test/etap/081-config-override.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/081-config-override.t?rev=797053&r1=797052&r2=797053&view=diff
==============================================================================
--- couchdb/trunk/test/etap/081-config-override.t (original)
+++ couchdb/trunk/test/etap/081-config-override.t Thu Jul 23 13:01:26 2009
@@ -167,7 +167,7 @@
 
         etap:is(
             couch_config:get("httpd", "bind_address"),
-            "",
+            undefined,
             "{httpd, bind_address} was actually deleted."
         )
     end,
@@ -202,7 +202,7 @@
 
         etap:is(
             couch_config:get("httpd", "bind_address"),
-            "",
+            undefined,
             "{httpd, bind_address} is still \"\" after reopening."
         )
     end,



Mime
View raw message