]> gitweb.factorcode.org Git - factor.git/blob - basis/tools/deploy/deploy-tests.factor
tools.deploy: up the size.
[factor.git] / basis / tools / deploy / deploy-tests.factor
1 USING: bootstrap.image tools.test system io io.encodings.ascii
2 io.pathnames io.files io.files.info io.files.temp kernel
3 tools.deploy.config tools.deploy.config.editor literals
4 tools.deploy.backend math sequences io.launcher arrays
5 namespaces continuations layouts accessors urls math.parser
6 io.directories splitting tools.deploy tools.deploy.test vocabs ;
7
8 IN: tools.deploy.tests
9
10 ! Delete all cached staging images in case syntax or
11 ! other core vocabularies have changed and staging
12 ! images are stale.
13 delete-staging-images
14
15 [ "nosuchvocab" deploy ] [ no-vocab? ] must-fail-with
16
17 [ "no such vocab, fool!" deploy ] [ bad-vocab-name? ] must-fail-with
18
19 { } [ "hello-world" shake-and-bake 550000 small-enough? ] long-unit-test
20
21 ! XXX: deploy-path is "resource:" by default, but deploying there in a
22 ! test would pollute the Factor directory, so deploy test to temp.
23 { { "Hello world" } } [
24     H{
25         { open-directory-after-deploy? f }
26         { deploy-directory $[ temp-directory ] }
27     } [
28         "hello-world" deploy
29         "hello-world" deploy-path 1array
30         ascii [ lines ] with-process-reader
31     ] with-variables
32 ] long-unit-test
33
34 { } [ "sudoku" shake-and-bake 800000 small-enough? ] long-unit-test
35
36 ! [ ] [ "hello-ui" shake-and-bake 1605000 small-enough? ] long-unit-test
37 { } [ "hello-ui" shake-and-bake 2242000 small-enough? ] long-unit-test
38
39 { "math-threads-compiler-io-ui" } [
40     "hello-ui" deploy-config config>profile
41     staging-image-name file-name "." split second
42 ] long-unit-test
43
44 ! [ ] [ "maze" shake-and-bake 1520000 small-enough? ] long-unit-test
45 { } [ "maze" shake-and-bake 2150000 small-enough? ] long-unit-test
46
47 ! [ ] [ "tetris" shake-and-bake 1734000 small-enough? ] long-unit-test
48 { } [ "tetris" shake-and-bake 2462008 small-enough? ] long-unit-test
49
50 ! [ ] [ "spheres" shake-and-bake 1557000 small-enough? ] long-unit-test
51 { } [ "spheres" shake-and-bake 2184500 small-enough? ] long-unit-test
52
53 ! [ ] [ "terrain" shake-and-bake 2053000 small-enough? ] long-unit-test
54 { } [ "terrain" shake-and-bake 2685300 small-enough? ] long-unit-test
55
56 ! [ ] [ "gpu.demos.raytrace" shake-and-bake 2764000 small-enough? ] long-unit-test
57 { } [ "gpu.demos.raytrace" shake-and-bake 3557800 small-enough? ] long-unit-test
58
59 ! { } [ "bunny" shake-and-bake 2559640 small-enough? ] long-unit-test
60 { } [ "bunny" shake-and-bake 2700000 small-enough? ] long-unit-test
61
62 { } [ "gpu.demos.bunny" shake-and-bake 3650000 small-enough? ] long-unit-test
63
64 os macosx? [
65     [ ] [ "webkit-demo" shake-and-bake 600000 small-enough? ] long-unit-test
66 ] when
67
68 { } [ "benchmark.regex-dna" shake-and-bake 900000 small-enough? ] long-unit-test
69
70 {
71     "tools.deploy.test.1"
72     "tools.deploy.test.2"
73     "tools.deploy.test.3"
74     "tools.deploy.test.4"
75 } [
76     { } swap [
77         shake-and-bake
78         run-temp-image
79     ] curry long-unit-test
80 ] each
81
82 USING: http.client http.server http.server.dispatchers
83 http.server.responses http.server.static io.servers ;
84
85 SINGLETON: quit-responder
86
87 M: quit-responder call-responder*
88     2drop stop-this-server "Goodbye" <html-content> ;
89
90 : add-quot-responder ( responder -- responder )
91     quit-responder "quit" add-responder ;
92
93 : test-httpd ( responder -- )
94     main-responder [
95         <http-server>
96             0 >>insecure
97             f >>secure
98         start-server
99         servers>> first addr>> port>>
100         dup number>string "port-number" temp-file ascii set-file-contents
101     ] with-variable "port" set ;
102
103 { } [
104     <dispatcher>
105         add-quot-responder
106         "vocab:http/test" <static> >>default
107
108     test-httpd
109 ] long-unit-test
110
111 { } [
112     "tools.deploy.test.5" shake-and-bake
113     run-temp-image
114 ] long-unit-test
115
116 : add-port ( url -- url' )
117     >url clone "port" get >>port ;
118
119 { } [ "http://localhost/quit" add-port http-get 2drop ] long-unit-test
120
121 {
122     "tools.deploy.test.6"
123     "tools.deploy.test.7"
124     "tools.deploy.test.9"
125     "tools.deploy.test.10"
126     "tools.deploy.test.11"
127     "tools.deploy.test.12"
128 } [
129     [ ] swap [
130         shake-and-bake
131         run-temp-image
132     ] curry long-unit-test
133 ] each
134
135 os windows? os macosx? or [
136     [ ] [ "tools.deploy.test.8" shake-and-bake run-temp-image ] long-unit-test
137 ] when
138
139 os macosx? [
140     [ ] [ "tools.deploy.test.14" shake-and-bake run-temp-image ] long-unit-test
141 ] when
142
143 { { "a" "b" "c" } } [
144     "tools.deploy.test.15" shake-and-bake deploy-test-command
145     { "a" "b" "c" } append
146     ascii [ lines ] with-process-reader
147     rest
148 ] long-unit-test
149
150 { } [ "tools.deploy.test.16" shake-and-bake run-temp-image ] long-unit-test
151
152 { } [ "tools.deploy.test.17" shake-and-bake run-temp-image ] long-unit-test
153
154 { t } [
155     "tools.deploy.test.18" shake-and-bake
156     deploy-test-command ascii [ readln ] with-process-reader
157     test-image-path =
158 ] long-unit-test
159
160 { } [
161     "resource:LICENSE.txt" "local-license.txt" temp-file copy-file
162     "tools.deploy.test.19" shake-and-bake run-temp-image
163 ] long-unit-test
164
165 { } [ "tools.deploy.test.20" shake-and-bake ] long-unit-test
166
167 { "<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo>Factor</foo>" }
168 [ deploy-test-command ascii [ readln ] with-process-reader ] long-unit-test
169
170 ! [ ] [ "tools.deploy.test.20" drop 1353000 small-enough? ] long-unit-test
171 { } [ "tools.deploy.test.20" drop 1363000 small-enough? ] long-unit-test
172
173 { } [ "tools.deploy.test.21" shake-and-bake ] long-unit-test
174
175 { "1 2 3" }
176 [ deploy-test-command ascii [ readln ] with-process-reader ] long-unit-test
177
178 { } [ "tools.deploy.test.21" drop 1260000 small-enough? ] long-unit-test
179
180 { } [ "benchmark.ui-panes" shake-and-bake run-temp-image ] long-unit-test
181
182 { } [ "tools.deploy.test.23" shake-and-bake ] long-unit-test