Skip to content

Commit 81329da

Browse files
vtjnashKristofferC
authored andcommitted
REPL,test: read output before adding more input
Might help aarch64bot test deadlock on CI Refs #38996 (cherry picked from commit 9eccd33)
1 parent edb5a5d commit 81329da

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

stdlib/REPL/test/repl.jl

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ fake_repl(options = REPL.Options(confirm_exit=false,hascolor=true)) do stdin_wri
120120
end
121121

122122
# Latex completions
123+
readuntil(stdout_read, "julia> ", keep=true)
123124
write(stdin_write, "\x32\\alpha\t")
124125
readuntil(stdout_read, "α")
125126
# Bracketed paste in search mode
@@ -1038,13 +1039,16 @@ fake_repl() do stdin_write, stdout_read, repl
10381039
write(stdin_write, "TestShowTypeREPL.TypeA\n")
10391040
@test endswith(readline(stdout_read), "\r\e[7CTestShowTypeREPL.TypeA\r\e[29C")
10401041
readline(stdout_read)
1041-
readline(stdout_read)
1042+
@test readline(stdout_read) == ""
10421043
@eval Main using .TestShowTypeREPL
1044+
readuntil(stdout_read, "julia> ", keep=true)
10431045
write(stdin_write, "TypeA\n")
10441046
@test endswith(readline(stdout_read), "\r\e[7CTypeA\r\e[12C")
10451047
readline(stdout_read)
1048+
@test readline(stdout_read) == ""
10461049

10471050
# Close REPL ^D
1051+
readuntil(stdout_read, "julia> ", keep=true)
10481052
write(stdin_write, '\x04')
10491053
Base.wait(repltask)
10501054
end
@@ -1163,10 +1167,13 @@ fake_repl() do stdin_write, stdout_read, repl
11631167
write(stdin_write, "Expr(:call, GlobalRef(Base.Math, :float), Core.SlotNumber(1))\n")
11641168
readline(stdout_read)
11651169
@test readline(stdout_read) == "\e[0m:(Base.Math.float(_1))"
1170+
@test readline(stdout_read) == ""
1171+
readuntil(stdout_read, "julia> ", keep=true)
11661172
write(stdin_write, "ans\n")
11671173
readline(stdout_read)
1168-
readline(stdout_read)
11691174
@test readline(stdout_read) == "\e[0m:(Base.Math.float(_1))"
1175+
@test readline(stdout_read) == ""
1176+
readuntil(stdout_read, "julia> ", keep=true)
11701177
write(stdin_write, '\x04')
11711178
Base.wait(repltask)
11721179
end
@@ -1179,10 +1186,15 @@ fake_repl() do stdin_write, stdout_read, repl
11791186
write(stdin_write, "struct Errs end\n")
11801187
readline(stdout_read)
11811188
readline(stdout_read)
1189+
readuntil(stdout_read, "julia> ", keep=true)
11821190
write(stdin_write, "Base.show(io::IO, ::Errs) = throw(Errs())\n")
11831191
readline(stdout_read)
11841192
readline(stdout_read)
1193+
readuntil(stdout_read, "julia> ", keep=true)
11851194
write(stdin_write, "Errs()\n")
1195+
readline(stdout_read)
1196+
readline(stdout_read)
1197+
readuntil(stdout_read, "julia> ", keep=true)
11861198
write(stdin_write, '\x04')
11871199
wait(repltask)
11881200
@test istaskdone(repltask)
@@ -1195,7 +1207,8 @@ fake_repl() do stdin_write, stdout_read, repl
11951207
end
11961208
write(stdin_write, "?;\n")
11971209
readline(stdout_read)
1198-
@test endswith(readline(stdout_read),";")
1210+
@test endswith(readline(stdout_read), "search: ;")
1211+
readuntil(stdout_read, "julia> ", keep=true)
11991212
write(stdin_write, '\x04')
12001213
Base.wait(repltask)
12011214
end
@@ -1208,6 +1221,7 @@ fake_repl() do stdin_write, stdout_read, repl
12081221
write(stdin_write, "global x\n")
12091222
readline(stdout_read)
12101223
@test !occursin("ERROR", readline(stdout_read))
1224+
readuntil(stdout_read, "julia> ", keep=true)
12111225
write(stdin_write, '\x04')
12121226
Base.wait(repltask)
12131227
end

0 commit comments

Comments
 (0)