Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/FileFormats/NL/read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ function test_binary_parse_x()
return
end

function test_parse_d()
function test_binary_parse_d()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I really needed this. Found another case

model = NL._CacheModel()
model.is_binary = true
io = IOBuffer()
Expand Down
30 changes: 29 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,36 @@ MODULES_TO_TEST = get(
"General;Benchmarks;Bridges;Bridges/Constraint;Bridges/Objective;Bridges/Variable;FileFormats;Nonlinear;Test;Utilities",
)

"""
include_with_method_redefinition_check(jl_filename)

This function runs `include(jl_filename)` with an additional check that there
are no `WARNING: Method definition foo in module Foo overwritten` warnings.

It does this by piping `stderr` to a file, and then parsing the file.

One consequence is that `stderr` is not printed until the _end_ of this
function. Thus, some warnings may appear in the wrong place.

This function requires Julia to be started with `--warn-overwrite=true`.
"""
function include_with_method_redefinition_check(jl_filename)
stderr_filename = tempname()
open(stderr_filename, "w") do io
return redirect_stderr(() -> include(jl_filename), io)
end
contents = read(stderr_filename, String)
print(stderr, contents)
regex =
r"WARNING: Method definition (.+?) in module (.+?) at (.+?) overwritten at (.+?)\n"
if match(regex, contents) !== nothing
error("Found overwritten method")
end
return
end

for submodule in split(MODULES_TO_TEST, ";")
include("$(submodule)/runtests.jl")
include_with_method_redefinition_check("$(submodule)/runtests.jl")
GC.gc() # Force GC run here to reduce memory pressure
end

Expand Down
Loading