nickva commented on PR #5399:
URL: https://github.com/apache/couchdb/pull/5399#issuecomment-2664138878

   To gain more confidence added a new tests runs concurrent preads from 
multiple processes for various block sizes. To verify that each process read 
the correct bytes, use a simple checksumming scheme: write byte `X rem 256` at 
position `X`. So the file looks like `0,1,2,...,255,0,1,2,...255,0,..`. This 
way each reader can check not only that they read the correct length of bytes 
but that the bytes are what they are supposed to be at that position.
   
   Locally ran block size test for 30 minutes with this diff, the tests passed 
successfully:
   
   ```diff
   diff --git a/src/couch/test/eunit/couch_cfile_tests.erl 
b/src/couch/test/eunit/couch_cfile_tests.erl
   index e1e99951c..ab0fe5d3b 100644
   --- a/src/couch/test/eunit/couch_cfile_tests.erl
   +++ b/src/couch/test/eunit/couch_cfile_tests.erl
   @@ -41,9 +41,9 @@ couch_cfile_test_() ->
                        ?TDEF_FE(t_gc_is_closing_file_handles),
                        ?TDEF_FE(t_monitor_is_closing_file_handles),
                        ?TDEF_FE(t_janitor_proc_is_up),
   -                    ?TDEF_FE(t_concurrent_reads_512b),
   -                    ?TDEF_FE(t_concurrent_reads_4kb),
   -                    ?TDEF_FE(t_concurrent_reads_1mb)
   +                    ?TDEF_FE(t_concurrent_reads_512b, 3600),
   +                    ?TDEF_FE(t_concurrent_reads_4kb, 3600),
   +                    ?TDEF_FE(t_concurrent_reads_1mb, 3600)
                    ]
            end
        }.
   @@ -397,7 +397,7 @@ t_concurrent_reads_512b(Path) ->
        Fd = cfile(Path),
        Eof = write(Fd, 0, 512),
        ReadersPidRefs = spawn_readers(20, Fd, Eof),
   -    timer:sleep(2000),
   +    timer:sleep(1800 * 1000),
        [Pid ! stop_reading || {Pid, _} <- ReadersPidRefs],
        Count = gather_read_results(ReadersPidRefs, 0),
        ?assert(is_integer(Count) andalso Count > 1000).
   @@ -406,7 +406,7 @@ t_concurrent_reads_4kb(Path) ->
        Fd = cfile(Path),
        Eof = write(Fd, 0, 4096),
        ReadersPidRefs = spawn_readers(10, Fd, Eof),
   -    timer:sleep(2000),
   +    timer:sleep(1800 * 1000),
        [Pid ! stop_reading || {Pid, _} <- ReadersPidRefs],
        Count = gather_read_results(ReadersPidRefs, 0),
        ?assert(is_integer(Count) andalso Count > 100).
   @@ -415,7 +415,7 @@ t_concurrent_reads_1mb(Path) ->
        Fd = cfile(Path),
        Eof = write(Fd, 0, 1048576),
        ReadersPidRefs = spawn_readers(2, Fd, Eof),
   -    timer:sleep(2000),
   +    timer:sleep(1800 * 1000),
        [Pid ! stop_reading || {Pid, _} <- ReadersPidRefs],
        Count = gather_read_results(ReadersPidRefs, 0),
        ?assert(is_integer(Count) andalso Count > 10).
   ```
   ```
   ==> asf (setup_eunit)
   ==> couch (eunit)
   ======================== EUnit ========================
   module 'couch_cfile_tests'
     ...
     couch_cfile_tests:43: -couch_cfile_test_/0-fun-8- 
(t_janitor_proc_is_up)...[0.001 s] ok
     couch_cfile_tests:44: -couch_cfile_test_/0-fun-6- 
(t_concurrent_reads_512b)...[1800.023 s] ok
     couch_cfile_tests:45: -couch_cfile_test_/0-fun-4- 
(t_concurrent_reads_4kb)...[1800.001 s] ok
     couch_cfile_tests:46: -couch_cfile_test_/0-fun-2- 
(t_concurrent_reads_1mb)...[1800.137 s] ok
     [done in 5400.849 s]
   =======================================================
     All 16 tests passed.
   Cover analysis: /Users/nvatama/asf/src/couch/.eunit/index.html
   
   Code Coverage:
   
    : not executed
   ==> rel (eunit)
   ==> asf (eunit)
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to