test: fix socket issue in iperf example test

This commit is contained in:
Chen Yudong 2021-06-08 17:11:38 +08:00
parent 7be1a8d689
commit bc65641ac4
2 changed files with 7 additions and 0 deletions

View File

@ -149,6 +149,7 @@ static esp_err_t IRAM_ATTR iperf_run_tcp_server(void)
return ESP_FAIL;
}
printf("iperf tcp server create successfully\n");
buffer = s_iperf_ctrl.buffer;
want_recv = s_iperf_ctrl.buffer_len;
while (!s_iperf_ctrl.finish) {

View File

@ -358,6 +358,12 @@ class IperfTestUtility(object):
with open(PC_IPERF_TEMP_LOG_FILE, "w") as f:
if proto == "tcp":
self.dut.write("iperf -s -i 1 -t {}".format(TEST_TIME))
# wait until DUT TCP server created
try:
self.dut.expect("iperf tcp server create successfully", timeout=1)
except DUT.ExpectTimeout:
# compatible with old iperf example binary
pass
process = subprocess.Popen(["iperf", "-c", dut_ip,
"-t", str(TEST_TIME), "-f", "m"],
stdout=f, stderr=f)