Verified Commit 1cb1b259 authored by Sebastian Endres's avatar Sebastian Endres
Browse files

Use 2 lines for plot error files, hide plot error files, ...

parent 65113798
......@@ -183,7 +183,7 @@ class PlotAllCli:
for mode in modes:
output_file = test_case_dir / f"time_{mode.value}_plot.{self.format}"
err_output_file = test_case_dir / f"time_{mode.value}_plot_error.txt"
err_output_file = test_case_dir / f".time_{mode.value}_plot_error.txt"
if not self.force:
if output_file.is_file():
......@@ -203,6 +203,15 @@ class PlotAllCli:
with err_output_file.open("r") as file:
err_msg = file.read().strip()
try:
broken_pcap, err_msg = err_msg.splitlines()
except ValueError:
cprint(
f"Error message {err_output_file} has invalid format.",
file=sys.stderr,
)
broken_pcap = None
cprint(
(
"⨯ Trace could not be plotted in previous run. "
......@@ -211,6 +220,8 @@ class PlotAllCli:
file=sys.stderr,
color="red",
)
if broken_pcap:
cprint(broken_pcap, file=sys.stderr, color="red")
cprint(err_msg, file=sys.stderr, color="red")
cprint(
"Skipping. Use --force to overwrite.",
......@@ -258,7 +269,7 @@ class PlotAllCli:
with err_output_file.open("w") as file:
print(
f"{err.trace.input_file.relative_to(self._current_log_dir)}:",
f"{err.trace.input_file.relative_to(self._current_log_dir)}:\n",
err.msg,
file=file,
)
......
......@@ -340,7 +340,7 @@ class Trace:
):
clear_line(file=sys.stderr)
cprint(
f"⨯ Skipping a packet without UDP or IP?!? ({packet.frame_info.protocols})",
f"⨯ Skipping packet #{packet.number} without UDP or IP?!? ({packet.frame_info.protocols})",
color="red",
file=sys.stderr,
)
......@@ -365,6 +365,30 @@ class Trace:
self._cap.close()
self._packets = packets
# def get_prop_of_any_quic_packet(self, packet: "Packet", prop: str) -> Any:
# empty = object()
# value: Any = empty
#
# for layer in packet.get_multiple_layers("quic"):
# if hasattr(layer, prop):
# new_value = getattr(layer, prop)
#
# if value is not empty and value != new_value:
# raise ValueError(
# f"Single QUIC packets of packet #{packet.number} has different values "
# f"for property {prop}: {value} != {new_value}"
# )
# value = new_value
#
# if value is not empty:
# return value
# else:
# breakpoint()
# raise ParsingError(
# trace=self,
# msg=f"No QUIC packet in packet #{packet.number} has a value for property {prop}",
# )
@staticmethod
def _packet_fingerprint(packet: "Packet"):
"""Generate a fingerprint for packets."""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment