Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rr-related improvements #243

Merged
merged 3 commits into from
Jan 4, 2024
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
4 changes: 4 additions & 0 deletions scripts/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ pkg = eval(Meta.parse(ARGS[2]))
Pkg.activate("pkgeval"; shared=true)

# precompile PkgEval run-time dependencies (notably BugReporting.jl)
println("Precompiling PkgEval dependencies...")
Pkg.precompile()
println()

# try to use TestEnv to precompile the package test dependencies
try
Expand All @@ -17,4 +19,6 @@ catch err
@error "Failed to use TestEnv.jl; test dependencies will not be precompiled" exception=(err, catch_backtrace())
Pkg.activate()
end

println("Precompiling $(pkg.name) dependencies...")
Pkg.precompile()
16 changes: 14 additions & 2 deletions scripts/report_bug.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,25 @@ t0 = cpu_time()
try
# use a clean environment, or BugReporting's deps could
# affect/be affected by the tested package's dependencies.
Pkg.activate(; temp=true)
Pkg.add(name="BugReporting", uuid="bcf9a6e7-4020-453c-b88e-690564246bb8")
io = IOBuffer()
Pkg.DEFAULT_IO[] = io
try
Pkg.activate(; temp=true)
Pkg.add(name="BugReporting", uuid="bcf9a6e7-4020-453c-b88e-690564246bb8")
catch
# something went wrong installing BugReporting.jl
println(String(take!(io)))
rethrow()
finally
Pkg.DEFAULT_IO[] = nothing
end
using BugReporting

println("Finalizing trace...")
trace_dir = BugReporting.default_rr_trace_dir()
trace = BugReporting.find_latest_trace(trace_dir)
BugReporting.compress_trace(trace, "/output/$(pkg.name).tar.zst")

println("\nBugReporting completed after $(elapsed(t0))")
catch err
println("\nBugReporting failed after $(elapsed(t0))")
Expand Down
15 changes: 14 additions & 1 deletion scripts/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ if config.rr == RREnabled
println(io, "using BugReporting")
println(io, "println(\"Switching execution to under rr\")")
println(io, "BugReporting.make_interactive_report(\"rr-local\", ARGS)")
println(io, "exit(0)")
end
end

Expand Down Expand Up @@ -62,7 +63,19 @@ else
end
end

Pkg.add(deps)
io = IOBuffer()
Pkg.DEFAULT_IO[] = io
try
println("Installing PkgEval dependencies...")
Pkg.add(deps)
println()
catch
# something went wrong installing PkgEval's dependencies
println(String(take!(io)))
rethrow()
finally
Pkg.DEFAULT_IO[] = nothing
end

Pkg.activate()

Expand Down
10 changes: 10 additions & 0 deletions src/evaluate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,16 @@ function evaluate(configs::Vector{Configuration}, packages::Vector{Package}=Pack
# if the rr test crashed in the same way, use that evaluation
if rr_results.status === status && rr_results.reason === reason
(; log, status, reason, version, duration, input_output) = rr_results
else
log *= "\n\n" * '#'^80 * "\n# Bug reporting\n#\n\n"
log *= """The package crashed during testing (reason=$reason), but PkgEval was unable to
reproduce the crash under rr (status=$(rr_results.status), reason=$(rr_results.reason)).

For debugging, here is the tail end of the rr log:"""
log *= "\n\n"
for line in last(eachline(IOBuffer(rr_results.log)), 100)
log *= "> $line\n"
end
end
end
end
Expand Down