]> gitweb.factorcode.org Git - factor.git/blob - basis/tools/deploy/test/test.factor
Factor source files should not be executable
[factor.git] / basis / tools / deploy / test / test.factor
1 USING: accessors arrays continuations io.directories io.files.info
2 io.files.temp io.launcher io.backend kernel layouts math sequences system
3 tools.deploy.backend tools.deploy.config.editor ;
4 IN: tools.deploy.test
5
6 : shake-and-bake ( vocab -- )
7     [ "test.image" temp-file delete-file ] ignore-errors
8     "resource:" [
9         [ vm "test.image" temp-file ] dip
10         dup deploy-config make-deploy-image
11     ] with-directory ;
12
13 ERROR: image-too-big actual-size max-size ;
14
15 : small-enough? ( n -- )
16     [ "test.image" temp-file file-info size>> ]
17     [
18         cell 4 / *
19         cpu ppc? [ 100000 + ] when
20         os windows? [ 150000 + ] when
21     ] bi*
22     2dup <= [ 2drop ] [ image-too-big ] if ;
23
24 : deploy-test-command ( -- args )
25     os macosx?
26     "resource:Factor.app/Contents/MacOS/factor" normalize-path vm ?
27     "-i=" "test.image" temp-file append 2array ;
28
29 : run-temp-image ( -- )
30     deploy-test-command try-output-process ;