orthecreedence / cl-async

Asynchronous IO library for Common Lisp.
MIT License
275 stars 40 forks source link

Fixed most of broken tests #173

Closed rtvd closed 4 years ago

rtvd commented 4 years ago

The breakage was caused by a call to write-to-uvstream which specified both :start and :end as NIL.

Unfortunately, it was easier to alter write-to-uvstream than change the calling code.

For the reference, the test report looked like this:

Running test suite CL-ASYNC-TEST-CORE
 Running test DATA-POINTERS .
 Running test IPV4-ADDRESS ..........
 Running test IPV6-ADDRESS ............
 Running test POINTER-CALLBACKS ...
 Running test POINTER-DATA ...
 Running test EVENT-LOOP-STARTS .
 Running test EVENT-LOOP-EXIT .
 Running test CATCH-APP-ERRORS ..
 Running test DATA-AND-FN-POINTERS ..
 Running test EXIT-CALLBACKS .
 Running test DELAY-SIMPLE .
 Running test DELAY-TIMER .
 Running test DELAY-MULTI ...
 Running test INTERVAL .
 Running test DNS-SIMPLE .
 Running test DNS-MULTI ..
 Running test DNS-LOOKUP-IPV4 .
 Running test DNS-LOOKUP-IPV6 .
 Running test DNS-FAIL ..
 Running test REVERSE-DNS-LOOKUP-IPV4 .
 Running test REVERSE-DNS-LOOKUP-IPV6 .
 Running test DNS-LOOKUP-MEM-LEAK .
 Running test REVERSE-DNS-LOOKUP-MEM-LEAK .
 Running test TCP-SIMPLE-CLIENT-SERVER X
WARNING:
   aborting connection to localhost:31388 on a tcp socket that is being closed: #<CL-ASYNC:TCP-SOCKET {1004998483}> (uvstream #.(SB-SYS:INT-SAP #X7F6BB00214A0))

 Running test TCP-CONNECT-FAIL ..
 Running test TCP-SERVER-CLOSE X
 Running test TCP-SERVER-STREAM X
 Running test TEST-ADDRESS-IN-USE ..
 Running test WRITE-SEQ-WITH-OFFSET X
 Running test PIPE-SIMPLE-CLIENT-SERVER X
 Running test PIPE-CONNECT-FAIL X
 Running test PIPE-SERVER-CLOSE X
 Running test PIPE-SERVER-STREAM X
 Running test STREAM-READ-WRITE-SEQUENCE X
 Running test SIGNAL-HANDLER-ADD-REMOVE .
 Running test IDLE .
 Running test POLL-FD .
 Running test MKDTEMP ..
 Running test MKDTEMP-FAIL .
 Running test SPAWN-SIMPLE .....
 Running test SPAWN-REDIRECT-OUTPUT .....X
 Running test SPAWN-REDIRECT-ERROR-OUTPUT .....X
 Running test SPAWN-REDIRECT-STREAM .....X
 Running test SPAWN-EXEC-FAILURE .
 Running test PROCESS-KILL ....
 Running test PROCESS-ENV .
 Running test FS-MONITOR .......
 Running test FS-WATCH-FAILURE .
 Did 109 checks.
    Pass: 97 (88%)
    Skip: 0 ( 0%)
    Fail: 12 (11%)
Plisp commented 4 years ago

Hmm I think I introduced this breakage a while ago (it was working back then). With this fix all tests are passing again on my system. Do you know what function call is passing NIL?

rtvd commented 4 years ago

This one:

(defmethod streamish-write ((streamish streamish) data &key start end &allow-other-keys)
  (unless (streamish-closed-p streamish)
    (write-to-uvstream (streamish-c streamish)
                       (streamish-convert-data data)
                       :start start :end end)))

As you can see, its start and end keyword arguments are passed to write-to-uvstream. Problem is, that the arguments are not always present. If they are not, their value is NIL and those NIL values are passed explicitly to write-to-uvstream.

BTW, I did not find a documentation which would explain the meaning of start and end in streamish-write. I guess it is a way to select a specific range of values from data but then that probably means that data is always a sequence of bytes. So perhaps the interface could be made be more simple by getting rid of start and end and using some kind of view over data to select the appropriate region?

Plisp commented 4 years ago

Yeah you're right. It's probably better to leave it as it is for now since streamish-write is public API.

orthecreedence commented 4 years ago

Thank you for this change.