@@ -5,24 +5,45 @@ build_app_jl = joinpath(@__DIR__, "..", "build_app.jl")
5
5
examples_blink = joinpath (@__DIR__ , " .." , " examples" , " blink.jl" )
6
6
examples_hello = joinpath (@__DIR__ , " .." , " examples" , " hello.jl" )
7
7
8
+ builddir = mktempdir ()
9
+ @assert isdir (builddir)
10
+
8
11
@testset " HelloWorld.app" begin
9
- @test success (` $julia $build_app_jl $examples_hello "HelloWorld"` )
10
- @test success (` ./builddir/HelloWorld.app/Contents/MacOS/hello` )
12
+ # Test the build_app.jl script.
13
+ # `@test contains(readstring(cmd), "Done building")` tests that the command
14
+ # runs, and that gets all the way to the end. This is prefereable to
15
+ # `@test success(cmd)`, because `success` suppresses the cmd's output, so we
16
+ # can't see where the test is failing.
17
+ @test contains (readstring (` $julia $build_app_jl --verbose $examples_hello "HelloWorld" $builddir ` ),
18
+ " Done building" )
19
+ @test isdir (" $builddir /HelloWorld.app" )
20
+ @test success (` $builddir /HelloWorld.app/Contents/MacOS/hello` )
11
21
end
12
22
13
23
@testset " HelloBlink.app" begin
14
24
blinkPkg = Pkg. dir (" Blink" )
15
25
httpParserPkg = Pkg. dir (" HttpParser" )
16
26
mbedTLSPkg = Pkg. dir (" MbedTLS" )
17
27
18
- @test success (` $julia $build_app_jl
19
- -R $(joinpath (blinkPkg, " deps/Julia.app" ))
20
- -R $(joinpath (blinkPkg, " src/AtomShell/main.js" ))
21
- -R $(joinpath (blinkPkg, " src/content/main.html" ))
22
- -R $(joinpath (blinkPkg, " res" ))
23
- -L $(joinpath (httpParserPkg, " deps/usr/lib/libhttp_parser.dylib" ))
24
- -L $(joinpath (mbedTLSPkg, " deps/usr/lib/libmbedcrypto.2.7.1.dylib" ))
25
- $examples_blink "HelloBlink"` )
28
+ @test contains (readstring (` $julia $build_app_jl --verbose
29
+ -R $(joinpath (blinkPkg, " deps/Julia.app" ))
30
+ -R $(joinpath (blinkPkg, " src/AtomShell/main.js" ))
31
+ -R $(joinpath (blinkPkg, " src/content/main.html" ))
32
+ -R $(joinpath (blinkPkg, " res" ))
33
+ -L $(joinpath (httpParserPkg, " deps/usr/lib/libhttp_parser.dylib" ))
34
+ -L $(joinpath (mbedTLSPkg, " deps/usr/lib/libmbedcrypto.2.7.1.dylib" ))
35
+ $examples_blink "HelloBlink" $builddir ` ),
36
+ " Done building" )
37
+
38
+ @test isdir (" $builddir /HelloBlink.app" )
39
+
40
+ # Manually kill HelloBlink, since it waits for user input.
41
+ @async begin
42
+ sleep (15 ) # wait til blink has started up
43
+ run (` pkill blink` )
44
+ end
45
+ try # expect failure due to pkill, so not really much to test.
46
+ run (` $builddir /HelloBlink.app/Contents/MacOS/blink` )
47
+ end
26
48
27
- @test success (` ./builddir/HelloBlink.app/Contents/MacOS/blink` )
28
49
end
0 commit comments