1 USING: tools.test concurrency.distributed kernel io.files
2 io.files.temp io.directories arrays io.sockets system calendar
3 combinators threads math sequences concurrency.messaging
4 continuations accessors prettyprint io.servers ;
5 FROM: concurrency.messaging => receive send ;
6 IN: concurrency.distributed.tests
8 CONSTANT: test-ip "127.0.0.1"
10 : test-node-server ( -- threaded-server )
12 { [ os unix? ] [ "distributed-concurrency-test" temp-file <local> ] }
13 { [ os windows? ] [ test-ip 0 <inet4> ] }
14 } cond <node-server> ;
16 : test-node-client ( -- addrspec )
18 { [ os unix? ] [ "distributed-concurrency-test" temp-file <local> ] }
19 { [ os windows? ] [ test-ip insecure-port <inet4> ] }
23 [ ] [ [ "distributed-concurrency-test" temp-file delete-file ] ignore-errors ] unit-test
28 receive first2 [ 3 + ] dip send
29 "thread-a" unregister-remote-thread
31 "thread-a" register-remote-thread
36 test-node-client "thread-a" <remote-thread> send
37 100 seconds receive-timeout
39 ] with-threaded-server