Skip to content

Commit b8fae13

Browse files
authoredMay 6, 2018
Merge pull request #8 from NHDaly/build_failures_travis
Fix tests! Green Travis build!! :D
2 parents 4666285 + f33f6f8 commit b8fae13

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed
 

‎.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ git:
2727
# packages:
2828
# - gfortran
2929
before_script: # homebrew for mac
30-
- julia -e 'Pkg.add("Blink")'
30+
- julia -e 'Pkg.add("Blink"); Pkg.build("Blink"); using Blink; Blink.AtomShell.install();'
3131

3232
## uncomment the following lines to override the default test script
3333
#script:

‎test/examples.jl

+32-11
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,45 @@ build_app_jl = joinpath(@__DIR__, "..", "build_app.jl")
55
examples_blink = joinpath(@__DIR__, "..", "examples", "blink.jl")
66
examples_hello = joinpath(@__DIR__, "..", "examples", "hello.jl")
77

8+
builddir = mktempdir()
9+
@assert isdir(builddir)
10+
811
@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`)
1121
end
1222

1323
@testset "HelloBlink.app" begin
1424
blinkPkg = Pkg.dir("Blink")
1525
httpParserPkg = Pkg.dir("HttpParser")
1626
mbedTLSPkg = Pkg.dir("MbedTLS")
1727

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
2648

27-
@test success(`./builddir/HelloBlink.app/Contents/MacOS/blink`)
2849
end

0 commit comments

Comments
 (0)
Please sign in to comment.