[PATCH v4 1/3] dts: fix adjust L2/L3 addresses behavior
Luca Vizzarro
luca.vizzarro at arm.com
Wed Nov 13 17:25:14 CET 2024
The _adjust_addresses function has been updated to both modify the
original packets and return new updated copies of them. Having a double
behavior even if documented is not intuitive and can lead to bugs.
This changes the behavior to solely act on copies, leaving the original
packet untouched.
Fixes: 1a1825962777 ("dts: rework packet addressing")
Signed-off-by: Luca Vizzarro <luca.vizzarro at arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek at arm.com>
---
dts/framework/test_suite.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py
index fb5d646ce3..5b3e7c205e 100644
--- a/dts/framework/test_suite.py
+++ b/dts/framework/test_suite.py
@@ -324,8 +324,7 @@ def get_expected_packet(self, packet: Packet) -> Packet:
def _adjust_addresses(self, packets: list[Packet], expected: bool = False) -> list[Packet]:
"""L2 and L3 address additions in both directions.
- Packets in `packets` will be directly modified in this method. The returned list of packets
- however will be copies of the modified packets.
+ Copies of `packets` will be made, modified and returned in this method.
Only missing addresses are added to packets, existing addresses will not be overridden. If
any packet in `packets` has multiple IP layers (using GRE, for example) only the inner-most
@@ -343,7 +342,9 @@ def _adjust_addresses(self, packets: list[Packet], expected: bool = False) -> li
A list containing copies of all packets in `packets` after modification.
"""
ret_packets = []
- for packet in packets:
+ for original_packet in packets:
+ packet = original_packet.copy()
+
# update l2 addresses
# If `expected` is :data:`True`, the packet enters the TG from SUT, otherwise the
# packet leaves the TG towards the SUT.
--
2.43.0
More information about the dev
mailing list