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