]> gitweb.factorcode.org Git - factor.git/blob - basis/tools/deploy/deploy-tests.factor
vocabs.metadata.resources: fix help lint
[factor.git] / basis / tools / deploy / deploy-tests.factor
1 USING: tools.test system io io.encodings.ascii io.pathnames\r
2 io.files io.files.info io.files.temp 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 urls math.parser io.directories tools.deploy.test ;\r
6 IN: tools.deploy.tests\r
7 \r
8 [ ] [ "hello-world" shake-and-bake 500000 small-enough? ] unit-test\r
9 \r
10 [ ] [ "sudoku" shake-and-bake 800000 small-enough? ] unit-test\r
11 \r
12 [ ] [ "hello-ui" shake-and-bake 1300000 small-enough? ] unit-test\r
13 \r
14 [ "staging.math-threads-compiler-ui.image" ] [\r
15     "hello-ui" deploy-config\r
16     [ bootstrap-profile staging-image-name file-name ] bind\r
17 ] unit-test\r
18 \r
19 [ ] [ "maze" shake-and-bake 1200000 small-enough? ] unit-test\r
20 \r
21 [ ] [ "tetris" shake-and-bake 1500000 small-enough? ] unit-test\r
22 \r
23 [ ] [ "spheres" shake-and-bake 1500000 small-enough? ] unit-test\r
24 \r
25 [ ] [ "terrain" shake-and-bake 1700000 small-enough? ] unit-test\r
26 \r
27 [ ] [ "gpu.demos.raytrace" shake-and-bake 2500000 small-enough? ] unit-test\r
28 \r
29 [ ] [ "bunny" shake-and-bake 2500000 small-enough? ] unit-test\r
30 \r
31 [ ] [ "gpu.demos.bunny" shake-and-bake 3500000 small-enough? ] unit-test\r
32 \r
33 os macosx? [\r
34     [ ] [ "webkit-demo" shake-and-bake 500000 small-enough? ] unit-test\r
35 ] when\r
36 \r
37 [ ] [ "benchmark.regex-dna" shake-and-bake 900000 small-enough? ] unit-test\r
38 \r
39 {\r
40     "tools.deploy.test.1"\r
41     "tools.deploy.test.2"\r
42     "tools.deploy.test.3"\r
43     "tools.deploy.test.4"\r
44 } [\r
45     [ ] swap [\r
46         shake-and-bake\r
47         run-temp-image\r
48     ] curry unit-test\r
49 ] each\r
50 \r
51 USING: http.client http.server http.server.dispatchers\r
52 http.server.responses http.server.static io.servers.connection ;\r
53 \r
54 SINGLETON: quit-responder\r
55 \r
56 M: quit-responder call-responder*\r
57     2drop stop-this-server "Goodbye" "text/html" <content> ;\r
58 \r
59 : add-quot-responder ( responder -- responder )\r
60     quit-responder "quit" add-responder ;\r
61 \r
62 : test-httpd ( responder -- )\r
63     [\r
64         main-responder set\r
65         <http-server>\r
66             0 >>insecure\r
67             f >>secure\r
68         dup start-server*\r
69         sockets>> first addr>> port>>\r
70         dup number>string "resource:temp/port-number" ascii set-file-contents\r
71     ] with-scope\r
72     "port" set ;\r
73 \r
74 [ ] [\r
75     <dispatcher>\r
76         add-quot-responder\r
77         "vocab:http/test" <static> >>default\r
78 \r
79     test-httpd\r
80 ] unit-test\r
81 \r
82 [ ] [\r
83     "tools.deploy.test.5" shake-and-bake\r
84     run-temp-image\r
85 ] unit-test\r
86 \r
87 : add-port ( url -- url' )\r
88     >url clone "port" get >>port ;\r
89 \r
90 [ ] [ "http://localhost/quit" add-port http-get 2drop ] unit-test\r
91 \r
92 {\r
93     "tools.deploy.test.6"\r
94     "tools.deploy.test.7"\r
95     "tools.deploy.test.9"\r
96     "tools.deploy.test.10"\r
97     "tools.deploy.test.11"\r
98     "tools.deploy.test.12"\r
99 } [\r
100     [ ] swap [\r
101         shake-and-bake\r
102         run-temp-image\r
103     ] curry unit-test\r
104 ] each\r
105 \r
106 os windows? os macosx? or [\r
107     [ ] [ "tools.deploy.test.8" shake-and-bake run-temp-image ] unit-test\r
108 ] when\r
109 \r
110 os macosx? [\r
111     [ ] [ "tools.deploy.test.14" shake-and-bake run-temp-image ] unit-test\r
112 ] when\r
113 \r
114 [ { "a" "b" "c" } ] [\r
115     "tools.deploy.test.15" shake-and-bake deploy-test-command\r
116     { "a" "b" "c" } append\r
117     ascii [ lines ] with-process-reader\r
118     rest\r
119 ] unit-test\r
120 \r
121 [ ] [ "tools.deploy.test.16" shake-and-bake run-temp-image ] unit-test\r
122 \r
123 [ ] [ "tools.deploy.test.17" shake-and-bake run-temp-image ] unit-test\r
124 \r
125 [ t ] [\r
126     "tools.deploy.test.18" shake-and-bake\r
127     deploy-test-command ascii [ readln ] with-process-reader\r
128     "test.image" temp-file =\r
129 ] unit-test\r