Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upmerge 8 24 #20

Merged
merged 44 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6c852fe
bot: Add a test run backup mode
mkasenberg Jun 19, 2024
f2a795f
common: Add support for hid_gpio active hub
mkasenberg Jun 25, 2024
cc887fe
cron: Add test run timeguard
mkasenberg Jun 27, 2024
164c8fd
bot: Unify report creation
mkasenberg Jul 4, 2024
499a353
common: Allow to configure the paths of generated files
mkasenberg Jul 5, 2024
37972e2
mynewt: Apply auto-update of PTS workspace to 8.6
mkasenberg Jul 5, 2024
90a35b2
errata: Update with erratas for PTS 8.6
sjanc Jul 11, 2024
a5bd290
zephyr: mesh: add mbtm and dfum profiles to zephyr-master workspaces
m-alperen-sener Jul 9, 2024
483956a
zephyr: mesh: apply TCRL-2024 changes for MBT and DFU profiles
m-alperen-sener Jul 10, 2024
906a2cd
zephyr: mesh: use prefixes to filter the test cases
m-alperen-sener Jul 11, 2024
6b2c4ce
errata: Update L2CAP erratas
sjanc Jul 22, 2024
724fb15
cron: Add start of an active hub server
mkasenberg Jul 29, 2024
0b46cae
zephyr: Use builtin DIS service
sjanc Jul 29, 2024
ab30ea7
wid/bap: Add more configurations to ac_configs
sjanc Jul 26, 2024
886958f
mynewt: errata: l2cap test case
piotrnarajowski Jul 31, 2024
9e67c34
requirements: add missing module
piotrnarajowski Aug 1, 2024
b6bc663
tools: cron: test case limit enchancement
piotrnarajowski Jul 30, 2024
3c2077b
bot: Load missing tc database into stats backup
mkasenberg Aug 5, 2024
4bc682a
cron: Add --test-case-limit alias to --test_case_limit option
mkasenberg Jul 29, 2024
e53209a
cron: Handle parsing exception
mkasenberg Jul 29, 2024
800c154
tools: bisect: Allow to set the path of bisected repo
mkasenberg Aug 8, 2024
6c53565
cron: Restart bot again in case of timeout
mkasenberg Aug 7, 2024
f3ddaed
mynewt: errata: Update errata list
piotrnarajowski Aug 9, 2024
83b3225
cron: pr job: Rebase remote autopts server to PR branch
mkasenberg Aug 9, 2024
702f4a7
cron: pr job: Pass estimated test cases only if limit provided
mkasenberg Aug 9, 2024
dcbcbf0
zephyr: Update PTS workspace for PTS 8.6.1
sjanc Aug 8, 2024
a6500c3
zephyr: Move GTBS to TBS profile
sjanc Aug 8, 2024
73e8b0a
zephyr: Move GMCS test to MCS profile
sjanc Aug 8, 2024
faa17b4
mynewt: gatt: add btp gap pair command
piotrnarajowski Aug 12, 2024
f5d2d92
zephyr: fix wrong DIS PIXIT value
MicImbriani Aug 14, 2024
c6f8214
tools: cron: Deep copy a config loaded as module
piotrnarajowski Aug 12, 2024
c8a64eb
bot: report: add project name
piotrnarajowski Aug 16, 2024
4224c2c
zephyr: Update PTS workspace
sjanc Aug 21, 2024
2554286
boards: add nRF54H20 device
AyturkDuzen Aug 15, 2024
5f1e424
zephyr: Add support for the nRF5340 Audio devkit
Frodevan Dec 20, 2023
528a86f
bot: Reuse session folder between config runs
mkasenberg Aug 23, 2024
f5bb759
bot: Move stats files after bot run
mkasenberg Aug 23, 2024
4cf377b
bot: Fix missing result of test case with timeout result
mkasenberg Aug 23, 2024
7d0bdd8
cron: Fix missing descriptions in report emails
mkasenberg Aug 23, 2024
a603aee
cron: Do not create empty save-folders
mkasenberg Aug 23, 2024
951097a
boards: Add config for building/flashing only appcore of nrf53
mkasenberg Aug 23, 2024
a3e0ecf
bot: Fix exception at fetching description of GMCS and GTBS test cases
mkasenberg Aug 26, 2024
727efbf
zephyr: Fix multiple CAP/INI/UST tests
sjanc Aug 26, 2024
61d1d01
mynewt: gatt_cl: add mynewt specific wid handler
piotrnarajowski Aug 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
690 changes: 615 additions & 75 deletions autopts/bot/common.py

Large diffs are not rendered by default.

118 changes: 20 additions & 98 deletions autopts/bot/common_features/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,15 @@
from autopts.bot.common_features import github
from autopts.bot import common
from autopts.client import PtsServer
from autopts.config import AUTOPTS_ROOT_DIR

REPORT_XLSX = "report.xlsx"
REPORT_TXT = "report.txt"
REPORT_DIFF_TXT = "report-diff.txt"
ERROR_TXT = 'error.txt'

ERRATA_DIR_PATH = os.path.join(common.PROJECT_DIR, 'errata')
log = logging.debug


def get_errata(project_name):
errata_common = os.path.join(ERRATA_DIR_PATH, 'common.yaml')
errata_project = os.path.join(ERRATA_DIR_PATH, f'{project_name}.yaml')
def get_errata(errata_files):
errata = {}

for file in [errata_common, errata_project]:
for file in errata_files:
if os.path.exists(file):
with open(file, 'r') as stream:
loaded_errata = yaml.safe_load(stream)
Expand All @@ -54,7 +47,7 @@ def get_errata(project_name):


def get_autopts_version():
repo = git.Repo(common.PROJECT_DIR)
repo = git.Repo(AUTOPTS_ROOT_DIR)
version = repo.git.show('-s', '--format=%H')

if repo.is_dirty():
Expand All @@ -75,8 +68,8 @@ def make_repo_status(repos_info):
# ****************************************************************************
# .xlsx spreadsheet file
# ****************************************************************************
def make_report_xlsx(results_dict, status_dict, regressions_list,
progresses_list, descriptions, xmls, project_name=''):
def make_report_xlsx(report_xlsx_path, results_dict, status_dict, regressions_list,
progresses_list, descriptions, xmls, errata):
"""Creates excel file containing test cases results and summary pie chart
:param results_dict: dictionary with test cases results
:param status_dict: status dictionary, where key is status and value is
Expand All @@ -90,7 +83,7 @@ def make_report_xlsx(results_dict, status_dict, regressions_list,
try:
xml_list = list(os.scandir(xmls))
except FileNotFoundError as e:
print("No XMLs found")
log("No XMLs found")
xml_list = None
matched_xml = ''

Expand All @@ -105,11 +98,9 @@ def find_xml_by_case(case):
matched_xml = xml.name
break

errata = get_errata(project_name)

header = "AutoPTS Report: " \
"{}".format(datetime.datetime.now().strftime("%Y-%m-%d %H:%M"))
workbook = xlsxwriter.Workbook(REPORT_XLSX)
workbook = xlsxwriter.Workbook(report_xlsx_path)
worksheet = workbook.add_worksheet()
chart = workbook.add_chart({'type': 'pie',
'subtype': 'percent_stacked'})
Expand Down Expand Up @@ -179,14 +170,12 @@ def find_xml_by_case(case):
worksheet.insert_chart('H2', chart)
workbook.close()

return os.path.join(os.getcwd(), REPORT_XLSX)


# ****************************************************************************
# .txt result file
# ****************************************************************************
def make_report_txt(results_dict, regressions_list,
progresses_list, repo_status, project_name=''):
def make_report_txt(report_txt_path, results_dict, regressions_list,
progresses_list, repo_status, errata):
"""Creates txt file containing test cases results
:param results_dict: dictionary with test cases results
:param regressions_list: list of regressions found
Expand All @@ -196,10 +185,7 @@ def make_report_txt(results_dict, regressions_list,
:return: txt file path
"""

filename = os.path.join(os.getcwd(), REPORT_TXT)
f = open(filename, "w")

errata = get_errata(project_name)
f = open(report_txt_path, "w")

f.write(f"{repo_status}, autopts={get_autopts_version()}\n")
for tc, result in list(results_dict.items()):
Expand All @@ -217,68 +203,12 @@ def make_report_txt(results_dict, regressions_list,
if tc in errata:
result += ' - ERRATA ' + errata[tc]

# The first id in the test case is test group
# The first id in the test case is a test group
tg = tc.split('/')[0]
f.write("%s%s%s\n" % (tg.ljust(8, ' '), tc.ljust(32, ' '), result))

f.close()

return filename


# ****************************************************************************
# autopts_report result folder
# ****************************************************************************
def make_report_folder(iut_logs, pts_logs, xmls, report_xlsx, report_txt,
report_diff_txt, readme_file, database_file, tag=''):
"""Creates folder containing .txt and .xlsx reports, pulled logs
from autoptsserver, iut logs and additional README.md.
"""

def get_deepest_dirs(logs_tree, dst_tree, max_depth):
def recursive(directory, depth=3):
depth -= 1

for file in os.scandir(directory):
if file.is_dir():
if depth > 0:
recursive(file.path, depth)
else:
dst_file = os.path.join(dst_tree, file.name)
try:
shutil.move(file.path, dst_file)
except: # skip waiting for BPV to release the file
try:
shutil.copy(file.path, dst_file)
except:
pass

recursive(logs_tree, max_depth)

report_dir = 'tmp/autopts_report'
shutil.rmtree(report_dir, ignore_errors=True)
Path(report_dir).mkdir(parents=True, exist_ok=True)

shutil.copy(report_diff_txt, os.path.join(report_dir, 'report-diff.txt'))
shutil.copy(report_txt, os.path.join(report_dir, 'report.txt'))
shutil.copy(report_txt, os.path.join(report_dir, 'report{}.txt'.format(tag)))
shutil.copy(report_xlsx, os.path.join(report_dir, 'report{}.xlsx'.format(tag)))
shutil.copy(readme_file, os.path.join(report_dir, 'README.md'))
shutil.copy(database_file, os.path.join(report_dir, os.path.basename(database_file)))

iut_logs_new = os.path.join(report_dir, 'iut_logs')
pts_logs_new = os.path.join(report_dir, 'pts_logs')
xmls_new = os.path.join(report_dir, 'XMLs/')

get_deepest_dirs(iut_logs, iut_logs_new, 3)
get_deepest_dirs(pts_logs, pts_logs_new, 3)
try:
shutil.move(xmls, xmls_new)
except FileNotFoundError:
print('XMLs directory doesn\'t exist')

return os.path.join(os.getcwd(), report_dir)


def report_parse_test_cases(report):
if not os.path.exists(report):
Expand All @@ -300,15 +230,9 @@ def report_parse_test_cases(report):
return test_cases[1:]


def make_report_diff(log_git_conf, results, regressions,
progresses, new_cases):
old_report_txt = os.path.join(log_git_conf['path'],
log_git_conf['subdir'],
'autopts_report',
REPORT_TXT)

filename = os.path.join(os.getcwd(), REPORT_DIFF_TXT)
f = open(filename, "w")
def make_report_diff(old_report_txt, report_diff_txt_path, results,
regressions, progresses, new_cases):
f = open(report_diff_txt_path, "w")

deleted_cases = []
old_test_cases = []
Expand Down Expand Up @@ -339,12 +263,11 @@ def make_report_diff(log_git_conf, results, regressions,

f.close()

return filename, deleted_cases
return deleted_cases


def make_error_txt(msg):
filename = os.path.join(os.getcwd(), ERROR_TXT)
with open(filename, "w") as f:
def make_error_txt(msg, error_txt_path):
with open(error_txt_path, "w") as f:
f.write(msg)


Expand Down Expand Up @@ -419,7 +342,7 @@ def split_xml_filename(file_path):
return test_name, timestamp


def pull_server_logs(args):
def pull_server_logs(args, tmp_dir, xml_folder):
"""Copy Bluetooth Protocol Viewer logs from auto-pts servers.
:param args: args
"""
Expand All @@ -432,8 +355,7 @@ def pull_server_logs(args):
else:
workspace_dir = workspace_name

logs_folder = 'tmp/' + workspace_name
xml_folder = 'tmp/XMLs'
logs_folder = os.path.join(tmp_dir, workspace_name)
shutil.rmtree(logs_folder, ignore_errors=True)
shutil.rmtree(xml_folder, ignore_errors=True)
Path(xml_folder).mkdir(parents=True, exist_ok=True)
Expand Down
Loading
Loading