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 ;
10 ! Delete all cached staging images in case syntax or
11 ! other core vocabularies have changed and staging
15 [ "nosuchvocab" deploy ] [ no-vocab? ] must-fail-with
17 [ "no such vocab, fool!" deploy ] [ bad-vocab-name? ] must-fail-with
19 { } [ "hello-world" shake-and-bake 550000 small-enough? ] long-unit-test
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" } } [
25 { open-directory-after-deploy? f }
26 { deploy-directory $[ temp-directory ] }
29 "hello-world" deploy-path 1array
30 ascii [ lines ] with-process-reader
34 { } [ "sudoku" shake-and-bake 800000 small-enough? ] long-unit-test
36 ! [ ] [ "hello-ui" shake-and-bake 1605000 small-enough? ] long-unit-test
37 { } [ "hello-ui" shake-and-bake 2242000 small-enough? ] long-unit-test
39 { "math-threads-compiler-io-ui" } [
40 "hello-ui" deploy-config config>profile
41 staging-image-name file-name "." split second
44 ! [ ] [ "maze" shake-and-bake 1520000 small-enough? ] long-unit-test
45 { } [ "maze" shake-and-bake 2150000 small-enough? ] long-unit-test
47 ! [ ] [ "tetris" shake-and-bake 1734000 small-enough? ] long-unit-test
48 { } [ "tetris" shake-and-bake 2462008 small-enough? ] long-unit-test
50 ! [ ] [ "spheres" shake-and-bake 1557000 small-enough? ] long-unit-test
51 { } [ "spheres" shake-and-bake 2184500 small-enough? ] long-unit-test
53 ! [ ] [ "terrain" shake-and-bake 2053000 small-enough? ] long-unit-test
54 { } [ "terrain" shake-and-bake 2685300 small-enough? ] long-unit-test
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
59 ! { } [ "bunny" shake-and-bake 2559640 small-enough? ] long-unit-test
60 { } [ "bunny" shake-and-bake 2700000 small-enough? ] long-unit-test
62 { } [ "gpu.demos.bunny" shake-and-bake 3650000 small-enough? ] long-unit-test
65 [ ] [ "webkit-demo" shake-and-bake 600000 small-enough? ] long-unit-test
68 { } [ "benchmark.regex-dna" shake-and-bake 900000 small-enough? ] long-unit-test
79 ] curry long-unit-test
82 USING: http.client http.server http.server.dispatchers
83 http.server.responses http.server.static io.servers ;
85 SINGLETON: quit-responder
87 M: quit-responder call-responder*
88 2drop stop-this-server "Goodbye" <html-content> ;
90 : add-quot-responder ( responder -- responder )
91 quit-responder "quit" add-responder ;
93 : test-httpd ( responder -- )
99 servers>> first addr>> port>>
100 dup number>string "port-number" temp-file ascii set-file-contents
101 ] with-variable "port" set ;
106 "vocab:http/test" <static> >>default
112 "tools.deploy.test.5" shake-and-bake
116 : add-port ( url -- url' )
117 >url clone "port" get >>port ;
119 { } [ "http://localhost/quit" add-port http-get 2drop ] long-unit-test
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"
132 ] curry long-unit-test
135 os windows? os macosx? or [
136 [ ] [ "tools.deploy.test.8" shake-and-bake run-temp-image ] long-unit-test
140 [ ] [ "tools.deploy.test.14" shake-and-bake run-temp-image ] long-unit-test
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
150 { } [ "tools.deploy.test.16" shake-and-bake run-temp-image ] long-unit-test
152 { } [ "tools.deploy.test.17" shake-and-bake run-temp-image ] long-unit-test
155 "tools.deploy.test.18" shake-and-bake
156 deploy-test-command ascii [ readln ] with-process-reader
161 "resource:LICENSE.txt" "local-license.txt" temp-file copy-file
162 "tools.deploy.test.19" shake-and-bake run-temp-image
165 { } [ "tools.deploy.test.20" shake-and-bake ] long-unit-test
167 { "<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo>Factor</foo>" }
168 [ deploy-test-command ascii [ readln ] with-process-reader ] long-unit-test
170 ! [ ] [ "tools.deploy.test.20" drop 1353000 small-enough? ] long-unit-test
171 { } [ "tools.deploy.test.20" drop 1363000 small-enough? ] long-unit-test
173 { } [ "tools.deploy.test.21" shake-and-bake ] long-unit-test
176 [ deploy-test-command ascii [ readln ] with-process-reader ] long-unit-test
178 { } [ "tools.deploy.test.21" drop 1260000 small-enough? ] long-unit-test
180 { } [ "benchmark.ui-panes" shake-and-bake run-temp-image ] long-unit-test
182 { } [ "tools.deploy.test.23" shake-and-bake ] long-unit-test