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