2008-04-02 19:25:33 -04:00
|
|
|
USING: tools.test concurrency.distributed kernel io.files
|
2008-12-15 04:33:04 -05:00
|
|
|
io.files.temp io.directories arrays io.sockets system
|
|
|
|
combinators threads math sequences concurrency.messaging
|
|
|
|
continuations accessors prettyprint ;
|
2009-05-16 01:29:21 -04:00
|
|
|
FROM: concurrency.messaging => receive send ;
|
2009-08-13 20:21:44 -04:00
|
|
|
IN: concurrency.distributed.tests
|
2008-04-02 19:25:33 -04:00
|
|
|
|
2008-06-17 06:21:45 -04:00
|
|
|
: test-node ( -- addrspec )
|
2008-04-02 19:25:33 -04:00
|
|
|
{
|
|
|
|
{ [ os unix? ] [ "distributed-concurrency-test" temp-file <local> ] }
|
|
|
|
{ [ os windows? ] [ "127.0.0.1" 1238 <inet4> ] }
|
|
|
|
} cond ;
|
|
|
|
|
|
|
|
[ ] [ [ "distributed-concurrency-test" temp-file delete-file ] ignore-errors ] unit-test
|
|
|
|
|
2008-06-17 06:21:45 -04:00
|
|
|
[ ] [ test-node dup (start-node) ] unit-test
|
2008-04-02 19:25:33 -04:00
|
|
|
|
|
|
|
[ ] [
|
|
|
|
[
|
2008-11-30 19:28:15 -05:00
|
|
|
receive first2 [ 3 + ] dip send
|
2009-10-30 03:59:54 -04:00
|
|
|
"thread-a" unregister-remote-thread
|
2008-04-02 19:25:33 -04:00
|
|
|
] "Thread A" spawn
|
2009-10-30 03:59:54 -04:00
|
|
|
"thread-a" register-remote-thread
|
2008-04-02 19:25:33 -04:00
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ 8 ] [
|
|
|
|
5 self 2array
|
2009-10-29 01:39:25 -04:00
|
|
|
test-node "thread-a" <remote-thread> send
|
2008-04-02 19:25:33 -04:00
|
|
|
|
|
|
|
receive
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ ] [ test-node stop-node ] unit-test
|