From: "Juraj Linkeš" <juraj.linkes@pantheon.tech>
To: Luca Vizzarro <luca.vizzarro@arm.com>, dev@dpdk.org
Cc: Jeremy Spewock <jspewock@iol.unh.edu>,
Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,
Paul Szczepanek <paul.szczepanek@arm.com>,
Alex Chapman <alex.chapman@arm.com>
Subject: Re: [PATCH v2 1/5] dts: add ability to send/receive multiple packets
Date: Fri, 23 Aug 2024 12:17:14 +0200 [thread overview]
Message-ID: <0053d46d-331d-4d2e-9d97-0cb0a668d240@pantheon.tech> (raw)
In-Reply-To: <20240806124642.2580828-2-luca.vizzarro@arm.com>
This is a nice improvement. The comment below won't necessarily results
in any changes, so:
Reviewed-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py
> @@ -303,6 +329,40 @@ def verify_packets(self, expected_packet: Packet, received_packets: list[Packet]
> )
> self._fail_test_case_verify("An expected packet not found among received packets.")
>
> + def match_all_packets(
> + self, expected_packets: list[Packet], received_packets: list[Packet]
> + ) -> None:
> + """Matches all the expected packets against the received ones.
> +
> + Matching is performed by counting down the occurrences in a dictionary which keys are the
> + raw packet bytes. No deep packet comparison is performed. All the unexpected packets (noise)
> + are automatically ignored.
> +
> + Args:
> + expected_packets: The packets we are expecting to receive.
> + received_packets: All the packets that were received.
> +
> + Raises:
> + TestCaseVerifyError: if and not all the `expected_packets` were found in
> + `received_packets`.
> + """
> + expected_packets_counters = Counter(map(raw, expected_packets))
> + received_packets_counters = Counter(map(raw, received_packets))
> + # The number of expected packets is subtracted by the number of received packets, ignoring
> + # any unexpected packets and capping at zero.
> + missing_packets_counters = expected_packets_counters - received_packets_counters
> + missing_packets_count = missing_packets_counters.total()
> + self._logger.debug(
> + f"match_all_packets: expected {len(expected_packets)}, "
> + f"received {len(received_packets)}, missing {missing_packets_count}"
> + )
> +
> + if missing_packets_count != 0:
> + self._fail_test_case_verify(
> + f"Not all packets were received, expected {len(expected_packets)} "
> + f"but {missing_packets_count} were missing."
> + )
> +
Is it worthwhile to log the missing packets? It's not necessary, as the
received packets are logged elsewhere, but it would be convenient. On
the other hand, it could just unnecessarily bloat logs.
next prev parent reply other threads:[~2024-08-23 10:17 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-06 12:14 [PATCH 0/4] dts: add pktgen and testpmd changes Luca Vizzarro
2024-08-06 12:14 ` [PATCH 1/5] dts: add ability to send/receive multiple packets Luca Vizzarro
2024-08-06 12:14 ` [PATCH 2/5] dts: add random generation seed setting Luca Vizzarro
2024-08-06 12:14 ` [PATCH 3/5] dts: add random packet generator Luca Vizzarro
2024-08-06 12:14 ` [PATCH 4/5] dts: add ability to start/stop ports Luca Vizzarro
2024-08-06 12:14 ` [PATCH 4/5] dts: add ability to start/stop testpmd ports Luca Vizzarro
2024-08-06 12:14 ` [PATCH 5/5] dts: add testpmd set ports queues Luca Vizzarro
2024-08-06 12:46 ` [PATCH v2 0/5] dts: add pktgen and testpmd changes Luca Vizzarro
2024-08-06 12:46 ` [PATCH v2 1/5] dts: add ability to send/receive multiple packets Luca Vizzarro
2024-08-09 15:10 ` Jeremy Spewock
2024-09-06 16:23 ` Luca Vizzarro
2024-09-09 14:12 ` Jeremy Spewock
2024-08-23 10:17 ` Juraj Linkeš [this message]
2024-09-06 16:30 ` Luca Vizzarro
2024-08-06 12:46 ` [PATCH v2 2/5] dts: add random generation seed setting Luca Vizzarro
2024-08-09 15:10 ` Jeremy Spewock
2024-08-23 10:30 ` Juraj Linkeš
2024-08-06 12:46 ` [PATCH v2 3/5] dts: add random packet generator Luca Vizzarro
2024-08-09 15:11 ` Jeremy Spewock
2024-08-23 11:58 ` Juraj Linkeš
2024-09-06 16:31 ` Luca Vizzarro
2024-08-06 12:46 ` [PATCH v2 4/5] dts: add ability to start/stop testpmd ports Luca Vizzarro
2024-08-09 15:13 ` Jeremy Spewock
2024-09-06 16:41 ` Luca Vizzarro
2024-08-23 12:16 ` Juraj Linkeš
2024-09-06 16:46 ` Luca Vizzarro
2024-09-09 7:32 ` Juraj Linkeš
2024-09-09 14:20 ` Jeremy Spewock
2024-09-09 15:16 ` Juraj Linkeš
2024-08-06 12:46 ` [PATCH v2 5/5] dts: add testpmd set ports queues Luca Vizzarro
2024-08-09 15:14 ` Jeremy Spewock
2024-08-20 16:04 ` Jeremy Spewock
2024-09-06 16:51 ` Luca Vizzarro
2024-08-23 12:22 ` Juraj Linkeš
2024-09-06 16:53 ` Luca Vizzarro
2024-09-09 11:01 ` [PATCH v3 0/5] dts: add pktgen and testpmd changes Luca Vizzarro
2024-09-09 11:01 ` [PATCH v3 1/5] dts: add ability to send/receive multiple packets Luca Vizzarro
2024-09-09 17:12 ` Patrick Robb
2024-09-09 11:01 ` [PATCH v3 2/5] dts: add random generation seed setting Luca Vizzarro
2024-09-09 11:01 ` [PATCH v3 3/5] dts: add random packet generator Luca Vizzarro
2024-09-09 11:01 ` [PATCH v3 4/5] dts: add ability to start/stop testpmd ports Luca Vizzarro
2024-09-09 11:54 ` Juraj Linkeš
2024-09-09 14:20 ` Jeremy Spewock
2024-09-09 11:01 ` [PATCH v3 5/5] dts: add testpmd set ports queues Luca Vizzarro
2024-09-09 12:01 ` Juraj Linkeš
2024-09-09 14:20 ` Jeremy Spewock
2024-09-09 15:50 ` [PATCH 0/4] dts: add pktgen and testpmd changes Juraj Linkeš
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0053d46d-331d-4d2e-9d97-0cb0a668d240@pantheon.tech \
--to=juraj.linkes@pantheon.tech \
--cc=alex.chapman@arm.com \
--cc=dev@dpdk.org \
--cc=honnappa.nagarahalli@arm.com \
--cc=jspewock@iol.unh.edu \
--cc=luca.vizzarro@arm.com \
--cc=paul.szczepanek@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).