mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-07 17:08:49 +00: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:
@@ -16,43 +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
|
||||
from IDF.IDFDUT import ESP32DUT
|
||||
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:
|
||||
@@ -68,12 +45,12 @@ def test_example_app_ble_central(env, extra_data):
|
||||
subprocess.check_output(['rm','-rf','/var/lib/bluetooth/*'])
|
||||
subprocess.check_output(['hciconfig','hci0','reset'])
|
||||
# Acquire DUT
|
||||
dut = env.get_dut("blecent", "examples/bluetooth/nimble/blecent", dut_class=ESP32DUT)
|
||||
dut = env.get_dut("blecent", "examples/bluetooth/nimble/blecent", dut_class=ttfw_idf.ESP32DUT)
|
||||
|
||||
# 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")
|
||||
|
||||
Reference in New Issue
Block a user