mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 05:04:33 +02:00
Merge branch 'bugfix/iperf_output_regex' into 'master'
ci: iperf: recognize report results from newer iperf versions Closes IDFCI-1226 and IDFCI-1229 See merge request espressif/esp-idf!18055
This commit is contained in:
@@ -42,7 +42,7 @@ extern "C" {
|
||||
#define IPERF_REPORT_TASK_PRIORITY 6
|
||||
#define IPERF_REPORT_TASK_STACK 4096
|
||||
|
||||
#define IPERF_UDP_TX_LEN (1472)
|
||||
#define IPERF_UDP_TX_LEN (1470)
|
||||
#define IPERF_UDP_RX_LEN (16 << 10)
|
||||
#define IPERF_TCP_TX_LEN (16 << 10)
|
||||
#define IPERF_TCP_RX_LEN (16 << 10)
|
||||
|
@@ -142,6 +142,8 @@ static void socket_recv(int recv_socket, struct sockaddr_storage listen_addr, ui
|
||||
static void socket_send(int send_socket, struct sockaddr_storage dest_addr, uint8_t type, int bw_lim)
|
||||
{
|
||||
uint8_t *buffer;
|
||||
int32_t *pkt_id_p;
|
||||
int32_t pkt_cnt = 0;
|
||||
int actual_send = 0;
|
||||
int want_send = 0;
|
||||
int period_us = -1;
|
||||
@@ -153,6 +155,7 @@ static void socket_send(int send_socket, struct sockaddr_storage dest_addr, uint
|
||||
const char *error_log = (type == IPERF_TRANS_TYPE_TCP) ? "tcp client send" : "udp client send";
|
||||
|
||||
buffer = s_iperf_ctrl.buffer;
|
||||
pkt_id_p = (int32_t *)s_iperf_ctrl.buffer;
|
||||
want_send = s_iperf_ctrl.buffer_len;
|
||||
iperf_start_report();
|
||||
|
||||
@@ -176,7 +179,13 @@ static void socket_send(int send_socket, struct sockaddr_storage dest_addr, uint
|
||||
}
|
||||
prev_time = send_time;
|
||||
}
|
||||
|
||||
*pkt_id_p = htonl(pkt_cnt); // datagrams need to be sequentially numbered
|
||||
if (pkt_cnt >= INT32_MAX) {
|
||||
pkt_cnt = 0;
|
||||
}
|
||||
else {
|
||||
pkt_cnt++;
|
||||
}
|
||||
actual_send = sendto(send_socket, buffer, want_send, 0, (struct sockaddr *)&dest_addr, socklen);
|
||||
if (actual_send != want_send) {
|
||||
if (type == IPERF_TRANS_TYPE_UDP) {
|
||||
|
@@ -29,7 +29,7 @@ PC_IPERF_TEMP_LOG_FILE = '.tmp_iperf.log'
|
||||
class TestResult(object):
|
||||
""" record, analysis test result and convert data to output format """
|
||||
|
||||
PC_BANDWIDTH_LOG_PATTERN = re.compile(r'(\d+).0\s*-\s*(\d+).0\s+sec\s+[\d.]+\s+MBytes\s+([\d.]+)\s+Mbits/sec')
|
||||
PC_BANDWIDTH_LOG_PATTERN = re.compile(r'(\d+\.\d+)\s*-\s*(\d+.\d+)\s+sec\s+[\d.]+\s+MBytes\s+([\d.]+)\s+Mbits\/sec')
|
||||
DUT_BANDWIDTH_LOG_PATTERN = re.compile(r'(\d+)-\s+(\d+)\s+sec\s+([\d.]+)\s+Mbits/sec')
|
||||
|
||||
ZERO_POINT_THRESHOLD = -88 # RSSI, dbm
|
||||
@@ -96,19 +96,22 @@ class TestResult(object):
|
||||
"""
|
||||
fall_to_0_recorded = 0
|
||||
throughput_list = []
|
||||
throughput = 0.0
|
||||
max_throughput = 0.0
|
||||
result_list = self.PC_BANDWIDTH_LOG_PATTERN.findall(raw_data)
|
||||
if not result_list:
|
||||
# failed to find raw data by PC pattern, it might be DUT pattern
|
||||
result_list = self.DUT_BANDWIDTH_LOG_PATTERN.findall(raw_data)
|
||||
|
||||
for result in result_list:
|
||||
if int(result[1]) - int(result[0]) != 1:
|
||||
t_start = float(result[0])
|
||||
t_end = float(result[1])
|
||||
throughput = float(result[2])
|
||||
if int(t_end - t_start) != 1:
|
||||
# this could be summary, ignore this
|
||||
continue
|
||||
throughput_list.append(float(result[2]))
|
||||
throughput = (throughput if (throughput > float(result[2])) else float(result[2]))
|
||||
if float(result[2]) == 0 and rssi > self.ZERO_POINT_THRESHOLD \
|
||||
throughput_list.append(throughput)
|
||||
max_throughput = max(max_throughput, throughput)
|
||||
if throughput == 0 and rssi > self.ZERO_POINT_THRESHOLD \
|
||||
and fall_to_0_recorded < 1:
|
||||
# throughput fall to 0 error. we only record 1 records for one test
|
||||
self.error_list.append('[Error][fall to 0][{}][att: {}][rssi: {}]: 0 throughput interval: {}-{}'
|
||||
@@ -116,15 +119,17 @@ class TestResult(object):
|
||||
fall_to_0_recorded += 1
|
||||
|
||||
if len(throughput_list) < self.THROUGHPUT_QUALIFY_COUNT:
|
||||
throughput = 0.0
|
||||
self.error_list.append('[Error][Fatal][{}][att: {}][rssi: {}]: Only {} throughput values found, expected at least {}'
|
||||
.format(ap_ssid, att, rssi, len(throughput_list), self.THROUGHPUT_QUALIFY_COUNT))
|
||||
max_throughput = 0.0
|
||||
|
||||
if throughput == 0 and rssi > self.ZERO_THROUGHPUT_THRESHOLD:
|
||||
if max_throughput == 0 and rssi > self.ZERO_THROUGHPUT_THRESHOLD:
|
||||
self.error_list.append('[Error][Fatal][{}][att: {}][rssi: {}]: No throughput data found'
|
||||
.format(ap_ssid, att, rssi))
|
||||
|
||||
self._save_result(throughput, ap_ssid, att, rssi, heap_size)
|
||||
self._save_result(max_throughput, ap_ssid, att, rssi, heap_size)
|
||||
|
||||
return throughput
|
||||
return max_throughput
|
||||
|
||||
def post_analysis(self): # type: () -> None
|
||||
"""
|
||||
|
Reference in New Issue
Block a user