@@ -23,18 +23,42 @@ img_file = PackageCompiler.compile_package("Matcha", "UnicodeFun", force = false
2323 end
2424end
2525
26+
2627@testset " juliac" begin
2728 mktempdir () do build
2829 juliac = joinpath (@__DIR__ , " .." , " juliac.jl" )
2930 jlfile = joinpath (@__DIR__ , " .." , " examples" , " hello.jl" )
3031 cfile = joinpath (@__DIR__ , " .." , " examples" , " program.c" )
31- build = mktempdir ()
3232 julia = Base. julia_cmd ()
3333 @test success (` $julia $juliac -vosej $jlfile $cfile $build ` )
3434 @test isfile (joinpath (build, " hello.$(Libdl. dlext) " ))
3535 @test isfile (joinpath (build, " hello$(executable_ext ()) " ))
3636 cd (build) do
37- run (` ./$(" hello$(executable_ext ()) " ) ` )
37+ @test success (` ./$(" hello$(executable_ext ()) " ) ` )
3838 end
3939 end
4040end
41+
42+ @testset " build_executable" begin
43+ build = mktempdir ()
44+ jlfile = joinpath (@__DIR__ , " .." , " examples" , " hello.jl" )
45+ snoopfile = open (joinpath (build, " snoop.jl" ), " w" ) do io
46+ write (io, open (read, jlfile))
47+ println (io)
48+ println (io, " using .Hello; Hello.julia_main(String[])" )
49+ end
50+ build_executable (
51+ jlfile,
52+ snoopfile = snoopfile, builddir = build,
53+ verbose = false , quiet = false ,
54+ )
55+ @test isfile (joinpath (build, " hello.$(Libdl. dlext) " ))
56+ @test isfile (joinpath (build, " hello$(executable_ext ()) " ))
57+ cd (build) do
58+ @test success (` ./$(" hello$(executable_ext ()) " ) ` )
59+ end
60+ for i = 1 : 100
61+ try rm (build, recursive = true ) end
62+ sleep (1 / 100 )
63+ end
64+ end
0 commit comments