fix(iperf): fix incorrect test expectation logic

This commit is contained in:
Alexey Lapshin
2026-02-05 13:40:11 +07:00
parent 7161408eb0
commit d2e0125975
2 changed files with 29 additions and 6 deletions
+9 -6
View File
@@ -30,6 +30,12 @@ except ImportError:
NO_BANDWIDTH_LIMIT = -1 # iperf send bandwidth is not limited
def get_ip_and_wait_prompt(dut: Dut) -> Any:
dut_ip = dut.expect(r'esp_netif_handlers: .+ ip: (\d+\.\d+\.\d+\.\d+),').group(1)
dut.expect('iperf>')
return dut_ip
class IperfTestUtilityEth(IperfUtility.IperfTestUtility):
"""iperf test implementation"""
@@ -52,9 +58,7 @@ class IperfTestUtilityEth(IperfUtility.IperfTestUtility):
except subprocess.CalledProcessError:
pass
self.dut.write('restart')
self.dut.expect("Type 'help' to get the list of commands.")
self.dut.expect('iperf>')
dut_ip = self.dut.expect(r'esp_netif_handlers: .+ ip: (\d+\.\d+\.\d+\.\d+),').group(1)
dut_ip = get_ip_and_wait_prompt(self.dut)
rssi = 0
return dut_ip, rssi
@@ -73,12 +77,11 @@ def test_esp_eth_iperf(
2. compare with the pre-defined pass standard
"""
# 1. wait for DUT
dut.expect_exact('iperf>')
# 1. wait for DUT to be ready
dut_ip = get_ip_and_wait_prompt(dut)
# 2. preparing
pc_iperf_log_file = os.path.join(dut.logdir, 'pc_iperf_log.md')
dut_ip = dut.expect(r'esp_netif_handlers: .+ ip: (\d+\.\d+\.\d+\.\d+),').group(1)
pc_nic_ip = get_host_ip4_by_dest_ip(dut_ip)
test_result = {
'tcp_tx': IperfUtility.TestResult('tcp', 'tx', 'ethernet'),