1 USING: interpolate io io.encodings.ascii io.files io.files.temp
2 io.launcher io.streams.string kernel sequences system ;
3 IN: alien.remote-control.tests
5 : compile-file ( contents -- )
6 "test.c" ascii set-file-contents
7 { "gcc" "-I../" "-L.." "-lfactor" "test.c" }
8 os macosx? cpu x86.64? and [ "-m64" suffix ] when
11 : run-test ( -- line )
12 os windows? "a.exe" "a.out" ?
13 ascii [ readln ] with-process-reader ;
15 :: test-embedding ( code -- line )
20 #include <vm/master.h>
24 int main(int argc, char **argv)
27 default_parameters(&p);
28 p.image_path = STRING_LITERAL("${image}");
30 start_embedded_factor(&p);
37 [ compile-file ] with-temp-directory
38 [ run-test ] with-temp-directory ;
40 ! [ "Done." ] [ "" test-embedding ] unit-test
42 ! [ "Done." ] [ "factor_yield();" test-embedding ] unit-test