Skip to content

Commit

Permalink
Struggling with some very strange errors in help-test. Inluding some …
Browse files Browse the repository at this point in the history
…LLVM crashes and seg-faults.
  • Loading branch information
mauro3 committed Jun 19, 2014
1 parent 739ed0a commit 5e78e57
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 15 deletions.
13 changes: 7 additions & 6 deletions base/help.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Base.WeakObjectIdDict
# - switch off when not running interactively (but what about tests?)
# - make @doc work for methods
# - make @doc work for modules
# - make APROPOS_DICT = WeakObjectIdDict(), currently this make julia very unstable

typealias HelpDict Dict{Symbol,Any}
# keys
Expand All @@ -15,7 +16,7 @@ typealias HelpDict Dict{Symbol,Any}
# internal data
NOOBJ_DICT = Dict{String, HelpDict}() # To keep documentation for non-object entities, like keywords, ccall, &&, ||, ", ', etc.
# And also for macros as they cannot be used as dict-keys directly.
APROPOS_DICT = ObjectIdDict() # this is used in apropos search. Maps objects to their help text [:desc]
APROPOS_DICT = ObjectIdDict() # this is used in apropos search. Maps objects to their help text [:desc].
APROPOS_DICT[NOOBJ_DICT] = Dict{String, String}() # to hold the apropos for stuff in NOOBJ_DICT
INIT_OLD_HELP = true # flag

Expand Down Expand Up @@ -105,12 +106,12 @@ function init_help()
mod_ = mod_ # keep as string
end
if !hasdoc(obj) # do not overwrite existing doc
hd = HelpDict()
hd[:desc]= desc; hd[:mod]=mod_;
setdoc!(obj, hd)
hdnew = HelpDict()
hdnew[:desc]= desc; hdnew[:mod]=mod_;
setdoc!(obj, hdnew)
else # append to it
hd = getdoc(obj)
hd[:desc] *= "\n$(string(mod_)).$desc"
hdnew = getdoc(obj)
hdnew[:desc] *= "\n$(string(mod_)).$desc"
end
end
end
Expand Down
34 changes: 26 additions & 8 deletions test/help.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,40 @@ end
# @test_throws @doc st module MyMod end


# Old Help:
## test that old-help from helpdb.jl is correct.
## Old Help:
# Tests that old-help from helpdb.jl is correct. These tests are
# quite fragile/temperamental, I'm not sure why. Running in parallel
# may be one of the problems?

# initialise old-help
Base.Help.init_help()
helpdb = evalfile(Base.Help.helpdb_filename())

# For these the help is broken.
broken_help = {eval, MS_SYNC, CPU_CORES, "BoundingBox", "isinside", ENDIAN_BOM, Ptr{Void}}
# For these the help is broken, sometimes.
broken_help = {eval, MS_SYNC, CPU_CORES, "BoundingBox", "isinside", ENDIAN_BOM, C_NULL}
# sometimes_brocken = {im, Inf16, Inf32, Inf}
# append!(broken_help, sometimes_brocken)
# - eval does not work with help.jl machinery
# - MS_SYNC, CPU_CORES are both Int64
# - "BoundingBox", "isinside" don't exist anymore
# - ENDIAN_BOM

mod_,obj,desc = 1,2,3
for hd in helpdb
@show hd
mod_,obj,desc = hd
if obj=="im" || obj=="Inf16" || obj==="NaN16" || obj==="NaN" || obj==="NaN32" || obj=="ccall"
continue
# otherwise I get this error?!
# LLVM ERROR: Cannot select: 0x2f42fa0: i64 = bitcast 0x9425f40 [ORD=88214] [ID=9] dbg:operators.jl:9:1
# 0x9425f40: i8 = truncate 0x2f4d780 [ORD=88214] [ID=8]
# 0x2f4d780: i32,ch = CopyFromReg 0x15779e8, 0x9321120 [ORD=88214] [ID=7]
# 0x9321120: i32 = Register %vreg1 [ORD=88214] [ID=2]
# In function: julia_==;19624
end

os = obj
@show obj, typeof(obj), desc
str = ""
if obj[1]=='@' # a macro
obj = obj # keep as string
Expand All @@ -109,11 +127,11 @@ for hd in helpdb
end
end
end
@show obj, typeof(obj), desc
if !(obj in broken_help)
@show obj
@test hasdoc(obj)
@test contains(getdoc(obj)[:desc],desc)
# @show obj, desc
@test hasdoc(obj)
@test contains(getdoc(obj)[:desc],desc)
end
end


2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ end

n = 1
if net_on
n = min(8, CPU_CORES, length(tests))
n = 1 #min(8, CPU_CORES, length(tests))
n > 1 && addprocs(n)
blas_set_num_threads(1)
else
Expand Down

0 comments on commit 5e78e57

Please sign in to comment.