]> gitweb.factorcode.org Git - factor.git/blob - basis/tools/deploy/deploy-tests.factor
Merge branch 'master' into experimental
[factor.git] / basis / tools / deploy / deploy-tests.factor
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
7 tools.deploy.test ;\r
8 \r
9 [ t ] [ "hello-world" shake-and-bake 500000 small-enough? ] unit-test\r
10 \r
11 [ t ] [ "sudoku" shake-and-bake 800000 small-enough? ] unit-test\r
12 \r
13 [ t ] [ "hello-ui" shake-and-bake 1300000 small-enough? ] unit-test\r
14 \r
15 [ "staging.math-compiler-threads-ui-strip.image" ] [\r
16     "hello-ui" deploy-config\r
17     [ bootstrap-profile staging-image-name file-name ] bind\r
18 ] unit-test\r
19 \r
20 [ t ] [ "maze" shake-and-bake 1200000 small-enough? ] unit-test\r
21 \r
22 [ t ] [ "tetris" shake-and-bake 1500000 small-enough? ] unit-test\r
23 \r
24 [ t ] [ "bunny" shake-and-bake 2500000 small-enough? ] unit-test\r
25 \r
26 os macosx? [\r
27     [ t ] [ "webkit-demo" shake-and-bake 500000 small-enough? ] unit-test\r
28 ] when\r
29 \r
30 {\r
31     "tools.deploy.test.1"\r
32     "tools.deploy.test.2"\r
33     "tools.deploy.test.3"\r
34     "tools.deploy.test.4"\r
35 } [\r
36     [ ] swap [\r
37         shake-and-bake\r
38         run-temp-image\r
39     ] curry unit-test\r
40 ] each\r
41 \r
42 USING: http.client http.server http.server.dispatchers\r
43 http.server.responses http.server.static io.servers.connection ;\r
44 \r
45 SINGLETON: quit-responder\r
46 \r
47 M: quit-responder call-responder*\r
48     2drop stop-this-server "Goodbye" "text/html" <content> ;\r
49 \r
50 : add-quot-responder ( responder -- responder )\r
51     quit-responder "quit" add-responder ;\r
52 \r
53 : test-httpd ( responder -- )\r
54     [\r
55         main-responder set\r
56         <http-server>\r
57             0 >>insecure\r
58             f >>secure\r
59         dup start-server*\r
60         sockets>> first addr>> port>>\r
61         dup number>string "resource:temp/port-number" ascii set-file-contents\r
62     ] with-scope\r
63     "port" set ;\r
64 \r
65 [ ] [\r
66     <dispatcher>\r
67         add-quot-responder\r
68         "resource:basis/http/test" <static> >>default\r
69 \r
70     test-httpd\r
71 ] unit-test\r
72 \r
73 [ ] [\r
74     "tools.deploy.test.5" shake-and-bake\r
75     run-temp-image\r
76 ] unit-test\r
77 \r
78 : add-port ( url -- url' )\r
79     >url clone "port" get >>port ;\r
80 \r
81 [ ] [ "http://localhost/quit" add-port http-get 2drop ] unit-test\r
82 \r
83 [ ] [\r
84     "tools.deploy.test.6" shake-and-bake\r
85     run-temp-image\r
86 ] unit-test\r
87 \r
88 [ ] [\r
89     "tools.deploy.test.7" shake-and-bake\r
90     run-temp-image\r
91 ] unit-test\r
92 \r
93 [ ] [\r
94     "tools.deploy.test.8" shake-and-bake\r
95     run-temp-image\r
96 ] unit-test\r
97 \r
98 [ ] [\r
99     "tools.deploy.test.9" shake-and-bake\r
100     run-temp-image\r
101 ] unit-test\r
102 \r
103 [ ] [\r
104     "tools.deploy.test.10" shake-and-bake\r
105     run-temp-image\r
106 ] unit-test\r