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
14 changes: 10 additions & 4 deletions src/report.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import Printf: @sprintf

function _status_cell(ok::Bool, t::Float64, logFile::Union{String,Nothing})
link = isnothing(logFile) ? "" : """ <a href="$(logFile)">(log)</a>"""
time = t > 0 ? @sprintf("%.2f", t) * " s" : ""
if ok
return """<td class="ok">&#10003; $(@sprintf "%.2f" t) s$link</td>"""
return """<td class="ok">&#10003;$(time)$(link)</td>"""
else
return """<td class="fail">&#10007;$link</td>"""
return """<td class="fail">&#10007;$(time)$(link)</td>"""
end
end

Expand All @@ -18,12 +19,17 @@ function _cmp_cell(r::ModelResult, results_root::String)
end
n, p = r.cmp_total, r.cmp_pass
if p == n
return """<td class="ok">&#10003; $p/$n</td>"""
# No diff CSV when all signals pass — link the sim CSV instead
short = split(r.name, ".")[end]
sim_csv = joinpath("files", r.name, "$(short)_sim.csv")
csv_link = isfile(joinpath(results_root, sim_csv)) ? """ <a href="$sim_csv">(CSV)</a>""" : ""
return """<td class="ok">&#10003; $p/$n$(csv_link)</td>"""
else
# Link to the interactive diff HTML (next to the CSV, same name, .html extension)
diff_html = replace(r.cmp_csv, r"\.csv$" => ".html")
rel = relpath(isfile(diff_html) ? diff_html : r.cmp_csv, results_root)
return """<td class="fail"><a href="$rel">$p/$n</a></td>"""
csv_link = isempty(r.cmp_csv) ? "" : """ <a href="$(relpath(r.cmp_csv, results_root))">(CSV)</a>"""
return """<td class="fail"><a href="$rel">$p/$n</a>$(csv_link)</td>"""
end
end

Expand Down
20 changes: 13 additions & 7 deletions src/summary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ function write_summary(
print(io,
" {\"name\":\"$(_esc_json(r.name))\"," *
"\"export\":$(r.export_success)," *
"\"export_time\":$(@sprintf "%.3f" r.export_time)," *
"\"parse\":$(r.parse_success)," *
"\"parse_time\":$(@sprintf "%.3f" r.parse_time)," *
"\"sim\":$(r.sim_success)," *
"\"sim_time\":$(@sprintf "%.3f" r.sim_time)," *
"\"cmp_total\":$(r.cmp_total)," *
"\"cmp_pass\":$(r.cmp_pass)}$sep\n")
end
Expand Down Expand Up @@ -112,15 +115,18 @@ function load_summary(results_root::String)::Union{RunSummary,Nothing}

models = Dict{String,Any}[]
for m in eachmatch(
r"\{\"name\":\"([^\"]*)\",\"export\":(true|false),\"parse\":(true|false),\"sim\":(true|false),\"cmp_total\":(\d+),\"cmp_pass\":(\d+)\}",
r"\{\"name\":\"([^\"]*)\",\"export\":(true|false),\"export_time\":([\d.]+),\"parse\":(true|false),\"parse_time\":([\d.]+),\"sim\":(true|false),\"sim_time\":([\d.]+),\"cmp_total\":(\d+),\"cmp_pass\":(\d+)\}",
txt)
push!(models, Dict{String,Any}(
"name" => string(m.captures[1]),
"export" => m.captures[2] == "true",
"parse" => m.captures[3] == "true",
"sim" => m.captures[4] == "true",
"cmp_total" => parse(Int, m.captures[5]),
"cmp_pass" => parse(Int, m.captures[6]),
"name" => string(m.captures[1]),
"export" => m.captures[2] == "true",
"export_time" => parse(Float64, m.captures[3]),
"parse" => m.captures[4] == "true",
"parse_time" => parse(Float64, m.captures[5]),
"sim" => m.captures[6] == "true",
"sim_time" => parse(Float64, m.captures[7]),
"cmp_total" => parse(Int, m.captures[8]),
"cmp_pass" => parse(Int, m.captures[9]),
))
end
return RunSummary(
Expand Down