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:
parent
f5e60524ac
commit
d621d0e88e
29 changed files with 37 additions and 43 deletions
|
@ -44,14 +44,13 @@ import re
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from Utility import (CaseConfig, SearchCases, GitlabCIJob, console_log)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from yaml import CLoader as Loader
|
from yaml import CLoader as Loader
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from yaml import Loader as Loader
|
from yaml import Loader as Loader
|
||||||
|
|
||||||
|
from . import (CaseConfig, SearchCases, GitlabCIJob, console_log)
|
||||||
|
|
||||||
|
|
||||||
class Group(object):
|
class Group(object):
|
||||||
|
|
|
@ -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,22 +38,20 @@ 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
|
||||||
|
|
||||||
import TestCase
|
|
||||||
|
|
||||||
from Utility import load_source
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from yaml import CLoader as Loader
|
from yaml import CLoader as Loader
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from yaml import Loader as Loader
|
from yaml import Loader as Loader
|
||||||
|
|
||||||
|
from . import TestCase
|
||||||
|
|
||||||
|
|
||||||
def _convert_to_lower_case_bytes(item):
|
def _convert_to_lower_case_bytes(item):
|
||||||
"""
|
"""
|
||||||
|
@ -172,8 +170,7 @@ 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(path)
|
|
||||||
output[key] = module.__getattribute__(overwrite[key]["class"])
|
output[key] = module.__getattribute__(overwrite[key]["class"])
|
||||||
return output
|
return output
|
||||||
|
|
|
@ -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,8 +3,6 @@ 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
|
||||||
|
@ -14,13 +12,7 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from yaml import Loader as Loader
|
from yaml import Loader as Loader
|
||||||
|
|
||||||
try:
|
from tiny_test_fw.Utility import CIAssignTest
|
||||||
from 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 import CIAssignTest
|
|
||||||
|
|
||||||
|
|
||||||
class Group(CIAssignTest.Group):
|
class Group(CIAssignTest.Group):
|
||||||
|
@ -119,7 +111,7 @@ class Group(CIAssignTest.Group):
|
||||||
if target:
|
if target:
|
||||||
overwrite = {
|
overwrite = {
|
||||||
"dut": {
|
"dut": {
|
||||||
"path": "IDF/IDFDUT.py",
|
"package": "ttfw_idf",
|
||||||
"class": self.DUT_CLS_NAME[target],
|
"class": self.DUT_CLS_NAME[target],
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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, ESP32DUT, ESP32S2DUT, ESP8266DUT
|
||||||
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"
|
||||||
|
|
Loading…
Reference in a new issue