Skip to content

Commit 7b7ad29

Browse files
tkelmanmfasi
authored andcommitted
Add a test for type and line number info in backtraces
so that JuliaLang#10595 does not regress, and JuliaLang#17251 is tracked
1 parent 43098c8 commit 7b7ad29

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

test/cmdlineargs.jl

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# This file is a part of Julia. License is MIT: http://julialang.org/license
22

3+
catcmd = `cat`
4+
if is_windows()
5+
try # use busybox-w32 on windows
6+
success(`busybox`)
7+
catcmd = `busybox cat`
8+
end
9+
end
10+
311
let exename = `$(Base.julia_cmd()) --precompiled=yes`
412
# --version
513
let v = split(readstring(`$exename -v`), "julia version ")[end]
@@ -246,13 +254,6 @@ let exename = `$(Base.julia_cmd()) --precompiled=yes`
246254
@test readchomp(`$exename -e 'println(ARGS);' ''`) == "String[\"\"]"
247255

248256
# issue #12679
249-
catcmd = `cat`
250-
if is_windows()
251-
try # use busybox-w32 on windows
252-
success(`busybox`)
253-
catcmd = `busybox cat`
254-
end
255-
end
256257
@test readchomp(pipeline(ignorestatus(`$exename --startup-file=no --compile=yes -ioo`),stderr=catcmd)) == "ERROR: unknown option `-o`"
257258
@test readchomp(pipeline(ignorestatus(`$exename --startup-file=no -p`),stderr=catcmd)) == "ERROR: option `-p/--procs` is missing an argument"
258259
@test readchomp(pipeline(ignorestatus(`$exename --startup-file=no --inline`),stderr=catcmd)) == "ERROR: option `--inline` is missing an argument"
@@ -287,3 +288,19 @@ let exename = `$(Base.julia_cmd())`
287288
@test readchomp(`$exename --precompiled=yes -E "Bool(Base.JLOptions().use_precompiled)"`) == "true"
288289
@test readchomp(`$exename --precompiled=no -E "Bool(Base.JLOptions().use_precompiled)"`) == "false"
289290
end
291+
292+
# backtrace contains type and line number info (esp. on windows #17179)
293+
for precomp in ("yes", "no")
294+
bt = readstring(pipeline(ignorestatus(`$(Base.julia_cmd()) --precompiled=$precomp
295+
-E 'include("____nonexistent_file")'`), stderr=catcmd))
296+
@test contains(bt, "in include_from_node1")
297+
if is_windows() && Sys.WORD_SIZE == 32 && precomp == "yes"
298+
# fixme, issue #17251
299+
@test_broken contains(bt, "in include_from_node1(::String) at $(joinpath(".","loading.jl"))")
300+
else
301+
@test contains(bt, "in include_from_node1(::String) at $(joinpath(".","loading.jl"))")
302+
end
303+
lno = match(r"at \.[/\\]loading.jl:(\d+)", bt)
304+
@test length(lno.captures) == 1
305+
@test parse(Int, lno.captures[1]) > 0
306+
end

test/file.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ test_monitor_wait_poll()
263263
test_watch_file_timeout(0.1)
264264
test_watch_file_change(6)
265265

266-
@test_throws Base.UVError watch_file("nonexistantfile", 10)
267-
@test_throws Base.UVError poll_file("nonexistantfile", 2, 10)
266+
@test_throws Base.UVError watch_file("____nonexistent_file", 10)
267+
@test_throws Base.UVError poll_file("____nonexistent_file", 2, 10)
268268

269269
##############
270270
# mark/reset #

0 commit comments

Comments
 (0)