1 IN: tools.deploy.tests
\r
2 USING: tools.test system io.files kernel tools.deploy.config
\r
3 tools.deploy.config.editor tools.deploy.backend math sequences
\r
4 io.launcher arrays namespaces continuations layouts accessors
\r
5 io.encodings.ascii urls math.parser ;
\r
7 : shake-and-bake ( vocab -- )
\r
8 [ "test.image" temp-file delete-file ] ignore-errors
\r
10 [ vm "test.image" temp-file ] dip
\r
11 dup deploy-config make-deploy-image
\r
14 : small-enough? ( n -- ? )
\r
15 [ "test.image" temp-file file-info size>> ] [ cell 4 / * ] bi* <= ;
\r
17 [ t ] [ "hello-world" shake-and-bake 500000 small-enough? ] unit-test
\r
19 [ t ] [ "sudoku" shake-and-bake 800000 small-enough? ] unit-test
\r
21 [ t ] [ "hello-ui" shake-and-bake 1300000 small-enough? ] unit-test
\r
23 [ "staging.math-compiler-threads-ui-strip.image" ] [
\r
24 "hello-ui" deploy-config
\r
25 [ bootstrap-profile staging-image-name file-name ] bind
\r
28 [ t ] [ "maze" shake-and-bake 1200000 small-enough? ] unit-test
\r
30 [ t ] [ "tetris" shake-and-bake 1500000 small-enough? ] unit-test
\r
32 [ t ] [ "bunny" shake-and-bake 2500000 small-enough? ] unit-test
\r
35 [ t ] [ "webkit-demo" shake-and-bake 500000 small-enough? ] unit-test
\r
38 : run-temp-image ( -- )
\r
40 "-i=" "test.image" temp-file append
\r
41 2array try-process ;
\r
44 "tools.deploy.test.1"
\r
45 "tools.deploy.test.2"
\r
46 "tools.deploy.test.3"
\r
47 "tools.deploy.test.4"
\r
55 USING: http.client http.server http.server.dispatchers
\r
56 http.server.responses http.server.static io.servers.connection ;
\r
58 SINGLETON: quit-responder
\r
60 M: quit-responder call-responder*
\r
61 2drop stop-this-server "Goodbye" "text/html" <content> ;
\r
63 : add-quot-responder ( responder -- responder )
\r
64 quit-responder "quit" add-responder ;
\r
66 : test-httpd ( responder -- )
\r
73 sockets>> first addr>> port>>
\r
74 dup number>string "resource:temp/port-number" ascii set-file-contents
\r
81 "resource:basis/http/test" <static> >>default
\r
87 "tools.deploy.test.5" shake-and-bake
\r
91 : add-port ( url -- url' )
\r
92 >url clone "port" get >>port ;
\r
94 [ ] [ "http://localhost/quit" add-port http-get 2drop ] unit-test
\r
97 "tools.deploy.test.6" shake-and-bake
\r
102 "tools.deploy.test.7" shake-and-bake
\r
107 "tools.deploy.test.8" shake-and-bake
\r
112 "tools.deploy.test.9" shake-and-bake
\r