Skip to content

Commit

Permalink
Add a test for type and line number info in backtraces
Browse files Browse the repository at this point in the history
so that JuliaLang#10595 does not regress, and JuliaLang#17251 is tracked
  • Loading branch information
tkelman authored and mfasi committed Sep 5, 2016
1 parent 43098c8 commit 7b7ad29
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
31 changes: 24 additions & 7 deletions test/cmdlineargs.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

catcmd = `cat`
if is_windows()
try # use busybox-w32 on windows
success(`busybox`)
catcmd = `busybox cat`
end
end

let exename = `$(Base.julia_cmd()) --precompiled=yes`
# --version
let v = split(readstring(`$exename -v`), "julia version ")[end]
Expand Down Expand Up @@ -246,13 +254,6 @@ let exename = `$(Base.julia_cmd()) --precompiled=yes`
@test readchomp(`$exename -e 'println(ARGS);' ''`) == "String[\"\"]"

# issue #12679
catcmd = `cat`
if is_windows()
try # use busybox-w32 on windows
success(`busybox`)
catcmd = `busybox cat`
end
end
@test readchomp(pipeline(ignorestatus(`$exename --startup-file=no --compile=yes -ioo`),stderr=catcmd)) == "ERROR: unknown option `-o`"
@test readchomp(pipeline(ignorestatus(`$exename --startup-file=no -p`),stderr=catcmd)) == "ERROR: option `-p/--procs` is missing an argument"
@test readchomp(pipeline(ignorestatus(`$exename --startup-file=no --inline`),stderr=catcmd)) == "ERROR: option `--inline` is missing an argument"
Expand Down Expand Up @@ -287,3 +288,19 @@ let exename = `$(Base.julia_cmd())`
@test readchomp(`$exename --precompiled=yes -E "Bool(Base.JLOptions().use_precompiled)"`) == "true"
@test readchomp(`$exename --precompiled=no -E "Bool(Base.JLOptions().use_precompiled)"`) == "false"
end

# backtrace contains type and line number info (esp. on windows #17179)
for precomp in ("yes", "no")
bt = readstring(pipeline(ignorestatus(`$(Base.julia_cmd()) --precompiled=$precomp
-E 'include("____nonexistent_file")'`), stderr=catcmd))
@test contains(bt, "in include_from_node1")
if is_windows() && Sys.WORD_SIZE == 32 && precomp == "yes"
# fixme, issue #17251
@test_broken contains(bt, "in include_from_node1(::String) at $(joinpath(".","loading.jl"))")
else
@test contains(bt, "in include_from_node1(::String) at $(joinpath(".","loading.jl"))")
end
lno = match(r"at \.[/\\]loading.jl:(\d+)", bt)
@test length(lno.captures) == 1
@test parse(Int, lno.captures[1]) > 0
end
4 changes: 2 additions & 2 deletions test/file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ test_monitor_wait_poll()
test_watch_file_timeout(0.1)
test_watch_file_change(6)

@test_throws Base.UVError watch_file("nonexistantfile", 10)
@test_throws Base.UVError poll_file("nonexistantfile", 2, 10)
@test_throws Base.UVError watch_file("____nonexistent_file", 10)
@test_throws Base.UVError poll_file("____nonexistent_file", 2, 10)

##############
# mark/reset #
Expand Down

0 comments on commit 7b7ad29

Please sign in to comment.