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