mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 03:34:32 +02:00
test: fix iperf example errors:
1. fix TypeError when running with python3 2. fix throughput chart x/y axis label error 3. make test case compatibile with iperf bin on earlier release branches
This commit is contained in:
@@ -201,7 +201,7 @@ class TestResult(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _convert_to_draw_format(data, label):
|
def _convert_to_draw_format(data, label):
|
||||||
keys = data.keys()
|
keys = list(data.keys())
|
||||||
keys.sort()
|
keys.sort()
|
||||||
return {
|
return {
|
||||||
"x-axis": keys,
|
"x-axis": keys,
|
||||||
@@ -235,8 +235,8 @@ class TestResult(object):
|
|||||||
|
|
||||||
LineChart.draw_line_chart(os.path.join(path, file_name),
|
LineChart.draw_line_chart(os.path.join(path, file_name),
|
||||||
"Throughput Vs {} ({} {})".format(type_name, self.proto, self.direction),
|
"Throughput Vs {} ({} {})".format(type_name, self.proto, self.direction),
|
||||||
"Throughput (Mbps)",
|
|
||||||
"{} (dbm)".format(type_name),
|
"{} (dbm)".format(type_name),
|
||||||
|
"Throughput (Mbps)",
|
||||||
data_list)
|
data_list)
|
||||||
return file_name
|
return file_name
|
||||||
|
|
||||||
@@ -324,7 +324,7 @@ class IperfTestUtility(object):
|
|||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
pass
|
pass
|
||||||
self.dut.write("restart")
|
self.dut.write("restart")
|
||||||
self.dut.expect("esp32>")
|
self.dut.expect_any("iperf>", "esp32>")
|
||||||
self.dut.write("scan {}".format(self.ap_ssid))
|
self.dut.write("scan {}".format(self.ap_ssid))
|
||||||
for _ in range(SCAN_RETRY_COUNT):
|
for _ in range(SCAN_RETRY_COUNT):
|
||||||
try:
|
try:
|
||||||
@@ -450,7 +450,7 @@ class IperfTestUtility(object):
|
|||||||
:return: True or False
|
:return: True or False
|
||||||
"""
|
"""
|
||||||
self.dut.write("restart")
|
self.dut.write("restart")
|
||||||
self.dut.expect("esp32>")
|
self.dut.expect_any("iperf>", "esp32>")
|
||||||
for _ in range(WAIT_AP_POWER_ON_TIMEOUT // SCAN_TIMEOUT):
|
for _ in range(WAIT_AP_POWER_ON_TIMEOUT // SCAN_TIMEOUT):
|
||||||
try:
|
try:
|
||||||
self.dut.write("scan {}".format(self.ap_ssid))
|
self.dut.write("scan {}".format(self.ap_ssid))
|
||||||
@@ -518,7 +518,7 @@ def test_wifi_throughput_with_different_configs(env, extra_data):
|
|||||||
# 2. get DUT and download
|
# 2. get DUT and download
|
||||||
dut = env.get_dut("iperf", "examples/wifi/iperf")
|
dut = env.get_dut("iperf", "examples/wifi/iperf")
|
||||||
dut.start_app()
|
dut.start_app()
|
||||||
dut.expect("esp32>")
|
dut.expect_any("iperf>", "esp32>")
|
||||||
|
|
||||||
# 3. run test for each required att value
|
# 3. run test for each required att value
|
||||||
test_result[config_name] = {
|
test_result[config_name] = {
|
||||||
@@ -576,7 +576,7 @@ def test_wifi_throughput_vs_rssi(env, extra_data):
|
|||||||
# 2. get DUT and download
|
# 2. get DUT and download
|
||||||
dut = env.get_dut("iperf", "examples/wifi/iperf")
|
dut = env.get_dut("iperf", "examples/wifi/iperf")
|
||||||
dut.start_app()
|
dut.start_app()
|
||||||
dut.expect("esp32>")
|
dut.expect_any("iperf>", "esp32>")
|
||||||
|
|
||||||
# 3. run test for each required att value
|
# 3. run test for each required att value
|
||||||
for ap_info in ap_list:
|
for ap_info in ap_list:
|
||||||
@@ -625,7 +625,7 @@ def test_wifi_throughput_basic(env, extra_data):
|
|||||||
# 2. get DUT
|
# 2. get DUT
|
||||||
dut = env.get_dut("iperf", "examples/wifi/iperf")
|
dut = env.get_dut("iperf", "examples/wifi/iperf")
|
||||||
dut.start_app()
|
dut.start_app()
|
||||||
dut.expect("esp32>")
|
dut.expect_any("iperf>", "esp32>")
|
||||||
|
|
||||||
# 3. preparing
|
# 3. preparing
|
||||||
test_result = {
|
test_result = {
|
||||||
|
@@ -36,7 +36,7 @@ class ThroughputForConfigsReport(object):
|
|||||||
self.sdkconfigs[config_name] = self._parse_config_file(sdkconfig_files[config_name])
|
self.sdkconfigs[config_name] = self._parse_config_file(sdkconfig_files[config_name])
|
||||||
if not os.path.exists(output_path):
|
if not os.path.exists(output_path):
|
||||||
os.makedirs(output_path)
|
os.makedirs(output_path)
|
||||||
self.sort_order = self.sdkconfigs.keys()
|
self.sort_order = list(self.sdkconfigs.keys())
|
||||||
self.sort_order.sort()
|
self.sort_order.sort()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -162,7 +162,7 @@ class ThroughputVsRssiReport(object):
|
|||||||
self.output_path = output_path
|
self.output_path = output_path
|
||||||
self.raw_data_path = os.path.join(output_path, "raw_data")
|
self.raw_data_path = os.path.join(output_path, "raw_data")
|
||||||
self.results = throughput_results
|
self.results = throughput_results
|
||||||
self.throughput_types = self.results.keys()
|
self.throughput_types = list(self.results.keys())
|
||||||
self.throughput_types.sort()
|
self.throughput_types.sort()
|
||||||
if not os.path.exists(self.raw_data_path):
|
if not os.path.exists(self.raw_data_path):
|
||||||
os.makedirs(self.raw_data_path)
|
os.makedirs(self.raw_data_path)
|
||||||
|
Reference in New Issue
Block a user