mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 12:44:33 +02:00
tiny-test-fw: move to tools/esp_python_packages:
make `tiny_test_fw` as a package and move to root path of idf python packages
This commit is contained in:
committed by
Angus Gratton
parent
d3e0301aee
commit
7a5d17e1b7
@@ -44,8 +44,12 @@ import re
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
try:
|
||||||
|
from yaml import CLoader as Loader
|
||||||
|
except ImportError:
|
||||||
|
from yaml import Loader as Loader
|
||||||
|
|
||||||
from Utility import (CaseConfig, SearchCases, GitlabCIJob, console_log)
|
from . import (CaseConfig, SearchCases, GitlabCIJob, console_log)
|
||||||
|
|
||||||
|
|
||||||
class Group(object):
|
class Group(object):
|
||||||
@@ -164,7 +168,7 @@ class AssignTest(object):
|
|||||||
def _parse_gitlab_ci_config(self, ci_config_file):
|
def _parse_gitlab_ci_config(self, ci_config_file):
|
||||||
|
|
||||||
with open(ci_config_file, "r") as f:
|
with open(ci_config_file, "r") as f:
|
||||||
ci_config = yaml.load(f)
|
ci_config = yaml.load(f, Loader=Loader)
|
||||||
|
|
||||||
job_list = list()
|
job_list = list()
|
||||||
for job_name in ci_config:
|
for job_name in ci_config:
|
@@ -20,7 +20,7 @@ Template Config File::
|
|||||||
|
|
||||||
TestConfig:
|
TestConfig:
|
||||||
app:
|
app:
|
||||||
path: Users/Test/TinyTestFW/IDF/IDFApp.py
|
package: ttfw_idf
|
||||||
class: Example
|
class: Example
|
||||||
dut:
|
dut:
|
||||||
path:
|
path:
|
||||||
@@ -38,16 +38,19 @@ Template Config File::
|
|||||||
extra_data: some extra data passed to case with kwarg extra_data
|
extra_data: some extra data passed to case with kwarg extra_data
|
||||||
overwrite: # overwrite test configs
|
overwrite: # overwrite test configs
|
||||||
app:
|
app:
|
||||||
path: Users/Test/TinyTestFW/IDF/IDFApp.py
|
package: ttfw_idf
|
||||||
class: Example
|
class: Example
|
||||||
- name: xxx
|
- name: xxx
|
||||||
"""
|
"""
|
||||||
|
import importlib
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
try:
|
||||||
|
from yaml import CLoader as Loader
|
||||||
|
except ImportError:
|
||||||
|
from yaml import Loader as Loader
|
||||||
|
|
||||||
import TestCase
|
from . import TestCase
|
||||||
|
|
||||||
from Utility import load_source
|
|
||||||
|
|
||||||
|
|
||||||
def _convert_to_lower_case_bytes(item):
|
def _convert_to_lower_case_bytes(item):
|
||||||
@@ -154,7 +157,7 @@ class Parser(object):
|
|||||||
configs = cls.DEFAULT_CONFIG.copy()
|
configs = cls.DEFAULT_CONFIG.copy()
|
||||||
if config_file:
|
if config_file:
|
||||||
with open(config_file, "r") as f:
|
with open(config_file, "r") as f:
|
||||||
configs.update(yaml.load(f))
|
configs.update(yaml.load(f, Loader=Loader))
|
||||||
return configs
|
return configs
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -167,9 +170,8 @@ class Parser(object):
|
|||||||
"""
|
"""
|
||||||
output = dict()
|
output = dict()
|
||||||
for key in overwrite:
|
for key in overwrite:
|
||||||
_path = overwrite[key]["path"]
|
module = importlib.import_module(overwrite[key]["package"])
|
||||||
_module = load_source(str(hash(_path)), overwrite[key]["path"])
|
output[key] = module.__getattribute__(overwrite[key]["class"])
|
||||||
output[key] = _module.__getattribute__(overwrite[key]["class"])
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
@@ -17,7 +17,8 @@ import os
|
|||||||
import fnmatch
|
import fnmatch
|
||||||
import types
|
import types
|
||||||
import copy
|
import copy
|
||||||
from Utility import load_source
|
|
||||||
|
from . import load_source
|
||||||
|
|
||||||
|
|
||||||
class Search(object):
|
class Search(object):
|
@@ -26,8 +26,8 @@ import sys
|
|||||||
import argparse
|
import argparse
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
import TinyFW
|
from tiny_test_fw import TinyFW
|
||||||
from Utility import SearchCases, CaseConfig
|
from tiny_test_fw.Utility import SearchCases, CaseConfig
|
||||||
|
|
||||||
|
|
||||||
class Runner(threading.Thread):
|
class Runner(threading.Thread):
|
0
tools/ci/python_packages/tiny_test_fw/docs/_static/.keep
vendored
Normal file
0
tools/ci/python_packages/tiny_test_fw/docs/_static/.keep
vendored
Normal file
@@ -22,25 +22,29 @@ import sys
|
|||||||
import re
|
import re
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
try:
|
import gitlab_api
|
||||||
from Utility.CIAssignTest import AssignTest
|
from tiny_test_fw.Utility import CIAssignTest
|
||||||
except ImportError:
|
|
||||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
|
||||||
if test_fw_path:
|
|
||||||
sys.path.insert(0, test_fw_path)
|
|
||||||
from Utility.CIAssignTest import AssignTest
|
|
||||||
|
|
||||||
from Utility.CIAssignTest import Group
|
|
||||||
|
|
||||||
|
|
||||||
class ExampleGroup(Group):
|
class ExampleGroup(CIAssignTest.Group):
|
||||||
SORT_KEYS = CI_JOB_MATCH_KEYS = ["env_tag", "chip"]
|
SORT_KEYS = CI_JOB_MATCH_KEYS = ["env_tag", "chip"]
|
||||||
|
|
||||||
|
|
||||||
class CIExampleAssignTest(AssignTest):
|
class CIExampleAssignTest(CIAssignTest.AssignTest):
|
||||||
CI_TEST_JOB_PATTERN = re.compile(r"^example_test_.+")
|
CI_TEST_JOB_PATTERN = re.compile(r"^example_test_.+")
|
||||||
|
|
||||||
|
|
||||||
|
class ArtifactFile(object):
|
||||||
|
def __init__(self, project_id, job_name, artifact_file_path):
|
||||||
|
self.gitlab_api = gitlab_api.Gitlab(project_id)
|
||||||
|
|
||||||
|
def process(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def output(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("test_case",
|
parser.add_argument("test_case",
|
@@ -3,19 +3,16 @@ Command line tool to assign unit tests to CI test jobs.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from Utility import CIAssignTest
|
from yaml import CLoader as Loader
|
||||||
except ImportError:
|
except ImportError:
|
||||||
test_fw_path = os.getenv("TEST_FW_PATH")
|
from yaml import Loader as Loader
|
||||||
if test_fw_path:
|
|
||||||
sys.path.insert(0, test_fw_path)
|
from tiny_test_fw.Utility import CIAssignTest
|
||||||
from Utility import CIAssignTest
|
|
||||||
|
|
||||||
|
|
||||||
class Group(CIAssignTest.Group):
|
class Group(CIAssignTest.Group):
|
||||||
@@ -133,7 +130,7 @@ class UnitTestAssignTest(CIAssignTest.AssignTest):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
with open(test_case_path, "r") as f:
|
with open(test_case_path, "r") as f:
|
||||||
raw_data = yaml.load(f)
|
raw_data = yaml.load(f, Loader=Loader)
|
||||||
test_cases = raw_data["test cases"]
|
test_cases = raw_data["test cases"]
|
||||||
for case in test_cases:
|
for case in test_cases:
|
||||||
case["tags"] = set(case["tags"])
|
case["tags"] = set(case["tags"])
|
@@ -17,7 +17,7 @@ import subprocess
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import App
|
from tiny_test_fw import App
|
||||||
|
|
||||||
|
|
||||||
class IDFApp(App.BaseApp):
|
class IDFApp(App.BaseApp):
|
@@ -30,8 +30,7 @@ except ImportError:
|
|||||||
|
|
||||||
from serial.tools import list_ports
|
from serial.tools import list_ports
|
||||||
|
|
||||||
import DUT
|
from tiny_test_fw import DUT, Utility
|
||||||
import Utility
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import esptool
|
import esptool
|
@@ -14,10 +14,9 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import TinyFW
|
from tiny_test_fw import TinyFW, Utility
|
||||||
import Utility
|
from IDFApp import IDFApp, Example, UT
|
||||||
from IDF.IDFApp import IDFApp, Example, UT
|
from IDFDUT import IDFDUT
|
||||||
from IDF.IDFDUT import IDFDUT
|
|
||||||
|
|
||||||
|
|
||||||
def format_case_id(chip, case_name):
|
def format_case_id(chip, case_name):
|
@@ -51,3 +51,6 @@ else
|
|||||||
echo 'No /opt/pyenv/activate exists and no Python interpreter is found!'
|
echo 'No /opt/pyenv/activate exists and no Python interpreter is found!'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# add esp-idf local package path to PYTHONPATH so it can be imported directly
|
||||||
|
export PYTHONPATH="$IDF_PATH/tools:$IDF_PATH/tools/ci/python_packages:$PYTHONPATH"
|
||||||
|
Reference in New Issue
Block a user