Skip to content

Commit

Permalink
Workaround 10 min bound on Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Jan 20, 2019
1 parent 3ecfcbb commit ccabacc
Showing 1 changed file with 38 additions and 6 deletions.
44 changes: 38 additions & 6 deletions test/test_examples_tutorial_missings.jl
Expand Up @@ -9,15 +9,47 @@ using Test
@test eltype(eduction(xf_sum_columns(Float64[]), Any[])) <: Vector
end

function slow_test(f, title, limit)
@info "Running $title. Limit: $limit min."

code = """
sleep(60)
println("1 minute passed...")
flush(stdout)
for i in 2:$limit
sleep(60)
println("\$i minutes passed...")
flush(stdout)
end
"""
# TODO: maybe terminate the parent process

cmd = `$(Base.julia_cmd()) --startup-file=no -e $code`
proc = run(pipeline(cmd, stdout=stdout), wait=false)

try
@time f()
finally
ch = Channel(ch -> wait(proc); csize=1)
for _ in 1:10
isready(ch) && break
kill(proc)
sleep(0.1)
end
end
end

@testset "slow compilation" begin
# Excluding `missing` from the input vector seems to slows down
# compilation a lot.
@info "Running slow compilation test with xf_fullextrema. ETA ~ 3 min."
@time @test mapfoldl(xf_fullextrema(), right, [1.0, 3.0, -1.0, 2.0]) ==
((3, -1.0), (2, 3.0))
@info "Running slow compilation test with xf_argextrema. ETA ~ 5 min."
@time @test mapfoldl(xf_argextrema(), right, [1.0, 3.0, -1.0, 2.0]) ==
(3, 2)
slow_test("slow compilation test with xf_fullextrema", 20) do
@test mapfoldl(xf_fullextrema(), right, [1.0, 3.0, -1.0, 2.0]) ==
((3, -1.0), (2, 3.0))
end
slow_test("slow compilation test with xf_argextrema", 20) do
@test mapfoldl(xf_argextrema(), right, [1.0, 3.0, -1.0, 2.0]) ==
(3, 2)
end
end

end # module

0 comments on commit ccabacc

Please sign in to comment.