1 IN: tools.deploy.tests
\r
2 USING: tools.test system io.files kernel tools.deploy.config
\r
3 tools.deploy.backend math sequences io.launcher arrays
\r
4 namespaces continuations layouts accessors io.encodings.ascii
\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 [ ] [ "hello-world" shake-and-bake ] unit-test
\r
19 [ t ] [ 500000 small-enough? ] unit-test
\r
21 [ ] [ "sudoku" shake-and-bake ] unit-test
\r
23 [ t ] [ 800000 small-enough? ] unit-test
\r
25 [ ] [ "hello-ui" shake-and-bake ] unit-test
\r
27 [ t ] [ 1300000 small-enough? ] unit-test
\r
29 [ "staging.math-compiler-threads-ui-strip.image" ] [
\r
30 "hello-ui" deploy-config
\r
31 [ bootstrap-profile staging-image-name file-name ] bind
\r
34 [ ] [ "maze" shake-and-bake ] unit-test
\r
36 [ t ] [ 1200000 small-enough? ] unit-test
\r
38 [ ] [ "tetris" shake-and-bake ] unit-test
\r
40 [ t ] [ 1500000 small-enough? ] unit-test
\r
42 ! [ ] [ "bunny" shake-and-bake ] unit-test
\r
44 ! [ t ] [ 2500000 small-enough? ] unit-test
\r
46 : run-temp-image ( -- )
\r
48 "-i=" "test.image" temp-file append
\r
49 2array try-process ;
\r
52 "tools.deploy.test.1"
\r
53 "tools.deploy.test.2"
\r
54 "tools.deploy.test.3"
\r
55 "tools.deploy.test.4"
\r
63 USING: http.client http.server http.server.dispatchers
\r
64 http.server.responses http.server.static io.servers.connection ;
\r
66 SINGLETON: quit-responder
\r
68 M: quit-responder call-responder*
\r
69 2drop stop-this-server "Goodbye" "text/html" <content> ;
\r
71 : add-quot-responder ( responder -- responder )
\r
72 quit-responder "quit" add-responder ;
\r
74 : test-httpd ( responder -- )
\r
81 sockets>> first addr>> port>>
\r
82 dup number>string "resource:temp/port-number" ascii set-file-contents
\r
89 "resource:basis/http/test" <static> >>default
\r
95 "tools.deploy.test.5" shake-and-bake
\r
99 : add-port ( url -- url' )
\r
100 >url clone "port" get >>port ;
\r
102 [ ] [ "http://localhost/quit" add-port http-get 2drop ] unit-test
\r
105 "tools.deploy.test.6" shake-and-bake
\r
110 "tools.deploy.test.7" shake-and-bake
\r