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
13 changes: 12 additions & 1 deletion common/log_parser/bbr/sct/logs_to_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,8 @@ def main(input_file, output_file):
reason_val = item.get("reason", "")

if ep_guid and sub_guid:
subtest_dict[(ep_guid.upper(), sub_guid.upper())] = {
desc = item.get("sub_Test_Description", "").strip().upper()
subtest_dict[(ep_guid.upper(), sub_guid.upper(), desc)] = {
"result": result_val,
"reason": reason_val
}
Expand All @@ -505,6 +506,16 @@ def main(input_file, output_file):
match_record = subtest_dict[(ep_guid_current, st_guid)]
subtest["sub_test_result"] = normalize_result(match_record["result"])
subtest["sub_test_result_reason"] = match_record["reason"]
desc_key = subtest["sub_Test_Description"].strip().upper()
lookup_key = (ep_guid_current, st_guid, desc_key)

if lookup_key in subtest_dict:
match_record = subtest_dict[lookup_key]
result_val = match_record.get("result", "").strip()
reason_val = match_record.get("reason", "").strip()
if result_val:
subtest["sub_test_result"] = normalize_result(result_val)
subtest["reason"] = reason_val

# Reorder final dictionary so "test_result" & "reason" appear after "Returned Status Code"
for i, test_obj in enumerate(results):
Expand Down
22 changes: 16 additions & 6 deletions common/log_parser/bbr/sct/logs_to_json_edk2.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,10 @@ def parse_edk2_log(input_file):
# Check if this row is a header row by looking for our target column names.
lower_cols = [col.strip().lower() for col in cols]
if not header_found and any(t in lower_cols for t in targets):
col_index_map = {}
for idx, col in enumerate(lower_cols):
if col in targets:
col_index_map[col] = idx
# Capture *all* column names, not just targets
col_index_map = {col: idx for idx, col in enumerate(lower_cols)}
header_found = True
continue # Skip processing the header row
continue

# If header is found, skip separator rows (rows that contain only dashes)
if header_found:
Expand All @@ -89,11 +87,23 @@ def parse_edk2_log(input_file):

# Build a record based on the header column positions.
record = { output_key: "" for output_key in targets.values() }
# Extract known columns
for key, output_key in targets.items():
idx = col_index_map.get(key)
if idx is not None and idx < len(cols):
record[output_key] = cols[idx].strip()
# Append the record if at least one target field is non-empty.

# Capture sub_Test_Description correctly

# If there's a 'name' column (typical for grouped tables like RuntimeServicesTest, BootServicesTest, etc.)
# then use that column as description.
# Otherwise (like GenericTest), fall back to the first column.
name_idx = col_index_map.get("name")

if name_idx is not None and name_idx < len(cols):
# Extract from 'name' column
record["sub_Test_Description"] = cols[name_idx].strip()
# Append record if any target field is non-empty
if any(record.values()):
results.append(record)
else:
Expand Down