1 IN: tools.deploy.tests
\r
2 USING: tools.test system io.pathnames io.files io.files.info
\r
3 io.files.temp kernel tools.deploy.config
\r
4 tools.deploy.config.editor tools.deploy.backend math sequences
\r
5 io.launcher arrays namespaces continuations layouts accessors
\r
6 io.encodings.ascii urls math.parser io.directories ;
\r
8 : shake-and-bake ( vocab -- )
\r
9 [ "test.image" temp-file delete-file ] ignore-errors
\r
11 [ vm "test.image" temp-file ] dip
\r
12 dup deploy-config make-deploy-image
\r
15 : small-enough? ( n -- ? )
\r
16 [ "test.image" temp-file file-info size>> ] [ cell 4 / * ] bi* <= ;
\r
18 [ t ] [ "hello-world" shake-and-bake 500000 small-enough? ] unit-test
\r
20 [ t ] [ "sudoku" shake-and-bake 800000 small-enough? ] unit-test
\r
22 [ t ] [ "hello-ui" shake-and-bake 1300000 small-enough? ] unit-test
\r
24 [ "staging.math-compiler-threads-ui-strip.image" ] [
\r
25 "hello-ui" deploy-config
\r
26 [ bootstrap-profile staging-image-name file-name ] bind
\r
29 [ t ] [ "maze" shake-and-bake 1200000 small-enough? ] unit-test
\r
31 [ t ] [ "tetris" shake-and-bake 1500000 small-enough? ] unit-test
\r
33 [ t ] [ "bunny" shake-and-bake 2500000 small-enough? ] unit-test
\r
36 [ t ] [ "webkit-demo" shake-and-bake 500000 small-enough? ] unit-test
\r
39 : run-temp-image ( -- )
\r
41 "-i=" "test.image" temp-file append
\r
42 2array try-process ;
\r
45 "tools.deploy.test.1"
\r
46 "tools.deploy.test.2"
\r
47 "tools.deploy.test.3"
\r
48 "tools.deploy.test.4"
\r
56 USING: http.client http.server http.server.dispatchers
\r
57 http.server.responses http.server.static io.servers.connection ;
\r
59 SINGLETON: quit-responder
\r
61 M: quit-responder call-responder*
\r
62 2drop stop-this-server "Goodbye" "text/html" <content> ;
\r
64 : add-quot-responder ( responder -- responder )
\r
65 quit-responder "quit" add-responder ;
\r
67 : test-httpd ( responder -- )
\r
74 sockets>> first addr>> port>>
\r
75 dup number>string "resource:temp/port-number" ascii set-file-contents
\r
82 "resource:basis/http/test" <static> >>default
\r
88 "tools.deploy.test.5" shake-and-bake
\r
92 : add-port ( url -- url' )
\r
93 >url clone "port" get >>port ;
\r
95 [ ] [ "http://localhost/quit" add-port http-get 2drop ] unit-test
\r
98 "tools.deploy.test.6" shake-and-bake
\r
103 "tools.deploy.test.7" shake-and-bake
\r
108 "tools.deploy.test.8" shake-and-bake
\r
113 "tools.deploy.test.9" shake-and-bake
\r