parent
db9073d98d
commit
f6f15b9c82
basis/io/sockets/secure
debug
|
@ -3,12 +3,25 @@
|
||||||
USING: accessors io.sockets.secure kernel ;
|
USING: accessors io.sockets.secure kernel ;
|
||||||
IN: io.sockets.secure.debug
|
IN: io.sockets.secure.debug
|
||||||
|
|
||||||
: <test-secure-config> ( -- config )
|
|
||||||
<secure-config>
|
GENERIC: <test-secure-config>* ( obj -- config )
|
||||||
"vocab:openssl/test/server.pem" >>key-file
|
|
||||||
"vocab:openssl/test/dh1024.pem" >>dh-file
|
|
||||||
|
M: TLSv1 <test-secure-config>* ( obj -- config )
|
||||||
|
drop <secure-config>
|
||||||
|
"vocab:openssl/test-1.0/server.pem" >>key-file
|
||||||
|
"vocab:openssl/test-1.0/dh1024.pem" >>dh-file
|
||||||
"password" >>password ;
|
"password" >>password ;
|
||||||
|
|
||||||
|
M: object <test-secure-config>* ( obj -- config )
|
||||||
|
drop <secure-config>
|
||||||
|
"vocab:openssl/test-1.2/server.pem" >>key-file
|
||||||
|
"vocab:openssl/test-1.2/dh1024.pem" >>dh-file
|
||||||
|
"password" >>password ;
|
||||||
|
|
||||||
|
: <test-secure-config> ( -- config )
|
||||||
|
best-tls-method <test-secure-config>* ;
|
||||||
|
|
||||||
: with-test-context ( quot -- )
|
: with-test-context ( quot -- )
|
||||||
<test-secure-config>
|
<test-secure-config>
|
||||||
swap with-secure-context ; inline
|
swap with-secure-context ; inline
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
USING: accessors calendar classes
|
USING: accessors calendar classes concurrency.conditions
|
||||||
concurrency.promises destructors io io.backend.unix
|
concurrency.mailboxes concurrency.promises continuations
|
||||||
io.encodings.ascii io.sockets io.sockets.secure
|
destructors io io.backend.unix io.encodings.ascii io.sockets
|
||||||
io.sockets.secure.debug io.streams.duplex io.timeouts kernel
|
io.sockets.secure io.sockets.secure.debug io.streams.duplex
|
||||||
locals namespaces threads tools.test ;
|
io.timeouts kernel locals namespaces threads tools.test ;
|
||||||
IN: io.sockets.secure.tests
|
|
||||||
QUALIFIED-WITH: concurrency.messaging qm
|
QUALIFIED-WITH: concurrency.messaging qm
|
||||||
|
IN: io.sockets.secure.tests
|
||||||
|
|
||||||
{ 1 0 } [ [ ] with-secure-context ] must-infer-as
|
{ 1 0 } [ [ ] with-secure-context ] must-infer-as
|
||||||
|
|
||||||
{ } [ <promise> "port" set ] unit-test
|
{ } [ <promise> "port" set ] unit-test
|
||||||
|
|
||||||
:: server-test ( quot -- obj/f )
|
:: server-test ( quot -- )
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
"127.0.0.1" 0 <inet4> f <secure> ascii <server> [
|
"127.0.0.1" 0 <inet4> f <secure> ascii <server> [
|
||||||
|
@ -20,7 +20,12 @@ QUALIFIED-WITH: concurrency.messaging qm
|
||||||
] curry with-stream
|
] curry with-stream
|
||||||
] with-disposal
|
] with-disposal
|
||||||
] with-test-context
|
] with-test-context
|
||||||
] "SSL server test" qm:spawn-linked drop qm:receive ;
|
] "SSL server test" qm:spawn-linked drop
|
||||||
|
! This is hideous.
|
||||||
|
! If we fail with a timeout, the test is passing.
|
||||||
|
! If we fail with something besides a timeout, rethrow it and fail the test.
|
||||||
|
[ qm:my-mailbox 200 milliseconds mailbox-get-timeout drop ]
|
||||||
|
[ dup timed-out-error? [ drop ] [ rethrow ] if ] recover ;
|
||||||
|
|
||||||
: ?promise-test ( mailbox -- obj )
|
: ?promise-test ( mailbox -- obj )
|
||||||
340 milliseconds ?promise-timeout ;
|
340 milliseconds ?promise-timeout ;
|
||||||
|
|
Loading…
Reference in New Issue