Skip to content

Commit 247d4c4

Browse files
committed
(hw-results/tabular) nicer macros, use longtable
1 parent 4112b0c commit 247d4c4

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

hw-results/tabular.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,14 @@ def filter_devices(grp_list, devices: "Mapping[Device, List[LogFileResult]]", in
455455

456456
return tests
457457

458+
def macro_test_name(test):
459+
sanitized_name = (
460+
test.test_name
461+
.replace("_", "\\_")
462+
.replace("&", "\\&")
463+
)
464+
return f"\\tableTestName{{{test.test_name}}}{{{sanitized_name}}}"
465+
458466
def macro_result_name(device, test):
459467
return f"\\csname {device.name}-{test.test_name} result\\endcsname"
460468

@@ -646,7 +654,7 @@ def _write_combo_tablular_with_distribution(f, devices, tests, rows):
646654
tab_shape += "l "
647655
tab_shape += device_cols_ls
648656
tab_shape += " l"
649-
f.write("\\begin{tabular}{%s}\n" % tab_shape)
657+
f.write("\\begin{longtable}{%s}\n" % tab_shape)
650658

651659
# first line
652660
#  Type & Name & multicol{3}{rpi4} & multicol{3}{qemu} & etc
@@ -674,7 +682,7 @@ def _write_combo_tablular_with_distribution(f, devices, tests, rows):
674682
continue
675683
f.write(f"{c!s:>{maxlen}} & ")
676684
f.write("\\\\ \\hline \n")
677-
f.write("\\end{tabular}\n")
685+
f.write("\\end{longtable}\n")
678686

679687
def _write_combo_tablular_simple(f, devices, tests, rows):
680688
all_groups = set(g for ftest in tests.values() for g in ftest.groups if g != "all")
@@ -696,7 +704,7 @@ def _write_combo_tablular_simple(f, devices, tests, rows):
696704
tab_shape += device_cols_ls
697705
tab_shape += " l"
698706

699-
f.write("\\begin{tabular}{%s}\n" % tab_shape)
707+
f.write("\\begin{longtable}{%s}\n" % tab_shape)
700708

701709
# first line
702710
#  Type & Name & multicol{3}{rpi4} & multicol{3}{qemu} & etc
@@ -716,7 +724,7 @@ def _write_combo_tablular_simple(f, devices, tests, rows):
716724
continue
717725
f.write(f"{c!s} & ")
718726
f.write("\\\\ \\hline \n")
719-
f.write("\\end{tabular}\n")
727+
f.write("\\end{longtable}\n")
720728

721729

722730
# def write_results_macros(f, devices, tests):
@@ -747,7 +755,10 @@ def write_combo_table(f, devices: "Mapping[Device, List[LogFileResult]]", tests,
747755
group = groups[-1]
748756
# use verb to escape test and group names with symbols
749757
row.append(f"\\verb|{group}|")
750-
row.append(f"\\verb|{test_name}|")
758+
if args.macros:
759+
row.append(macro_test_name(ftest))
760+
else:
761+
row.append(f"\\verb|{test_name}|")
751762

752763
for d in devices:
753764
flog = tests[test_name].results[d]
@@ -861,6 +872,7 @@ def main(args):
861872
with open(args.standalone_file, "w") as f:
862873
f.write("\\documentclass{standalone}\n")
863874
f.write("\\begin{document}\n")
875+
f.write("\\usepackage{longtable}\n")
864876

865877
if args.macros:
866878
write_results_macros(f, devices, filtered_tests)

0 commit comments

Comments
 (0)