]> gitweb.factorcode.org Git - factor.git/blob - basis/tools/deploy/test/test.factor
d90ee2caf995bdf820188d4c3624e0662dc5db55
[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 : test-image-path ( -- str )
11     test-image temp-file ;
12
13 : shake-and-bake ( vocab -- )
14     test-image-path ?delete-file
15     [
16         [ vm-path test-image temp-file ] dip
17         dup deploy-config make-deploy-image drop
18     ] with-resource-directory ;
19
20 ERROR: image-too-big actual-size max-size ;
21
22 : small-enough? ( n -- )
23     [ test-image-path file-info size>> ]
24     [
25         cell 4 / *
26         cpu ppc? [ 100000 + ] when
27         os windows? [ 160000 + ] when
28     ] bi*
29     2dup <= [ 2drop ] [ image-too-big ] if ;
30
31 : deploy-test-command ( -- args )
32     os macosx?
33     "resource:Factor.app/Contents/MacOS/factor" normalize-path vm-path ?
34     "-i=" test-image-path append 2array ;
35
36 : run-temp-image ( -- )
37     deploy-test-command try-output-process ;