From 8e3bf62c7437cbbe870655b689167bf524af153d Mon Sep 17 00:00:00 2001 From: Jimi Chen Date: Fri, 21 Mar 2025 01:07:25 +0000 Subject: [PATCH] Add multicast address cleanup for test failures This change ensures cleanup to release multicast addresses allocated during the test when a test failure occurs. Without this cleanup, failed tests could potentially causing issues in subsequent test runs. Test: atest CtsConnectivityMultiDevicesTestCases Change-Id: Idf8349c8c075cec8007f5041b1ed8812a006f7f4 --- tests/cts/multidevices/apfv6_test.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/cts/multidevices/apfv6_test.py b/tests/cts/multidevices/apfv6_test.py index 2404966345..9b2e309d1e 100644 --- a/tests/cts/multidevices/apfv6_test.py +++ b/tests/cts/multidevices/apfv6_test.py @@ -190,15 +190,18 @@ class ApfV6Test(apf_test_base.ApfTestBase): igmp = IGMPv3mr(records=mcast_records) expected_igmpv3_report = bytes(ether/ip/igmpv3_hdr/igmp).hex() - self.send_packet_and_expect_reply_received( - igmpv3_general_query, "DROPPED_IGMP_V3_GENERAL_QUERY_REPLIED", expected_igmpv3_report - ) - - for addr in mcast_addrs: - adb_utils.adb_shell( - self.clientDevice, - f'ip addr del {addr}/32 dev {self.client_iface_name}' + try: + self.send_packet_and_expect_reply_received( + igmpv3_general_query, + "DROPPED_IGMP_V3_GENERAL_QUERY_REPLIED", + expected_igmpv3_report ) + finally: + for addr in mcast_addrs: + adb_utils.adb_shell( + self.clientDevice, + f'ip addr del {addr}/32 dev {self.client_iface_name}' + ) @apf_utils.at_least_B() @apf_utils.apf_ram_at_least(3000)