|
|
@@ -19,19 +19,24 @@ from .IDFApp import IDFApp, Example, LoadableElfTestApp, UT, TestApp # noqa: ex
|
|
|
from .IDFDUT import IDFDUT, ESP32DUT, ESP32S2DUT, ESP8266DUT, ESP32QEMUDUT # noqa: export DUTs for users
|
|
|
from .DebugUtils import OCDProcess, GDBProcess, TelnetProcess, CustomProcess # noqa: export DebugUtils for users
|
|
|
|
|
|
+# pass TARGET_DUT_CLS_DICT to Env.py to avoid circular dependency issue.
|
|
|
+TARGET_DUT_CLS_DICT = {
|
|
|
+ 'ESP32': ESP32DUT,
|
|
|
+ 'ESP32S2': ESP32S2DUT,
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
def format_case_id(chip, case_name):
|
|
|
return "{}.{}".format(chip, case_name)
|
|
|
|
|
|
|
|
|
-def idf_example_test(app=Example, dut=IDFDUT, chip="ESP32", module="examples", execution_time=1,
|
|
|
+def idf_example_test(app=Example, target="ESP32", module="examples", execution_time=1,
|
|
|
level="example", erase_nvs=True, config_name=None, **kwargs):
|
|
|
"""
|
|
|
decorator for testing idf examples (with default values for some keyword args).
|
|
|
|
|
|
:param app: test application class
|
|
|
- :param dut: dut class
|
|
|
- :param chip: chip supported, string or tuple
|
|
|
+ :param target: target supported, string or iterable
|
|
|
:param module: module, string
|
|
|
:param execution_time: execution time in minutes, int
|
|
|
:param level: test level, could be used to filter test cases, string
|
|
|
@@ -40,31 +45,24 @@ def idf_example_test(app=Example, dut=IDFDUT, chip="ESP32", module="examples", e
|
|
|
:param kwargs: other keyword args
|
|
|
:return: test method
|
|
|
"""
|
|
|
- try:
|
|
|
- # try to config the default behavior of erase nvs
|
|
|
- dut.ERASE_NVS = erase_nvs
|
|
|
- except AttributeError:
|
|
|
- pass
|
|
|
-
|
|
|
- original_method = TinyFW.test_method(app=app, dut=dut, chip=chip, module=module,
|
|
|
- execution_time=execution_time, level=level, **kwargs)
|
|
|
|
|
|
def test(func):
|
|
|
+ original_method = TinyFW.test_method(app=app, target=target, module=module, execution_time=execution_time,
|
|
|
+ level=level, dut_dict=TARGET_DUT_CLS_DICT, erase_nvs=erase_nvs, **kwargs)
|
|
|
test_func = original_method(func)
|
|
|
- test_func.case_info["ID"] = format_case_id(chip, test_func.case_info["name"])
|
|
|
+ test_func.case_info["ID"] = format_case_id(target, test_func.case_info["name"])
|
|
|
return test_func
|
|
|
|
|
|
return test
|
|
|
|
|
|
|
|
|
-def idf_unit_test(app=UT, dut=IDFDUT, chip="ESP32", module="unit-test", execution_time=1,
|
|
|
+def idf_unit_test(app=UT, target="ESP32", module="unit-test", execution_time=1,
|
|
|
level="unit", erase_nvs=True, **kwargs):
|
|
|
"""
|
|
|
decorator for testing idf unit tests (with default values for some keyword args).
|
|
|
|
|
|
:param app: test application class
|
|
|
- :param dut: dut class
|
|
|
- :param chip: chip supported, string or tuple
|
|
|
+ :param target: target supported, string or iterable
|
|
|
:param module: module, string
|
|
|
:param execution_time: execution time in minutes, int
|
|
|
:param level: test level, could be used to filter test cases, string
|
|
|
@@ -72,32 +70,24 @@ def idf_unit_test(app=UT, dut=IDFDUT, chip="ESP32", module="unit-test", executio
|
|
|
:param kwargs: other keyword args
|
|
|
:return: test method
|
|
|
"""
|
|
|
- try:
|
|
|
- # try to config the default behavior of erase nvs
|
|
|
- dut.ERASE_NVS = erase_nvs
|
|
|
- except AttributeError:
|
|
|
- pass
|
|
|
-
|
|
|
- original_method = TinyFW.test_method(app=app, dut=dut, chip=chip, module=module,
|
|
|
- execution_time=execution_time, level=level, **kwargs)
|
|
|
|
|
|
def test(func):
|
|
|
+ original_method = TinyFW.test_method(app=app, target=target, module=module, execution_time=execution_time,
|
|
|
+ level=level, dut_dict=TARGET_DUT_CLS_DICT, erase_nvs=erase_nvs, **kwargs)
|
|
|
test_func = original_method(func)
|
|
|
- test_func.case_info["ID"] = format_case_id(chip, test_func.case_info["name"])
|
|
|
+ test_func.case_info["ID"] = format_case_id(target, test_func.case_info["name"])
|
|
|
return test_func
|
|
|
|
|
|
return test
|
|
|
|
|
|
|
|
|
-def idf_custom_test(app=TestApp, dut=IDFDUT, chip="ESP32", module="misc", execution_time=1,
|
|
|
+def idf_custom_test(app=TestApp, target="ESP32", module="misc", execution_time=1,
|
|
|
level="integration", erase_nvs=True, config_name=None, group="test-apps", **kwargs):
|
|
|
-
|
|
|
"""
|
|
|
decorator for idf custom tests (with default values for some keyword args).
|
|
|
|
|
|
:param app: test application class
|
|
|
- :param dut: dut class
|
|
|
- :param chip: chip supported, string or tuple
|
|
|
+ :param target: target supported, string or iterable
|
|
|
:param module: module, string
|
|
|
:param execution_time: execution time in minutes, int
|
|
|
:param level: test level, could be used to filter test cases, string
|
|
|
@@ -107,18 +97,12 @@ def idf_custom_test(app=TestApp, dut=IDFDUT, chip="ESP32", module="misc", execut
|
|
|
:param kwargs: other keyword args
|
|
|
:return: test method
|
|
|
"""
|
|
|
- try:
|
|
|
- # try to config the default behavior of erase nvs
|
|
|
- dut.ERASE_NVS = erase_nvs
|
|
|
- except AttributeError:
|
|
|
- pass
|
|
|
-
|
|
|
- original_method = TinyFW.test_method(app=app, dut=dut, chip=chip, module=module,
|
|
|
- execution_time=execution_time, level=level, **kwargs)
|
|
|
|
|
|
def test(func):
|
|
|
+ original_method = TinyFW.test_method(app=app, target=target, module=module, execution_time=execution_time,
|
|
|
+ level=level, dut_dict=TARGET_DUT_CLS_DICT, erase_nvs=erase_nvs, **kwargs)
|
|
|
test_func = original_method(func)
|
|
|
- test_func.case_info["ID"] = format_case_id(chip, test_func.case_info["name"])
|
|
|
+ test_func.case_info["ID"] = format_case_id(target, test_func.case_info["name"])
|
|
|
return test_func
|
|
|
|
|
|
return test
|