io.pipes: add unit test for Linux x86-64 epoll() problem
parent
dfc7326413
commit
ce9b311b10
|
@ -1,7 +1,8 @@
|
||||||
USING: io io.pipes io.streams.string io.encodings.utf8
|
USING: io io.pipes io.streams.string io.encodings.utf8
|
||||||
io.encodings.binary io.streams.duplex io.encodings io.timeouts
|
io.encodings.binary io.streams.duplex io.encodings io.timeouts
|
||||||
namespaces continuations tools.test kernel calendar destructors
|
namespaces continuations tools.test kernel calendar destructors
|
||||||
accessors debugger math sequences ;
|
accessors debugger math sequences threads
|
||||||
|
concurrency.count-downs fry ;
|
||||||
IN: io.pipes.tests
|
IN: io.pipes.tests
|
||||||
|
|
||||||
[ "Hello" ] [
|
[ "Hello" ] [
|
||||||
|
@ -11,6 +12,7 @@ IN: io.pipes.tests
|
||||||
] with-stream
|
] with-stream
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
! Test run-pipeline
|
||||||
[ { } ] [ { } run-pipeline ] unit-test
|
[ { } ] [ { } run-pipeline ] unit-test
|
||||||
[ { f } ] [ { [ f ] } run-pipeline ] unit-test
|
[ { f } ] [ { [ f ] } run-pipeline ] unit-test
|
||||||
[ { "Hello" } ] [
|
[ { "Hello" } ] [
|
||||||
|
@ -26,6 +28,7 @@ IN: io.pipes.tests
|
||||||
} run-pipeline
|
} run-pipeline
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
! Test timeout
|
||||||
[
|
[
|
||||||
utf8 <pipe> [
|
utf8 <pipe> [
|
||||||
1 seconds over set-timeout
|
1 seconds over set-timeout
|
||||||
|
@ -33,6 +36,7 @@ IN: io.pipes.tests
|
||||||
] with-disposal
|
] with-disposal
|
||||||
] must-fail
|
] must-fail
|
||||||
|
|
||||||
|
! Test writing to a half-open pipe
|
||||||
[ ] [
|
[ ] [
|
||||||
1000 [
|
1000 [
|
||||||
utf8 <pipe> [
|
utf8 <pipe> [
|
||||||
|
@ -43,6 +47,34 @@ IN: io.pipes.tests
|
||||||
] times
|
] times
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
! Test non-blocking operation
|
||||||
|
[ ] [
|
||||||
|
[
|
||||||
|
2 <count-down> "count-down" set
|
||||||
|
|
||||||
|
utf8 <pipe> &dispose
|
||||||
|
utf8 <pipe> &dispose
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'[
|
||||||
|
_ stream-read1 drop
|
||||||
|
"count-down" get count-down
|
||||||
|
] in-thread
|
||||||
|
] bi@
|
||||||
|
|
||||||
|
! Give the threads enough time to start blocking on
|
||||||
|
! read
|
||||||
|
1 seconds sleep
|
||||||
|
]
|
||||||
|
! At this point, two threads are blocking on read
|
||||||
|
[ [ "Hi" over stream-write stream-flush ] bi@ ]
|
||||||
|
! At this point, both threads should wake up
|
||||||
|
2bi
|
||||||
|
|
||||||
|
"count-down" get await
|
||||||
|
] with-destructors
|
||||||
|
] unit-test
|
||||||
|
|
||||||
! 0 read should not block
|
! 0 read should not block
|
||||||
[ f ] [
|
[ f ] [
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in New Issue