2008-03-01 17:00:45 -05:00
|
|
|
IN: tools.deploy.tests
|
2008-02-28 02:21:30 -05:00
|
|
|
USING: tools.test system io.files kernel tools.deploy.config
|
2008-03-19 16:24:49 -04:00
|
|
|
tools.deploy.backend math sequences io.launcher arrays
|
2008-04-11 15:43:26 -04:00
|
|
|
namespaces continuations layouts accessors ;
|
2008-02-28 02:21:30 -05:00
|
|
|
|
2008-03-14 18:39:57 -04:00
|
|
|
: shake-and-bake ( vocab -- )
|
2008-03-27 12:48:51 -04:00
|
|
|
[ "test.image" temp-file delete-file ] ignore-errors
|
|
|
|
"resource:" [
|
2008-03-14 18:39:57 -04:00
|
|
|
>r vm
|
2008-03-13 04:46:25 -04:00
|
|
|
"test.image" temp-file
|
2008-03-14 18:39:57 -04:00
|
|
|
r> dup deploy-config make-deploy-image
|
2008-02-28 02:21:30 -05:00
|
|
|
] with-directory ;
|
|
|
|
|
2008-03-14 18:39:57 -04:00
|
|
|
: small-enough? ( n -- ? )
|
2008-07-05 04:44:54 -04:00
|
|
|
>r "test.image" temp-file file-info size>> r> cell 4 / * <= ;
|
2008-03-14 18:39:57 -04:00
|
|
|
|
2008-02-28 02:21:30 -05:00
|
|
|
[ ] [ "hello-world" shake-and-bake ] unit-test
|
|
|
|
|
2008-07-05 04:59:49 -04:00
|
|
|
[ t ] [ 500000 small-enough? ] unit-test
|
2008-02-28 02:21:30 -05:00
|
|
|
|
2008-03-13 04:46:25 -04:00
|
|
|
[ ] [ "sudoku" shake-and-bake ] unit-test
|
|
|
|
|
2008-07-05 04:59:49 -04:00
|
|
|
[ t ] [ 800000 small-enough? ] unit-test
|
2008-03-13 04:46:25 -04:00
|
|
|
|
2008-02-28 02:21:30 -05:00
|
|
|
[ ] [ "hello-ui" shake-and-bake ] unit-test
|
|
|
|
|
2008-07-05 04:59:49 -04:00
|
|
|
[ t ] [ 1300000 small-enough? ] unit-test
|
2008-07-05 04:44:54 -04:00
|
|
|
|
2008-09-07 22:32:06 -04:00
|
|
|
[ "staging.math-compiler-threads-ui-strip.image" ] [
|
2008-03-20 22:35:01 -04:00
|
|
|
"hello-ui" deploy-config
|
|
|
|
[ bootstrap-profile staging-image-name file-name ] bind
|
2008-03-19 15:39:08 -04:00
|
|
|
] unit-test
|
|
|
|
|
2008-05-31 01:07:30 -04:00
|
|
|
[ ] [ "maze" shake-and-bake ] unit-test
|
|
|
|
|
2008-07-05 04:59:49 -04:00
|
|
|
[ t ] [ 1200000 small-enough? ] unit-test
|
2008-07-05 04:44:54 -04:00
|
|
|
|
2008-08-31 02:34:00 -04:00
|
|
|
! [ ] [ "tetris" shake-and-bake ] unit-test
|
|
|
|
!
|
|
|
|
! [ t ] [ 1500000 small-enough? ] unit-test
|
|
|
|
!
|
2008-09-07 22:32:06 -04:00
|
|
|
[ ] [ "bunny" shake-and-bake ] unit-test
|
|
|
|
|
|
|
|
[ t ] [ 2500000 small-enough? ] unit-test
|
2008-03-13 04:46:25 -04:00
|
|
|
|
2008-09-28 01:40:41 -04:00
|
|
|
: run-temp-image ( -- )
|
|
|
|
vm
|
|
|
|
"-i=" "test.image" temp-file append
|
|
|
|
2array try-process ;
|
|
|
|
|
2008-06-18 23:29:48 -04:00
|
|
|
{
|
|
|
|
"tools.deploy.test.1"
|
|
|
|
"tools.deploy.test.2"
|
|
|
|
"tools.deploy.test.3"
|
|
|
|
"tools.deploy.test.4"
|
|
|
|
} [
|
|
|
|
[ ] swap [
|
|
|
|
shake-and-bake
|
2008-09-28 01:40:41 -04:00
|
|
|
run-temp-image
|
2008-06-18 23:29:48 -04:00
|
|
|
] curry unit-test
|
|
|
|
] each
|
2008-06-25 21:47:07 -04:00
|
|
|
|
2008-07-03 21:50:08 -04:00
|
|
|
USING: http.client http.server http.server.dispatchers
|
2008-06-25 21:47:07 -04:00
|
|
|
http.server.responses http.server.static io.servers.connection ;
|
|
|
|
|
2008-07-03 21:50:08 -04:00
|
|
|
SINGLETON: quit-responder
|
|
|
|
|
|
|
|
M: quit-responder call-responder*
|
2008-10-02 09:30:38 -04:00
|
|
|
2drop stop-this-server "Goodbye" "text/html" <content> ;
|
2008-07-03 21:50:08 -04:00
|
|
|
|
|
|
|
: add-quot-responder ( responder -- responder )
|
|
|
|
quit-responder "quit" add-responder ;
|
2008-06-25 21:47:07 -04:00
|
|
|
|
|
|
|
: test-httpd ( -- )
|
|
|
|
#! Return as soon as server is running.
|
|
|
|
<http-server>
|
|
|
|
1237 >>insecure
|
|
|
|
f >>secure
|
|
|
|
start-server* ;
|
|
|
|
|
|
|
|
[ ] [
|
|
|
|
[
|
|
|
|
<dispatcher>
|
2008-07-03 21:50:08 -04:00
|
|
|
add-quot-responder
|
2008-09-05 17:43:42 -04:00
|
|
|
"resource:basis/http/test" <static> >>default
|
2008-06-25 21:47:07 -04:00
|
|
|
main-responder set
|
|
|
|
|
|
|
|
test-httpd
|
|
|
|
] with-scope
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ ] [
|
|
|
|
"tools.deploy.test.5" shake-and-bake
|
2008-09-28 01:40:41 -04:00
|
|
|
run-temp-image
|
2008-06-25 21:47:07 -04:00
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ ] [ "http://localhost:1237/quit" http-get 2drop ] unit-test
|
2008-09-28 01:40:41 -04:00
|
|
|
|
|
|
|
[ ] [
|
|
|
|
"tools.deploy.test.6" shake-and-bake
|
|
|
|
run-temp-image
|
|
|
|
] unit-test
|