update(SlaveLogParser): modify Recov parse and add to full parser

- including test cases for both section wise and Integrated
This commit is contained in:
Wataru Otsubo 2024-11-01 16:23:46 +09:00
parent 5ca921bcfc
commit f1db431f7e
2 changed files with 26 additions and 6 deletions

View file

@ -327,8 +327,11 @@ function parse_asdtp_section!(lines::Base.Iterators.Stateful)::AsdtpResult
)
end
# ==================================
# Recov
"""
parse_qspip_section(lines::Base.Iterators.Stateful)
parse_recov_section!(lines::Base.Iterators.Stateful)
Parse Recov section of given stateful iterator of log.
@ -336,18 +339,18 @@ Parse Recov section of given stateful iterator of log.
- `lines`: Stateful iterator of slave log file lines
# Return
- `nothing`: if failed to parse
- `missing`: if failed to parse
- `true`: if successed
- `false`
"""
function parse_recov_section!(lines::Base.Iterators.Stateful)
function parse_recov_section!(lines::Base.Iterators.Stateful)::Union{Bool, Missing}
line = popfirst!(lines)
if startswith("====")(line)
line = popfirst!(lines)
end
m = match(r"Test Recov Result = (\d+)", line)
if isnothing(m)
return nothing
return missing
else
return m[1] == "1"
end
@ -363,6 +366,7 @@ function parse_slavelog_file(filename::AbstractString)
asdtp_results = AsdtpResult[]
power_results = PowerResult[]
recov_results = Union{Bool, Missing}[]
mode::SlaveLogSection = MODE_NONE
# main loop
@ -384,12 +388,13 @@ function parse_slavelog_file(filename::AbstractString)
push!(asdtp_results, result)
mode = MODE_NONE
elseif mode == MODE_RECOV
parse_recov_section!(lines_iter)
result = parse_recov_section!(lines_iter)
push!(recov_results, result)
mode = MODE_NONE
end
end
return (asdtp = asdtp_results, power = power_results)
return (asdtp = asdtp_results, power = power_results, recov = recov_results)
end
function eff99_count_map(asdtp_results)

View file

@ -99,6 +99,20 @@ true || include("../src/PSBoardDataBase.jl")
@test result.result_n3va == -3.01
end
@testset "Recov" begin
lines = Iterators.Stateful(
Iterators.drop(eachline("./input/slavelogs/main/430_100.txt"), 1912)
)
@test PSBoardDataBase.SlaveLogParser.parse_recov_section!(lines)
lines = Iterators.Stateful(
Iterators.drop(eachline("./input/slavelogs/main/525_244.txt"), 1912)
)
@test PSBoardDataBase.SlaveLogParser.parse_recov_section!(lines)
# Maybe add more cases
end
@testset "Integrated" begin
result = PSBoardDataBase.SlaveLogParser.parse_slavelog_file(
"./input/slavelogs/main/430_100.txt",
@ -107,6 +121,7 @@ true || include("../src/PSBoardDataBase.jl")
@test result.asdtp |> length |> ==(1)
@test result.power |> length |> ==(1)
@test result.power[1].result_3v3d == 3.43
@test result.recov[1]
@test PSBoardDataBase.SlaveLogParser.parse_slavelog_file(
"./input/slavelogs/main/525_244.txt",