Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion test/building.jl
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ end
# Test that having a LibraryProduct for AnyPlatform raises an error.
# Note that the error is raised during audit, which is run in threads,
# so we raise an extremely generic `TaskFailedException`.
@test_throws TaskFailedException autobuild(
exc = VERSION < v"1.9" ? TaskFailedException : CompositeException
Comment thread
t-bltg marked this conversation as resolved.
@test_throws exc autobuild(
build_path,
"libfoo",
v"1.0.0",
Expand Down
46 changes: 29 additions & 17 deletions test/wizard.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import Pkg: PackageSpec

import BinaryBuilder.BinaryBuilderBase: available_gcc_builds, available_llvm_builds, getversion

const debug = Ref(false)

function with_wizard_output(f::Function, state, step_func::Function)
# Create fake terminal to communicate with BinaryBuilder over
pty = VT100.create_pty(false)
Expand All @@ -17,7 +19,7 @@ function with_wizard_output(f::Function, state, step_func::Function)
z = String(readavailable(pty.master))

# Un-comment this to figure out what on earth is going wrong
# print(z)
debug[] && print(z)
write(out_buff, z)
end
end
Expand Down Expand Up @@ -110,14 +112,37 @@ function readuntil_sift(io::IO, needle)
end

function call_response(ins, outs, question, answer; newline=true)
@assert readuntil_sift(outs, question) !== nothing
buf = readuntil_sift(outs, question)
@assert buf !== nothing
debug[] && println(String(buf))
# Because we occasionally are dealing with things that do strange
# stdin tricks like reading raw stdin buffers, we sleep here for safety.
sleep(0.1)
if debug[]
print(answer)
newline && println()
end
print(ins, answer)
if newline
println(ins)
newline && println(ins)
end

function succcess_path_call_response(ins, outs)
output = readuntil_sift(outs, "Build complete")
if contains(String(output), "Warning:")
close(ins)
return false
end
call_response(ins, outs, "Would you like to edit this script now?", "N")
# MultiSelectMenu (https://docs.julialang.org/en/v1/stdlib/REPL/#MultiSelectMenu)
needle = if VERSION < v"1.9"
Comment thread
t-bltg marked this conversation as resolved.
"[press: d=done, a=all, n=none]"
else
"[press: Enter=toggle, a=all, n=none, d=done, q=abort]"
end
call_response(ins, outs, needle, "ad"; newline=false)
call_response(ins, outs, "lib/libfoo.so", "libfoo")
call_response(ins, outs, "bin/fooifier", "fooifier")
return true
end

@testset "Wizard - Obtain source" begin
Expand Down Expand Up @@ -321,19 +346,6 @@ function step3_test(state)
end

@testset "Wizard - Building" begin
function succcess_path_call_response(ins, outs)
output = readuntil_sift(outs, "Build complete")
if contains(String(output), "Warning:")
close(ins)
return false
end
call_response(ins, outs, "Would you like to edit this script now?", "N")
call_response(ins, outs, "d=done, a=all", "ad"; newline=false)
call_response(ins, outs, "lib/libfoo.so", "libfoo")
call_response(ins, outs, "bin/fooifier", "fooifier")
return true
end

# Test step3 success path
state = step3_state()
with_wizard_output(state, Wizard.step34) do ins, outs
Expand Down
Loading