Skip to content

Commit 5b864a6

Browse files
authored
fix test suite on 1.8.5 , 1.9.4, 1.10.10, 1.11.5 (#1391)
* try 1.8 * checkpoint * update * revert * revert * revert * disable debug mode * restore original `readuntil_sift` * restore sleep
1 parent 81a30e6 commit 5b864a6

File tree

2 files changed

+31
-18
lines changed

2 files changed

+31
-18
lines changed

test/building.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ end
443443
# Test that having a LibraryProduct for AnyPlatform raises an error.
444444
# Note that the error is raised during audit, which is run in threads,
445445
# so we raise an extremely generic `TaskFailedException`.
446-
@test_throws TaskFailedException autobuild(
446+
exc = VERSION < v"1.9" ? TaskFailedException : CompositeException
447+
@test_throws exc autobuild(
447448
build_path,
448449
"libfoo",
449450
v"1.0.0",

test/wizard.jl

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import Pkg: PackageSpec
44

55
import BinaryBuilder.BinaryBuilderBase: available_gcc_builds, available_llvm_builds, getversion
66

7+
const debug = Ref(false)
8+
79
function with_wizard_output(f::Function, state, step_func::Function)
810
# Create fake terminal to communicate with BinaryBuilder over
911
pty = VT100.create_pty(false)
@@ -17,7 +19,7 @@ function with_wizard_output(f::Function, state, step_func::Function)
1719
z = String(readavailable(pty.master))
1820

1921
# Un-comment this to figure out what on earth is going wrong
20-
# print(z)
22+
debug[] && print(z)
2123
write(out_buff, z)
2224
end
2325
end
@@ -110,14 +112,37 @@ function readuntil_sift(io::IO, needle)
110112
end
111113

112114
function call_response(ins, outs, question, answer; newline=true)
113-
@assert readuntil_sift(outs, question) !== nothing
115+
buf = readuntil_sift(outs, question)
116+
@assert buf !== nothing
117+
debug[] && println(String(buf))
114118
# Because we occasionally are dealing with things that do strange
115119
# stdin tricks like reading raw stdin buffers, we sleep here for safety.
116120
sleep(0.1)
121+
if debug[]
122+
print(answer)
123+
newline && println()
124+
end
117125
print(ins, answer)
118-
if newline
119-
println(ins)
126+
newline && println(ins)
127+
end
128+
129+
function succcess_path_call_response(ins, outs)
130+
output = readuntil_sift(outs, "Build complete")
131+
if contains(String(output), "Warning:")
132+
close(ins)
133+
return false
134+
end
135+
call_response(ins, outs, "Would you like to edit this script now?", "N")
136+
# MultiSelectMenu (https://docs.julialang.org/en/v1/stdlib/REPL/#MultiSelectMenu)
137+
needle = if VERSION < v"1.9"
138+
"[press: d=done, a=all, n=none]"
139+
else
140+
"[press: Enter=toggle, a=all, n=none, d=done, q=abort]"
120141
end
142+
call_response(ins, outs, needle, "ad"; newline=false)
143+
call_response(ins, outs, "lib/libfoo.so", "libfoo")
144+
call_response(ins, outs, "bin/fooifier", "fooifier")
145+
return true
121146
end
122147

123148
@testset "Wizard - Obtain source" begin
@@ -321,19 +346,6 @@ function step3_test(state)
321346
end
322347

323348
@testset "Wizard - Building" begin
324-
function succcess_path_call_response(ins, outs)
325-
output = readuntil_sift(outs, "Build complete")
326-
if contains(String(output), "Warning:")
327-
close(ins)
328-
return false
329-
end
330-
call_response(ins, outs, "Would you like to edit this script now?", "N")
331-
call_response(ins, outs, "d=done, a=all", "ad"; newline=false)
332-
call_response(ins, outs, "lib/libfoo.so", "libfoo")
333-
call_response(ins, outs, "bin/fooifier", "fooifier")
334-
return true
335-
end
336-
337349
# Test step3 success path
338350
state = step3_state()
339351
with_wizard_output(state, Wizard.step34) do ins, outs

0 commit comments

Comments
 (0)