mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
test: update example and unit tests with new import roles:
tiny_test_fw is a python package now. import it using normal way.
This commit is contained in:
parent
978bf09f83
commit
6e05a79536
@ -16,42 +16,20 @@
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import uuid
|
||||
import subprocess
|
||||
|
||||
try:
|
||||
# This environment variable is expected on the host machine
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
except ImportError as e:
|
||||
print(e)
|
||||
print("\nCheck your IDF_PATH\nOR")
|
||||
print("Try `export TEST_FW_PATH=$IDF_PATH/tools/tiny-test-fw` for resolving the issue\nOR")
|
||||
print("Try `pip install -r $IDF_PATH/tools/tiny-test-fw/requirements.txt` for resolving the issue")
|
||||
import IDF
|
||||
|
||||
try:
|
||||
import lib_ble_client
|
||||
except ImportError:
|
||||
lib_ble_client_path = os.getenv("IDF_PATH") + "/tools/ble"
|
||||
if lib_ble_client_path and lib_ble_client_path not in sys.path:
|
||||
sys.path.insert(0, lib_ble_client_path)
|
||||
import lib_ble_client
|
||||
|
||||
|
||||
import Utility
|
||||
from tiny_test_fw import Utility
|
||||
import ttfw_idf
|
||||
from ble import lib_ble_client
|
||||
|
||||
# When running on local machine execute the following before running this script
|
||||
# > make app bootloader
|
||||
# > make print_flash_cmd | tail -n 1 > build/download.config
|
||||
# > export TEST_FW_PATH=~/esp/esp-idf/tools/tiny-test-fw
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI_BT")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI_BT")
|
||||
def test_example_app_ble_central(env, extra_data):
|
||||
"""
|
||||
Steps:
|
||||
@ -72,7 +50,7 @@ def test_example_app_ble_central(env, extra_data):
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut.app.binary_path, "blecent.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("blecent_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.log_performance("blecent_bin_size", "{}KB".format(bin_size // 1024))
|
||||
|
||||
# Upload binary and start testing
|
||||
Utility.console_log("Starting blecent example test app")
|
||||
|
@ -16,41 +16,19 @@
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import threading
|
||||
import traceback
|
||||
import Queue
|
||||
import subprocess
|
||||
|
||||
try:
|
||||
# This environment variable is expected on the host machine
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
except ImportError as e:
|
||||
print(e)
|
||||
print("\nCheck your IDF_PATH\nOR")
|
||||
print("Try `export TEST_FW_PATH=$IDF_PATH/tools/tiny-test-fw` for resolving the issue\nOR")
|
||||
print("Try `pip install -r $IDF_PATH/tools/tiny-test-fw/requirements.txt` for resolving the issue\n")
|
||||
import IDF
|
||||
|
||||
try:
|
||||
import lib_ble_client
|
||||
except ImportError:
|
||||
lib_ble_client_path = os.getenv("IDF_PATH") + "/tools/ble"
|
||||
if lib_ble_client_path and lib_ble_client_path not in sys.path:
|
||||
sys.path.insert(0, lib_ble_client_path)
|
||||
import lib_ble_client
|
||||
|
||||
|
||||
import Utility
|
||||
from tiny_test_fw import Utility
|
||||
import ttfw_idf
|
||||
from ble import lib_ble_client
|
||||
|
||||
# When running on local machine execute the following before running this script
|
||||
# > make app bootloader
|
||||
# > make print_flash_cmd | tail -n 1 > build/download.config
|
||||
# > export TEST_FW_PATH=~/esp/esp-idf/tools/tiny-test-fw
|
||||
|
||||
|
||||
def blehr_client_task(hr_obj, dut_addr):
|
||||
@ -114,7 +92,7 @@ class BleHRThread(threading.Thread):
|
||||
self.exceptions_queue.put(traceback.format_exc(), block=False)
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI_BT")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI_BT")
|
||||
def test_example_app_ble_hr(env, extra_data):
|
||||
"""
|
||||
Steps:
|
||||
@ -133,8 +111,8 @@ def test_example_app_ble_hr(env, extra_data):
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut.app.binary_path, "blehr.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("blehr_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("blehr_bin_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("blehr_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("blehr_bin_size", bin_size // 1024)
|
||||
|
||||
# Upload binary and start testing
|
||||
Utility.console_log("Starting blehr simple example test app")
|
||||
|
@ -16,35 +16,15 @@
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import Queue
|
||||
import traceback
|
||||
import threading
|
||||
import subprocess
|
||||
|
||||
try:
|
||||
# This environment variable is expected on the host machine
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
except ImportError as e:
|
||||
print(e)
|
||||
print("Try `export TEST_FW_PATH=$IDF_PATH/tools/tiny-test-fw` for resolving the issue")
|
||||
print("Try `pip install -r $IDF_PATH/tools/tiny-test-fw/requirements.txt` for resolving the issue")
|
||||
import IDF
|
||||
|
||||
try:
|
||||
import lib_ble_client
|
||||
except ImportError:
|
||||
lib_ble_client_path = os.getenv("IDF_PATH") + "/tools/ble"
|
||||
if lib_ble_client_path and lib_ble_client_path not in sys.path:
|
||||
sys.path.insert(0, lib_ble_client_path)
|
||||
import lib_ble_client
|
||||
|
||||
|
||||
import Utility
|
||||
from tiny_test_fw import Utility
|
||||
import ttfw_idf
|
||||
from ble import lib_ble_client
|
||||
|
||||
# When running on local machine execute the following before running this script
|
||||
# > make app bootloader
|
||||
@ -135,7 +115,7 @@ class BlePrphThread(threading.Thread):
|
||||
self.exceptions_queue.put(traceback.format_exc(), block=False)
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI_BT")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI_BT")
|
||||
def test_example_app_ble_peripheral(env, extra_data):
|
||||
"""
|
||||
Steps:
|
||||
@ -154,8 +134,8 @@ def test_example_app_ble_peripheral(env, extra_data):
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut.app.binary_path, "bleprph.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("bleprph_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("bleprph_bin_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("bleprph_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("bleprph_bin_size", bin_size // 1024)
|
||||
|
||||
# Upload binary and start testing
|
||||
Utility.console_log("Starting bleprph simple example test app")
|
||||
|
@ -5,20 +5,10 @@ from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import hashlib
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# This environment variable is expected on the host machine
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
|
||||
import IDF
|
||||
|
||||
import Utility
|
||||
from tiny_test_fw import Utility
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
def verify_elf_sha256_embedding(dut):
|
||||
@ -38,13 +28,13 @@ def verify_elf_sha256_embedding(dut):
|
||||
raise ValueError('ELF file SHA256 mismatch')
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI")
|
||||
def test_examples_blink(env, extra_data):
|
||||
dut = env.get_dut("blink", "examples/get-started/blink")
|
||||
binary_file = os.path.join(dut.app.binary_path, "blink.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("blink_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("blink_bin_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("blink_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("blink_bin_size", bin_size // 1024)
|
||||
|
||||
dut.start_app()
|
||||
|
||||
|
@ -1,27 +1,15 @@
|
||||
# Need Python 3 string formatting functions
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# The test cause is dependent on the Tiny Test Framework. Ensure the
|
||||
# `TEST_FW_PATH` environment variable is set to `$IDF_PATH/tools/tiny-test-fw`
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
# CAN Self Test Example constants
|
||||
STR_EXPECT = ("CAN Alert and Recovery: Driver installed", "CAN Alert and Recovery: Driver uninstalled")
|
||||
EXPECT_TIMEOUT = 20
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag='Example_CAN1', ignore=True)
|
||||
@ttfw_idf.idf_example_test(env_tag='Example_CAN1')
|
||||
def test_can_alert_and_recovery_example(env, extra_data):
|
||||
# Get device under test, flash and start example. "dut4" must be defined in EnvConfig
|
||||
dut = env.get_dut('dut1', 'examples/peripherals/can/can_alert_and_recovery')
|
||||
dut.start_app()
|
||||
|
||||
|
@ -1,18 +1,9 @@
|
||||
# Need Python 3 string formatting functions
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
from threading import Thread
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# The test cause is dependent on the Tiny Test Framework. Ensure the
|
||||
# `TEST_FW_PATH` environment variable is set to `$IDF_PATH/tools/tiny-test-fw`
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
|
||||
import ttfw_idf
|
||||
|
||||
# Define tuple of strings to expect for each DUT.
|
||||
master_expect = ("CAN Master: Driver installed", "CAN Master: Driver uninstalled")
|
||||
@ -36,7 +27,7 @@ def dut_thread_callback(**kwargs):
|
||||
result[0] = True
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag='Example_CAN2', ignore=True)
|
||||
@ttfw_idf.idf_example_test(env_tag='Example_CAN2')
|
||||
def test_can_network_example(env, extra_data):
|
||||
|
||||
# Get device under test. "dut1", "dut2", and "dut3" must be properly defined in EnvConfig
|
||||
|
@ -1,17 +1,7 @@
|
||||
# Need Python 3 string formatting functions
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# The test cause is dependent on the Tiny Test Framework. Ensure the
|
||||
# `TEST_FW_PATH` environment variable is set to `$IDF_PATH/tools/tiny-test-fw`
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
# CAN Self Test Example constants
|
||||
@ -19,9 +9,9 @@ STR_EXPECT = ("CAN Self Test: Driver installed", "CAN Self Test: Driver uninstal
|
||||
EXPECT_TIMEOUT = 20
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag='Example_CAN1', ignore=True)
|
||||
@ttfw_idf.idf_example_test(env_tag='Example_CAN1')
|
||||
def test_can_self_test_example(env, extra_data):
|
||||
# Get device under test, flash and start example. "dut4" must be defined in EnvConfig
|
||||
# Get device under test, flash and start example. "dut1" must be defined in EnvConfig
|
||||
dut = env.get_dut('dut1', 'examples/peripherals/can/can_self_test')
|
||||
dut.start_app()
|
||||
|
||||
|
@ -1,19 +1,11 @@
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
|
||||
import ttfw_idf
|
||||
|
||||
EXPECT_TIMEOUT = 20
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag='Example_I2C_CCS811_SENSOR')
|
||||
@ttfw_idf.idf_example_test(env_tag='Example_I2C_CCS811_SENSOR')
|
||||
def test_i2ctools_example(env, extra_data):
|
||||
# Get device under test, flash and start example. "i2ctool" must be defined in EnvConfig
|
||||
dut = env.get_dut('i2ctools', 'examples/peripherals/i2c/i2c_tools')
|
||||
|
@ -12,24 +12,11 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
""" example of writing test with TinyTestFW """
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import TinyFW
|
||||
except ImportError:
|
||||
# if we want to run test case outside `tiny-test-fw` folder,
|
||||
# we need to insert tiny-test-fw path into sys path
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import TinyFW
|
||||
|
||||
import IDF
|
||||
from tiny_test_fw import TinyFW
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_SDIO", ignore=True)
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_SDIO", ignore=True)
|
||||
def test_example_sdio_communication(env, extra_data):
|
||||
"""
|
||||
Configurations
|
||||
@ -132,5 +119,5 @@ def test_example_sdio_communication(env, extra_data):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
TinyFW.set_default_config(env_config_file="EnvConfigTemplate.yml", dut=IDF.IDFDUT)
|
||||
TinyFW.set_default_config(env_config_file="EnvConfigTemplate.yml", dut=ttfw_idf.IDFDUT)
|
||||
test_example_sdio_communication()
|
||||
|
@ -1,21 +1,10 @@
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import socket
|
||||
from threading import Thread
|
||||
import time
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
global g_client_response
|
||||
global g_msg_to_client
|
||||
@ -55,7 +44,7 @@ def chat_server_sketch(my_ip):
|
||||
print("server closed")
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI")
|
||||
def test_examples_protocol_asio_chat_client(env, extra_data):
|
||||
"""
|
||||
steps: |
|
||||
@ -73,8 +62,8 @@ def test_examples_protocol_asio_chat_client(env, extra_data):
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut1.app.binary_path, "asio_chat_client.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("asio_chat_client_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("asio_chat_client_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("asio_chat_client_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("asio_chat_client_size", bin_size // 1024)
|
||||
# 1. start a tcp server on the host
|
||||
host_ip = get_my_ip()
|
||||
thread1 = Thread(target=chat_server_sketch, args=(host_ip,))
|
||||
|
@ -1,23 +1,11 @@
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import socket
|
||||
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI")
|
||||
def test_examples_protocol_asio_chat_server(env, extra_data):
|
||||
"""
|
||||
steps: |
|
||||
@ -31,8 +19,8 @@ def test_examples_protocol_asio_chat_server(env, extra_data):
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut1.app.binary_path, "asio_chat_server.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("asio_chat_server_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("asio_chat_server_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("asio_chat_server_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("asio_chat_server_size", bin_size // 1024)
|
||||
# 1. start test
|
||||
dut1.start_app()
|
||||
# 2. get the server IP address
|
||||
|
@ -1,24 +1,11 @@
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import socket
|
||||
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI")
|
||||
def test_examples_protocol_asio_tcp_server(env, extra_data):
|
||||
"""
|
||||
steps: |
|
||||
@ -33,8 +20,8 @@ def test_examples_protocol_asio_tcp_server(env, extra_data):
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut1.app.binary_path, "asio_tcp_echo_server.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("asio_tcp_echo_server_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("asio_tcp_echo_server_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("asio_tcp_echo_server_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("asio_tcp_echo_server_size", bin_size // 1024)
|
||||
# 1. start test
|
||||
dut1.start_app()
|
||||
# 2. get the server IP address
|
||||
|
@ -1,24 +1,11 @@
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import socket
|
||||
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI")
|
||||
def test_examples_protocol_asio_udp_server(env, extra_data):
|
||||
"""
|
||||
steps: |
|
||||
@ -33,8 +20,8 @@ def test_examples_protocol_asio_udp_server(env, extra_data):
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut1.app.binary_path, "asio_udp_echo_server.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("asio_udp_echo_server_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("asio_udp_echo_server_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("asio_udp_echo_server_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("asio_udp_echo_server_size", bin_size // 1024)
|
||||
# 1. start test
|
||||
dut1.start_app()
|
||||
# 2. get the server IP address
|
||||
|
@ -1,22 +1,10 @@
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI", ignore=True)
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI", ignore=True)
|
||||
def test_examples_protocol_esp_http_client(env, extra_data):
|
||||
"""
|
||||
steps: |
|
||||
@ -27,8 +15,8 @@ def test_examples_protocol_esp_http_client(env, extra_data):
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut1.app.binary_path, "esp-http-client-example.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("esp_http_client_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("esp_http_client_bin_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("esp_http_client_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("esp_http_client_bin_size", bin_size // 1024)
|
||||
# start test
|
||||
dut1.start_app()
|
||||
dut1.expect("Connected to AP, begin http example", timeout=30)
|
||||
|
@ -19,29 +19,14 @@ from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# This environment variable is expected on the host machine
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
|
||||
import IDF
|
||||
|
||||
import Utility
|
||||
from tiny_test_fw import Utility
|
||||
import ttfw_idf
|
||||
from idf_http_server_test import test as client
|
||||
|
||||
# When running on local machine execute the following before running this script
|
||||
# > make app bootloader
|
||||
# > make print_flash_cmd | tail -n 1 > build/download.config
|
||||
# > export TEST_FW_PATH=~/esp/esp-idf/tools/tiny-test-fw
|
||||
|
||||
# Import client module
|
||||
expath = os.path.dirname(os.path.realpath(__file__))
|
||||
client = Utility.load_source("client", expath + "/scripts/test.py")
|
||||
|
||||
|
||||
# Due to connectivity issues (between runner host and DUT) in the runner environment,
|
||||
# some of the `advanced_tests` are ignored. These tests are intended for verifying
|
||||
@ -49,7 +34,7 @@ client = Utility.load_source("client", expath + "/scripts/test.py")
|
||||
# of large HTTP packets and malformed requests, running multiple parallel sessions, etc.
|
||||
# It is advised that all these tests be run locally, when making changes or adding new
|
||||
# features to this component.
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI")
|
||||
def test_examples_protocol_http_server_advanced(env, extra_data):
|
||||
# Acquire DUT
|
||||
dut1 = env.get_dut("http_server", "examples/protocols/http_server/advanced_tests")
|
||||
@ -57,8 +42,8 @@ def test_examples_protocol_http_server_advanced(env, extra_data):
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut1.app.binary_path, "tests.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("http_server_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("http_server_bin_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("http_server_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("http_server_bin_size", bin_size // 1024)
|
||||
|
||||
# Upload binary and start testing
|
||||
Utility.console_log("Starting http_server advanced test app")
|
||||
|
@ -21,31 +21,18 @@ from builtins import str
|
||||
from builtins import range
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import random
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# This environment variable is expected on the host machine
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
|
||||
import Utility
|
||||
from tiny_test_fw import Utility
|
||||
import ttfw_idf
|
||||
from idf_http_server_test import adder as client
|
||||
|
||||
# When running on local machine execute the following before running this script
|
||||
# > make app bootloader
|
||||
# > make print_flash_cmd | tail -n 1 > build/download.config
|
||||
# > export TEST_FW_PATH=~/esp/esp-idf/tools/tiny-test-fw
|
||||
|
||||
# Import client module
|
||||
expath = os.path.dirname(os.path.realpath(__file__))
|
||||
client = Utility.load_source("client", expath + "/scripts/adder.py")
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI")
|
||||
def test_examples_protocol_http_server_persistence(env, extra_data):
|
||||
# Acquire DUT
|
||||
dut1 = env.get_dut("http_server", "examples/protocols/http_server/persistent_sockets")
|
||||
@ -53,8 +40,8 @@ def test_examples_protocol_http_server_persistence(env, extra_data):
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut1.app.binary_path, "persistent_sockets.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("http_server_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("http_server_bin_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("http_server_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("http_server_bin_size", bin_size // 1024)
|
||||
|
||||
# Upload binary and start testing
|
||||
Utility.console_log("Starting http_server persistance test app")
|
||||
|
@ -20,33 +20,20 @@ from __future__ import unicode_literals
|
||||
from builtins import range
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import string
|
||||
import random
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# This environment variable is expected on the host machine
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
from tiny_test_fw import Utility
|
||||
import ttfw_idf
|
||||
from idf_http_server_test import client
|
||||
|
||||
import IDF
|
||||
|
||||
import Utility
|
||||
|
||||
# When running on local machine execute the following before running this script
|
||||
# > make app bootloader
|
||||
# > make print_flash_cmd | tail -n 1 > build/download.config
|
||||
# > export TEST_FW_PATH=~/esp/esp-idf/tools/tiny-test-fw
|
||||
|
||||
# Import client module
|
||||
expath = os.path.dirname(os.path.realpath(__file__))
|
||||
client = Utility.load_source("client", expath + "/scripts/client.py")
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI")
|
||||
def test_examples_protocol_http_server_simple(env, extra_data):
|
||||
# Acquire DUT
|
||||
dut1 = env.get_dut("http_server", "examples/protocols/http_server/simple")
|
||||
@ -54,8 +41,8 @@ def test_examples_protocol_http_server_simple(env, extra_data):
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut1.app.binary_path, "simple.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("http_server_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("http_server_bin_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("http_server_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("http_server_bin_size", bin_size // 1024)
|
||||
|
||||
# Upload binary and start testing
|
||||
Utility.console_log("Starting http_server simple test app")
|
||||
|
@ -1,21 +1,10 @@
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI", ignore=True)
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI", ignore=True)
|
||||
def test_examples_protocol_https_request(env, extra_data):
|
||||
"""
|
||||
steps: |
|
||||
@ -27,8 +16,8 @@ def test_examples_protocol_https_request(env, extra_data):
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut1.app.binary_path, "https_request.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("https_request_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("https_request_bin_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("https_request_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("https_request_bin_size", bin_size // 1024)
|
||||
# start test
|
||||
dut1.start_app()
|
||||
dut1.expect("Connection established...", timeout=30)
|
||||
|
@ -1,6 +1,5 @@
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import socket
|
||||
import time
|
||||
import struct
|
||||
@ -8,21 +7,8 @@ import dpkt
|
||||
import dpkt.dns
|
||||
from threading import Thread
|
||||
|
||||
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
|
||||
import DUT
|
||||
from tiny_test_fw import DUT
|
||||
import ttfw_idf
|
||||
|
||||
g_run_server = True
|
||||
g_done = False
|
||||
@ -76,7 +62,7 @@ def mdns_server(esp_host):
|
||||
continue
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI")
|
||||
def test_examples_protocol_mdns(env, extra_data):
|
||||
global g_run_server
|
||||
"""
|
||||
@ -90,8 +76,8 @@ def test_examples_protocol_mdns(env, extra_data):
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut1.app.binary_path, "mdns-test.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("mdns-test_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("mdns-test_bin_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("mdns-test_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("mdns-test_bin_size", bin_size // 1024)
|
||||
# 1. start mdns application
|
||||
dut1.start_app()
|
||||
# 2. get the dut host name (and IP address)
|
||||
|
@ -8,20 +8,8 @@ import ssl
|
||||
import paho.mqtt.client as mqtt
|
||||
from threading import Thread, Event
|
||||
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
|
||||
import DUT
|
||||
from tiny_test_fw import DUT
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
event_client_connected = Event()
|
||||
@ -53,7 +41,7 @@ def on_message(client, userdata, msg):
|
||||
message_log += "Received data:" + msg.topic + " " + payload + "\n"
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI")
|
||||
def test_examples_protocol_mqtt_ssl(env, extra_data):
|
||||
broker_url = ""
|
||||
broker_port = 0
|
||||
@ -68,9 +56,9 @@ def test_examples_protocol_mqtt_ssl(env, extra_data):
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut1.app.binary_path, "mqtt_ssl.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("mqtt_ssl_bin_size", "{}KB"
|
||||
.format(bin_size // 1024))
|
||||
IDF.check_performance("mqtt_ssl_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("mqtt_ssl_bin_size", "{}KB"
|
||||
.format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("mqtt_ssl_size", bin_size // 1024)
|
||||
# Look for host:port in sdkconfig
|
||||
try:
|
||||
value = re.search(r'\:\/\/([^:]+)\:([0-9]+)', dut1.app.get_sdkconfig()["CONFIG_BROKER_URI"])
|
||||
|
@ -6,20 +6,8 @@ from threading import Thread
|
||||
import struct
|
||||
import time
|
||||
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
|
||||
import DUT
|
||||
from tiny_test_fw import DUT
|
||||
import ttfw_idf
|
||||
|
||||
msgid = -1
|
||||
|
||||
@ -65,7 +53,7 @@ def mqqt_server_sketch(my_ip, port):
|
||||
print("server closed")
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI")
|
||||
def test_examples_protocol_mqtt_qos1(env, extra_data):
|
||||
global msgid
|
||||
"""
|
||||
@ -79,8 +67,8 @@ def test_examples_protocol_mqtt_qos1(env, extra_data):
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut1.app.binary_path, "mqtt_tcp.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("mqtt_tcp_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("mqtt_tcp_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("mqtt_tcp_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("mqtt_tcp_size", bin_size // 1024)
|
||||
# 1. start mqtt broker sketch
|
||||
host_ip = get_my_ip()
|
||||
thread1 = Thread(target=mqqt_server_sketch, args=(host_ip,1883))
|
||||
|
@ -7,20 +7,8 @@ import sys
|
||||
import paho.mqtt.client as mqtt
|
||||
from threading import Thread, Event
|
||||
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except Exception:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
|
||||
import DUT
|
||||
from tiny_test_fw import DUT
|
||||
import ttfw_idf
|
||||
|
||||
event_client_connected = Event()
|
||||
event_stop_client = Event()
|
||||
@ -51,7 +39,7 @@ def on_message(client, userdata, msg):
|
||||
message_log += "Received data:" + msg.topic + " " + payload + "\n"
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI")
|
||||
def test_examples_protocol_mqtt_ws(env, extra_data):
|
||||
broker_url = ""
|
||||
broker_port = 0
|
||||
@ -66,8 +54,8 @@ def test_examples_protocol_mqtt_ws(env, extra_data):
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut1.app.binary_path, "mqtt_websocket.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("mqtt_websocket_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("mqtt_websocket_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("mqtt_websocket_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("mqtt_websocket_size", bin_size // 1024)
|
||||
# Look for host:port in sdkconfig
|
||||
try:
|
||||
value = re.search(r'\:\/\/([^:]+)\:([0-9]+)', dut1.app.get_sdkconfig()["CONFIG_BROKER_URI"])
|
||||
|
@ -8,20 +8,8 @@ import ssl
|
||||
import paho.mqtt.client as mqtt
|
||||
from threading import Thread, Event
|
||||
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
|
||||
import DUT
|
||||
from tiny_test_fw import DUT
|
||||
import ttfw_idf
|
||||
|
||||
event_client_connected = Event()
|
||||
event_stop_client = Event()
|
||||
@ -52,7 +40,7 @@ def on_message(client, userdata, msg):
|
||||
message_log += "Received data:" + msg.topic + " " + payload + "\n"
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI")
|
||||
def test_examples_protocol_mqtt_wss(env, extra_data):
|
||||
broker_url = ""
|
||||
broker_port = 0
|
||||
@ -67,8 +55,8 @@ def test_examples_protocol_mqtt_wss(env, extra_data):
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut1.app.binary_path, "mqtt_websocket_secure.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("mqtt_websocket_secure_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("mqtt_websocket_secure_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("mqtt_websocket_secure_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("mqtt_websocket_secure_size", bin_size // 1024)
|
||||
# Look for host:port in sdkconfig
|
||||
try:
|
||||
value = re.search(r'\:\/\/([^:]+)\:([0-9]+)', dut1.app.get_sdkconfig()["CONFIG_BROKER_URI"])
|
||||
|
@ -1,18 +1,10 @@
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import IDF
|
||||
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI", ignore=True)
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI", ignore=True)
|
||||
def test_examples_protocol_websocket(env, extra_data):
|
||||
"""
|
||||
steps: |
|
||||
@ -24,8 +16,8 @@ def test_examples_protocol_websocket(env, extra_data):
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut1.app.binary_path, "websocket-example.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("websocket_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("websocket_bin_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("websocket_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("websocket_bin_size", bin_size // 1024)
|
||||
# start test
|
||||
dut1.start_app()
|
||||
dut1.expect("Waiting for wifi ...")
|
||||
|
@ -17,30 +17,16 @@
|
||||
from __future__ import print_function
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
|
||||
try:
|
||||
import esp_prov
|
||||
except ImportError:
|
||||
esp_prov_path = os.getenv("IDF_PATH") + "/tools/esp_prov"
|
||||
if esp_prov_path and esp_prov_path not in sys.path:
|
||||
sys.path.insert(0, esp_prov_path)
|
||||
import esp_prov
|
||||
import ttfw_idf
|
||||
import esp_prov
|
||||
|
||||
# Have esp_prov throw exception
|
||||
esp_prov.config_throw_except = True
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI_BT")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI_BT")
|
||||
def test_examples_provisioning_ble(env, extra_data):
|
||||
# Acquire DUT
|
||||
dut1 = env.get_dut("ble_prov", "examples/provisioning/ble_prov")
|
||||
@ -48,8 +34,8 @@ def test_examples_provisioning_ble(env, extra_data):
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut1.app.binary_path, "ble_prov.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("ble_prov_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("ble_prov_bin_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("ble_prov_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("ble_prov_bin_size", bin_size // 1024)
|
||||
|
||||
# Upload binary and start testing
|
||||
dut1.start_app()
|
||||
|
@ -17,30 +17,16 @@
|
||||
from __future__ import print_function
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
|
||||
try:
|
||||
import esp_prov
|
||||
except ImportError:
|
||||
esp_prov_path = os.getenv("IDF_PATH") + "/tools/esp_prov"
|
||||
if esp_prov_path and esp_prov_path not in sys.path:
|
||||
sys.path.insert(0, esp_prov_path)
|
||||
import esp_prov
|
||||
import ttfw_idf
|
||||
import esp_prov
|
||||
|
||||
# Have esp_prov throw exception
|
||||
esp_prov.config_throw_except = True
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI_BT")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI_BT")
|
||||
def test_examples_wifi_prov_mgr(env, extra_data):
|
||||
# Acquire DUT
|
||||
dut1 = env.get_dut("wifi_prov_mgr", "examples/provisioning/manager")
|
||||
@ -48,8 +34,8 @@ def test_examples_wifi_prov_mgr(env, extra_data):
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut1.app.binary_path, "wifi_prov_mgr.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("wifi_prov_mgr_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("wifi_prov_mgr_bin_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("wifi_prov_mgr_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("wifi_prov_mgr_bin_size", bin_size // 1024)
|
||||
|
||||
# Upload binary and start testing
|
||||
dut1.start_app()
|
||||
|
@ -17,38 +17,17 @@
|
||||
from __future__ import print_function
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
|
||||
try:
|
||||
import esp_prov
|
||||
except ImportError:
|
||||
esp_prov_path = os.getenv("IDF_PATH") + "/tools/esp_prov"
|
||||
if esp_prov_path and esp_prov_path not in sys.path:
|
||||
sys.path.insert(0, esp_prov_path)
|
||||
import esp_prov
|
||||
|
||||
try:
|
||||
import wifi_tools
|
||||
except ImportError:
|
||||
wifi_tools_path = os.getenv("IDF_PATH") + "/examples/provisioning/softap_prov/utils"
|
||||
if wifi_tools_path and wifi_tools_path not in sys.path:
|
||||
sys.path.insert(0, wifi_tools_path)
|
||||
import wifi_tools
|
||||
import ttfw_idf
|
||||
import esp_prov
|
||||
import wifi_tools
|
||||
|
||||
# Have esp_prov throw exception
|
||||
esp_prov.config_throw_except = True
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI_BT")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI_BT")
|
||||
def test_examples_provisioning_softap(env, extra_data):
|
||||
# Acquire DUT
|
||||
dut1 = env.get_dut("softap_prov", "examples/provisioning/softap_prov")
|
||||
@ -56,8 +35,8 @@ def test_examples_provisioning_softap(env, extra_data):
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut1.app.binary_path, "softap_prov.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("softap_prov_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("softap_prov_bin_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("softap_prov_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("softap_prov_bin_size", bin_size // 1024)
|
||||
|
||||
# Upload binary and start testing
|
||||
dut1.start_app()
|
||||
|
@ -1,14 +1,5 @@
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
test_fw_path = os.getenv('TEST_FW_PATH')
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
# To prepare a test runner for this example:
|
||||
@ -18,7 +9,7 @@ except ImportError:
|
||||
# espefuse.py --do-not-confirm -p $ESPPORT burn_efuse FLASH_CRYPT_CONFIG 0xf
|
||||
# espefuse.py --do-not-confirm -p $ESPPORT burn_efuse FLASH_CRYPT_CNT 0x1
|
||||
# espefuse.py --do-not-confirm -p $ESPPORT burn_key flash_encryption key.bin
|
||||
@IDF.idf_example_test(env_tag='Example_Flash_Encryption')
|
||||
@ttfw_idf.idf_example_test(env_tag='Example_Flash_Encryption')
|
||||
def test_examples_security_flash_encryption(env, extra_data):
|
||||
dut = env.get_dut('flash_encryption', 'examples/security/flash_encryption')
|
||||
# start test
|
||||
|
@ -1,17 +1,9 @@
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
test_fw_path = os.getenv('TEST_FW_PATH')
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag='Example_ExtFlash')
|
||||
@ttfw_idf.idf_example_test(env_tag='Example_ExtFlash')
|
||||
def test_examples_storage_ext_flash_fatfs(env, extra_data):
|
||||
dut = env.get_dut('ext_flash_fatfs', 'examples/storage/ext_flash_fatfs')
|
||||
dut.start_app()
|
||||
|
@ -3,16 +3,10 @@ import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
test_fw_path = os.getenv('TEST_FW_PATH')
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag='Example_WIFI')
|
||||
@ttfw_idf.idf_example_test(env_tag='Example_WIFI')
|
||||
def test_examples_parttool(env, extra_data):
|
||||
dut = env.get_dut('parttool', 'examples/storage/parttool')
|
||||
dut.start_app(False)
|
||||
|
@ -1,18 +1,11 @@
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
import hashlib
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
test_fw_path = os.getenv('TEST_FW_PATH')
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag='Example_WIFI')
|
||||
@ttfw_idf.idf_example_test(env_tag='Example_WIFI')
|
||||
def test_examples_spiffsgen(env, extra_data):
|
||||
# Test with default build configurations
|
||||
dut = env.get_dut('spiffsgen', 'examples/storage/spiffsgen')
|
||||
|
@ -1,17 +1,9 @@
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
test_fw_path = os.getenv('TEST_FW_PATH')
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag='Example_WIFI')
|
||||
@ttfw_idf.idf_example_test(env_tag='Example_WIFI')
|
||||
def test_examples_system_cpp_exceptions(env, extra_data):
|
||||
dut = env.get_dut('cpp_exceptions_example', 'examples/system/cpp_exceptions')
|
||||
# start test
|
||||
|
@ -1,18 +1,6 @@
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv('TEST_FW_PATH')
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
# Timer events
|
||||
TIMER_EVENT_LIMIT = 3
|
||||
@ -91,7 +79,7 @@ def _test_iteration_events(dut):
|
||||
print("Deleted task event source")
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag='Example_WIFI')
|
||||
@ttfw_idf.idf_example_test(env_tag='Example_WIFI')
|
||||
def test_default_event_loop_example(env, extra_data):
|
||||
dut = env.get_dut('default_event_loop', 'examples/system/esp_event/default_event_loop')
|
||||
|
||||
|
@ -1,18 +1,6 @@
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv('TEST_FW_PATH')
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
TASK_ITERATION_LIMIT = 10
|
||||
|
||||
@ -20,7 +8,7 @@ TASK_ITERATION_POSTING = "posting TASK_EVENTS:TASK_ITERATION_EVENT to {}, iterat
|
||||
TASK_ITERATION_HANDLING = "handling TASK_EVENTS:TASK_ITERATION_EVENT from {}, iteration {}"
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag='Example_WIFI')
|
||||
@ttfw_idf.idf_example_test(env_tag='Example_WIFI')
|
||||
def test_user_event_loops_example(env, extra_data):
|
||||
dut = env.get_dut('user_event_loops', 'examples/system/esp_event/user_event_loops')
|
||||
|
||||
|
@ -1,19 +1,7 @@
|
||||
from __future__ import print_function
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv('TEST_FW_PATH')
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
STARTING_TIMERS_REGEX = re.compile(r'Started timers, time since boot: (\d+) us')
|
||||
|
||||
@ -37,7 +25,7 @@ LIGHT_SLEEP_TIME = 500000
|
||||
ONE_SHOT_TIMER_PERIOD = 5000000
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag='Example_WIFI')
|
||||
@ttfw_idf.idf_example_test(env_tag='Example_WIFI')
|
||||
def test_examples_system_esp_timer(env, extra_data):
|
||||
dut = env.get_dut('esp_timer_example', 'examples/system/esp_timer')
|
||||
# start test
|
||||
|
@ -1,24 +1,12 @@
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv('TEST_FW_PATH')
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
STATS_TASK_ITERS = 3
|
||||
STATS_TASK_EXPECT = "Real time stats obtained"
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag='Example_WIFI')
|
||||
@ttfw_idf.idf_example_test(env_tag='Example_WIFI')
|
||||
def test_real_time_stats_example(env, extra_data):
|
||||
dut = env.get_dut('real_time_stats', 'examples/system/freertos/real_time_stats')
|
||||
dut.start_app()
|
||||
|
@ -1,16 +1,8 @@
|
||||
from __future__ import print_function
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
test_fw_path = os.getenv('TEST_FW_PATH')
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
ENTERING_SLEEP_STR = 'Entering light sleep'
|
||||
EXIT_SLEEP_REGEX = re.compile(r'Returned from light sleep, reason: (\w+), t=(\d+) ms, slept for (\d+) ms')
|
||||
@ -19,7 +11,7 @@ WAITING_FOR_GPIO_STR = 'Waiting for GPIO0 to go high...'
|
||||
WAKEUP_INTERVAL_MS = 2000
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag='Example_WIFI')
|
||||
@ttfw_idf.idf_example_test(env_tag='Example_WIFI')
|
||||
def test_examples_system_light_sleep(env, extra_data):
|
||||
dut = env.get_dut('light_sleep_example', 'examples/system/light_sleep')
|
||||
dut.start_app()
|
||||
|
@ -3,20 +3,10 @@ import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv('TEST_FW_PATH')
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag='Example_WIFI')
|
||||
@ttfw_idf.idf_example_test(env_tag='Example_WIFI')
|
||||
def test_otatool_example(env, extra_data):
|
||||
dut = env.get_dut('otatool', 'examples/system/ota/otatool')
|
||||
|
||||
|
@ -1,25 +1,13 @@
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import socket
|
||||
import BaseHTTPServer
|
||||
import SimpleHTTPServer
|
||||
from threading import Thread
|
||||
import ssl
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
|
||||
import DUT
|
||||
from tiny_test_fw import DUT
|
||||
import ttfw_idf
|
||||
|
||||
server_cert = "-----BEGIN CERTIFICATE-----\n" \
|
||||
"MIIDXTCCAkWgAwIBAgIJAP4LF7E72HakMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\n"\
|
||||
@ -107,7 +95,7 @@ def start_https_server(ota_image_dir, server_ip, server_port):
|
||||
httpd.serve_forever()
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_WIFI")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_WIFI")
|
||||
def test_examples_protocol_simple_ota_example(env, extra_data):
|
||||
"""
|
||||
steps: |
|
||||
@ -119,8 +107,8 @@ def test_examples_protocol_simple_ota_example(env, extra_data):
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut1.app.binary_path, "simple_ota.bin")
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
IDF.log_performance("simple_ota_bin_size", "{}KB".format(bin_size // 1024))
|
||||
IDF.check_performance("simple_ota_bin_size", bin_size // 1024)
|
||||
ttfw_idf.log_performance("simple_ota_bin_size", "{}KB".format(bin_size // 1024))
|
||||
ttfw_idf.check_performance("simple_ota_bin_size", bin_size // 1024)
|
||||
# start test
|
||||
host_ip = get_my_ip()
|
||||
thread1 = Thread(target=start_https_server, args=(dut1.app.binary_path, host_ip, 8000))
|
||||
|
@ -26,33 +26,13 @@ from builtins import range
|
||||
from builtins import object
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import subprocess
|
||||
|
||||
try:
|
||||
import IDF
|
||||
except ImportError:
|
||||
# this is a test case write with tiny-test-fw.
|
||||
# to run test cases outside tiny-test-fw,
|
||||
# we need to set environment variable `TEST_FW_PATH`,
|
||||
# then get and insert `TEST_FW_PATH` to sys path before import FW module
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
import IDF
|
||||
from tiny_test_fw import TinyFW, DUT, Utility
|
||||
import ttfw_idf
|
||||
from idf_iperf_test_util import (Attenuator, PowerControl, LineChart, TestReport)
|
||||
|
||||
import DUT
|
||||
import TinyFW
|
||||
import Utility
|
||||
from Utility import (Attenuator, PowerControl, LineChart)
|
||||
|
||||
try:
|
||||
from test_report import (ThroughputForConfigsReport, ThroughputVsRssiReport)
|
||||
except ImportError:
|
||||
# add current folder to system path for importing test_report
|
||||
sys.path.append(os.path.dirname(__file__))
|
||||
from test_report import (ThroughputForConfigsReport, ThroughputVsRssiReport)
|
||||
|
||||
# configurations
|
||||
TEST_TIME = TEST_TIMEOUT = 60
|
||||
@ -165,8 +145,8 @@ class TestResult(object):
|
||||
throughput = 0.0
|
||||
|
||||
if 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.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)
|
||||
|
||||
@ -466,7 +446,7 @@ class IperfTestUtility(object):
|
||||
return ret
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_ShieldBox_Basic", category="stress")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_ShieldBox_Basic", category="stress")
|
||||
def test_wifi_throughput_with_different_configs(env, extra_data):
|
||||
"""
|
||||
steps: |
|
||||
@ -518,12 +498,12 @@ def test_wifi_throughput_with_different_configs(env, extra_data):
|
||||
env.close_dut("iperf")
|
||||
|
||||
# 5. generate report
|
||||
report = ThroughputForConfigsReport(os.path.join(env.log_path, "ThroughputForConfigsReport"),
|
||||
ap_info["ssid"], test_result, sdkconfig_files)
|
||||
report = TestReport.ThroughputForConfigsReport(os.path.join(env.log_path, "ThroughputForConfigsReport"),
|
||||
ap_info["ssid"], test_result, sdkconfig_files)
|
||||
report.generate_report()
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_ShieldBox", category="stress")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_ShieldBox", category="stress")
|
||||
def test_wifi_throughput_vs_rssi(env, extra_data):
|
||||
"""
|
||||
steps: |
|
||||
@ -572,12 +552,12 @@ def test_wifi_throughput_vs_rssi(env, extra_data):
|
||||
env.close_dut("iperf")
|
||||
|
||||
# 4. generate report
|
||||
report = ThroughputVsRssiReport(os.path.join(env.log_path, "ThroughputVsRssiReport"),
|
||||
test_result)
|
||||
report = TestReport.ThroughputVsRssiReport(os.path.join(env.log_path, "ThroughputVsRssiReport"),
|
||||
test_result)
|
||||
report.generate_report()
|
||||
|
||||
|
||||
@IDF.idf_example_test(env_tag="Example_ShieldBox_Basic")
|
||||
@ttfw_idf.idf_example_test(env_tag="Example_ShieldBox_Basic")
|
||||
def test_wifi_throughput_basic(env, extra_data):
|
||||
"""
|
||||
steps: |
|
||||
@ -614,8 +594,8 @@ def test_wifi_throughput_basic(env, extra_data):
|
||||
# 4. log performance and compare with pass standard
|
||||
performance_items = []
|
||||
for throughput_type in test_result:
|
||||
IDF.log_performance("{}_throughput".format(throughput_type),
|
||||
"{:.02f} Mbps".format(test_result[throughput_type].get_best_throughput()))
|
||||
ttfw_idf.log_performance("{}_throughput".format(throughput_type),
|
||||
"{:.02f} Mbps".format(test_result[throughput_type].get_best_throughput()))
|
||||
performance_items.append(["{}_throughput".format(throughput_type),
|
||||
"{:.02f} Mbps".format(test_result[throughput_type].get_best_throughput())])
|
||||
|
||||
@ -623,8 +603,8 @@ def test_wifi_throughput_basic(env, extra_data):
|
||||
TinyFW.JunitReport.update_performance(performance_items)
|
||||
# do check after logging, otherwise test will exit immediately if check fail, some performance can't be logged.
|
||||
for throughput_type in test_result:
|
||||
IDF.check_performance("{}_throughput".format(throughput_type),
|
||||
test_result[throughput_type].get_best_throughput())
|
||||
ttfw_idf.check_performance("{}_throughput".format(throughput_type),
|
||||
test_result[throughput_type].get_best_throughput())
|
||||
|
||||
env.close_dut("iperf")
|
||||
|
||||
|
0
tools/ble/__init__.py
Normal file
0
tools/ble/__init__.py
Normal file
@ -10,13 +10,14 @@ assign_test:
|
||||
- build_ssc
|
||||
- build_esp_idf_tests_cmake
|
||||
variables:
|
||||
TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
|
||||
EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
|
||||
UNIT_TEST_CASE_FILE: "${CI_PROJECT_DIR}/components/idf_test/unit_test/TestCaseAll.yml"
|
||||
artifacts:
|
||||
paths:
|
||||
- components/idf_test/*/CIConfigs
|
||||
- components/idf_test/*/TC.sqlite
|
||||
- $EXAMPLE_CONFIG_OUTPUT_PATH
|
||||
- build_examples/artifact_index.json
|
||||
expire_in: 1 week
|
||||
only:
|
||||
variables:
|
||||
@ -26,9 +27,9 @@ assign_test:
|
||||
- $BOT_LABEL_EXAMPLE_TEST
|
||||
script:
|
||||
# assign example tests
|
||||
- python $TEST_FW_PATH/CIAssignExampleTest.py $IDF_PATH/examples $CI_TARGET_TEST_CONFIG_FILE $EXAMPLE_CONFIG_OUTPUT_PATH
|
||||
- python tools/ci/python_packages/ttfw_idf/CIAssignExampleTest.py $IDF_PATH/examples $CI_TARGET_TEST_CONFIG_FILE $EXAMPLE_CONFIG_OUTPUT_PATH
|
||||
# assign unit test cases
|
||||
- python $TEST_FW_PATH/CIAssignUnitTest.py $IDF_PATH/components/idf_test/unit_test/TestCaseAll.yml $CI_TARGET_TEST_CONFIG_FILE $IDF_PATH/components/idf_test/unit_test/CIConfigs
|
||||
- python tools/ci/python_packages/ttfw_idf/CIAssignUnitTest.py $UNIT_TEST_CASE_FILE $CI_TARGET_TEST_CONFIG_FILE $IDF_PATH/components/idf_test/unit_test/CIConfigs
|
||||
# clone test script to assign tests
|
||||
- git clone $TEST_SCRIPT_REPOSITORY
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
|
||||
@ -56,7 +57,6 @@ update_test_cases:
|
||||
variables:
|
||||
UNIT_TEST_CASE_FILE: "${CI_PROJECT_DIR}/components/idf_test/unit_test/TestCaseAll.yml"
|
||||
BOT_ACCOUNT_CONFIG_FILE: "${CI_PROJECT_DIR}/test-management/Config/Account.local.yml"
|
||||
TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
|
||||
AUTO_TEST_SCRIPT_PATH: "${CI_PROJECT_DIR}/auto_test_script"
|
||||
PYTHON_VER: 3
|
||||
script:
|
||||
|
@ -30,7 +30,6 @@
|
||||
reports:
|
||||
junit: $LOG_PATH/*/XUNIT_RESULT.xml
|
||||
variables:
|
||||
TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
|
||||
TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
|
||||
CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/examples/test_configs"
|
||||
LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
|
||||
@ -42,7 +41,7 @@
|
||||
# clone test env configs
|
||||
- git clone $TEST_ENV_CONFIG_REPOSITORY
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
|
||||
- cd $TEST_FW_PATH
|
||||
- cd tools/ci/python_packages/tiny_test_fw/bin
|
||||
# run test
|
||||
- python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE -e $ENV_FILE
|
||||
|
||||
@ -125,7 +124,6 @@ test_weekend_mqtt:
|
||||
- $BOT_LABEL_WEEKEND_TEST
|
||||
variables:
|
||||
TEST_CASE_PATH: "$CI_PROJECT_DIR/components/mqtt/weekend_test"
|
||||
TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
|
||||
LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
|
||||
ENV_FILE: "$CI_PROJECT_DIR/components/mqtt/weekend_test/env.yml"
|
||||
CONFIG_FILE: "$CI_PROJECT_DIR/components/mqtt/weekend_test/config.yml"
|
||||
@ -142,7 +140,6 @@ test_weekend_network:
|
||||
- $BOT_LABEL_WEEKEND_TEST
|
||||
variables:
|
||||
TEST_CASE_PATH: "$CI_PROJECT_DIR/components/lwip/weekend_test"
|
||||
TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
|
||||
LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
|
||||
ENV_FILE: "$CI_PROJECT_DIR/components/lwip/weekend_test/env.yml"
|
||||
CONFIG_FILE: "$CI_PROJECT_DIR/components/lwip/weekend_test/config.yml"
|
||||
@ -160,6 +157,16 @@ example_test_002:
|
||||
tags:
|
||||
- ESP32
|
||||
- Example_ShieldBox_Basic
|
||||
script:
|
||||
- *define_config_file_name
|
||||
# first test if config file exists, if not exist, exit 0
|
||||
- test -e $CONFIG_FILE || exit 0
|
||||
# clone test env configs
|
||||
- git clone $TEST_ENV_CONFIG_REPOSITORY
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
|
||||
- cd tools/ci/python_packages/tiny_test_fw/bin
|
||||
# run test
|
||||
- python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE -e $ENV_FILE
|
||||
|
||||
.example_test_003:
|
||||
extends: .example_test_template
|
||||
@ -167,11 +174,17 @@ example_test_002:
|
||||
- ESP32
|
||||
- Example_SDIO
|
||||
|
||||
example_test_004:
|
||||
example_test_004A:
|
||||
extends: .example_test_template
|
||||
tags:
|
||||
- ESP32
|
||||
- Example_CAN
|
||||
- Example_CAN1
|
||||
|
||||
example_test_004B:
|
||||
extends: .example_test_template
|
||||
tags:
|
||||
- ESP32
|
||||
- Example_CAN2
|
||||
|
||||
example_test_005:
|
||||
extends: .example_test_template
|
||||
|
@ -20,7 +20,8 @@ from builtins import str
|
||||
from builtins import range
|
||||
import http.client
|
||||
import argparse
|
||||
import Utility
|
||||
|
||||
from tiny_test_fw import Utility
|
||||
|
||||
|
||||
def start_session(ip, port):
|
@ -20,19 +20,8 @@ from builtins import str
|
||||
import http.client
|
||||
import argparse
|
||||
|
||||
try:
|
||||
import Utility
|
||||
except ImportError:
|
||||
import sys
|
||||
import os
|
||||
|
||||
# This environment variable is expected on the host machine
|
||||
# > export TEST_FW_PATH=~/esp/esp-idf/tools/tiny-test-fw
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
|
||||
import Utility
|
||||
from tiny_test_fw import Utility
|
||||
|
||||
|
||||
def verbose_print(verbosity, *args):
|
1025
tools/ci/python_packages/idf_http_server_test/test.py
Normal file
1025
tools/ci/python_packages/idf_http_server_test/test.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,4 +2,3 @@ pyserial
|
||||
pyyaml
|
||||
junit_xml
|
||||
netifaces
|
||||
matplotlib
|
||||
|
1
tools/esp_prov/__init__.py
Normal file
1
tools/esp_prov/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from esp_prov import * # noqa: export esp_prov module to users
|
@ -19,33 +19,12 @@ Test script for unit test case.
|
||||
"""
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import argparse
|
||||
import threading
|
||||
|
||||
try:
|
||||
import TinyFW
|
||||
except ImportError:
|
||||
# if we want to run test case outside `tiny-test-fw` folder,
|
||||
# we need to insert tiny-test-fw path into sys path
|
||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
||||
if test_fw_path and test_fw_path not in sys.path:
|
||||
sys.path.insert(0, test_fw_path)
|
||||
else:
|
||||
# or try the copy in IDF
|
||||
idf_path = os.getenv("IDF_PATH")
|
||||
tiny_test_path = idf_path + "/tools/tiny-test-fw"
|
||||
if os.path.exists(tiny_test_path):
|
||||
sys.path.insert(0, tiny_test_path)
|
||||
import TinyFW
|
||||
|
||||
import IDF
|
||||
import Utility
|
||||
import Env
|
||||
from DUT import ExpectTimeout
|
||||
from IDF.IDFApp import UT
|
||||
from tiny_test_fw import TinyFW, Utility, Env, DUT
|
||||
import ttfw_idf
|
||||
|
||||
|
||||
UT_APP_BOOT_UP_DONE = "Press ENTER to see the list of tests."
|
||||
@ -180,7 +159,7 @@ def reset_dut(dut):
|
||||
try:
|
||||
dut.expect("0 Tests 0 Failures 0 Ignored", timeout=TEST_HISTORY_CHECK_TIMEOUT)
|
||||
break
|
||||
except ExpectTimeout:
|
||||
except DUT.ExpectTimeout:
|
||||
pass
|
||||
else:
|
||||
raise AssertionError("Reset {} ({}) failed!".format(dut.name, dut.port))
|
||||
@ -255,14 +234,14 @@ def run_one_normal_case(dut, one_case, junit_test_case):
|
||||
(FINISH_PATTERN, handle_test_finish),
|
||||
(UT_APP_BOOT_UP_DONE, handle_reset_finish),
|
||||
timeout=one_case["timeout"])
|
||||
except ExpectTimeout:
|
||||
except DUT.ExpectTimeout:
|
||||
Utility.console_log("Timeout in expect", color="orange")
|
||||
junit_test_case.add_failure_info("timeout")
|
||||
one_case_finish(False)
|
||||
break
|
||||
|
||||
|
||||
@IDF.idf_unit_test(env_tag="UT_T1_1", junit_report_by_case=True)
|
||||
@ttfw_idf.idf_unit_test(env_tag="UT_T1_1", junit_report_by_case=True)
|
||||
def run_unit_test_cases(env, extra_data):
|
||||
"""
|
||||
extra_data can be three types of value
|
||||
@ -401,7 +380,7 @@ class Handler(threading.Thread):
|
||||
time.sleep(1)
|
||||
self.dut.write("\"{}\"".format(self.parent_case_name))
|
||||
self.dut.expect("Running " + self.parent_case_name + "...")
|
||||
except ExpectTimeout:
|
||||
except DUT.ExpectTimeout:
|
||||
Utility.console_log("No case detected!", color="orange")
|
||||
while not self.finish and not self.force_stop.isSet():
|
||||
try:
|
||||
@ -411,7 +390,7 @@ class Handler(threading.Thread):
|
||||
(self.SEND_SIGNAL_PATTERN, device_send_action), # send signal pattern
|
||||
(self.FINISH_PATTERN, handle_device_test_finish), # test finish pattern
|
||||
timeout=self.timeout)
|
||||
except ExpectTimeout:
|
||||
except DUT.ExpectTimeout:
|
||||
Utility.console_log("Timeout in expect", color="orange")
|
||||
one_device_case_finish(False)
|
||||
break
|
||||
@ -471,7 +450,7 @@ def run_one_multiple_devices_case(duts, ut_config, env, one_case, app_bin, junit
|
||||
return result
|
||||
|
||||
|
||||
@IDF.idf_unit_test(env_tag="UT_T2_1", junit_report_by_case=True)
|
||||
@ttfw_idf.idf_unit_test(env_tag="UT_T2_1", junit_report_by_case=True)
|
||||
def run_multiple_devices_cases(env, extra_data):
|
||||
"""
|
||||
extra_data can be two types of value
|
||||
@ -618,7 +597,7 @@ def run_one_multiple_stage_case(dut, one_case, junit_test_case):
|
||||
(FINISH_PATTERN, handle_test_finish),
|
||||
(UT_APP_BOOT_UP_DONE, handle_next_stage),
|
||||
timeout=one_case["timeout"])
|
||||
except ExpectTimeout:
|
||||
except DUT.ExpectTimeout:
|
||||
Utility.console_log("Timeout in expect", color="orange")
|
||||
one_case_finish(False)
|
||||
break
|
||||
@ -627,7 +606,7 @@ def run_one_multiple_stage_case(dut, one_case, junit_test_case):
|
||||
break
|
||||
|
||||
|
||||
@IDF.idf_unit_test(env_tag="UT_T1_1", junit_report_by_case=True)
|
||||
@ttfw_idf.idf_unit_test(env_tag="UT_T1_1", junit_report_by_case=True)
|
||||
def run_multiple_stage_cases(env, extra_data):
|
||||
"""
|
||||
extra_data can be 2 types of value
|
||||
@ -734,7 +713,7 @@ def detect_update_unit_test_info(env, extra_data, app_bin):
|
||||
for _dic in extra_data:
|
||||
if 'type' not in _dic:
|
||||
raise ValueError("Unit test \"{}\" doesn't exist in the flashed device!".format(_dic.get('name')))
|
||||
except ExpectTimeout:
|
||||
except DUT.ExpectTimeout:
|
||||
Utility.console_log("Timeout during getting the test list", color="red")
|
||||
finally:
|
||||
dut.close()
|
||||
@ -789,8 +768,8 @@ if __name__ == '__main__':
|
||||
TinyFW.set_default_config(env_config_file=args.env_config_file)
|
||||
|
||||
env_config = TinyFW.get_default_config()
|
||||
env_config['app'] = UT
|
||||
env_config['dut'] = IDF.IDFDUT
|
||||
env_config['app'] = ttfw_idf.UT
|
||||
env_config['dut'] = ttfw_idf.IDFDUT
|
||||
env_config['test_suite_name'] = 'unit_test_parsing'
|
||||
test_env = Env.Env(**env_config)
|
||||
detect_update_unit_test_info(test_env, extra_data=list_of_dicts, app_bin=args.app_bin)
|
||||
|
Loading…
Reference in New Issue
Block a user