Skip to content

Commit

Permalink
Merge pull request #44 from sdgtt/hdl-ci-support
Browse files Browse the repository at this point in the history
Hdl-TH Integration support
  • Loading branch information
kimpaller authored Nov 18, 2024
2 parents 7ab5187 + a003ac1 commit 5bffec6
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 7 deletions.
40 changes: 34 additions & 6 deletions telemetry/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os

import telemetry.report
from telemetry.report.utility import map_th_to_bp, map_bp_to_th

def validate(field, value, schema):
"""Validate a field and value data type
Expand Down Expand Up @@ -208,8 +209,7 @@ def create_results_gist(server, job_name, build_number, board_name, github_gist_
)

if len(boot_test.keys()) == 0:
raise Exception(f"{job_name} - {build_number} not found")
data = {}
print(f"No boot test data found for {job_name} - {build_number}")
# get artifacts
artifacts_info_txt=tel.artifacts(
target_board=None,
Expand All @@ -218,15 +218,30 @@ def create_results_gist(server, job_name, build_number, board_name, github_gist_
artifact_info_type = "info_txt",
)
built_projects = list()
translated_built_projects = list()
data = {}
translated_data = {}
for artifact in artifacts_info_txt:
if artifact["payload"] == "Built projects":
built_projects.append(artifact["payload_param"])


# translate first to test harness board naming scheme
for board in built_projects:
translated = map_bp_to_th(board)
if translated:
if type(translated) == list:
for variant in translated:
if variant not in translated_built_projects:
translated_built_projects.append(variant)
else:
translated_built_projects.append(translated)
else:
translated_built_projects.append(board)

for board in translated_built_projects:
if not board in boot_test.keys():
data[board] = "NA"
else:
bn = board
info = boot_test[board]
artifacts = tel.artifacts(board, job_name, build_number)
artifact_types = ["enumerated_devs", "missing_devs", "dmesg_err", "pytest_failure"]
Expand All @@ -245,9 +260,22 @@ def create_results_gist(server, job_name, build_number, board_name, github_gist_
continue
info[0]["info_txt"].update({artifact["payload"]:artifact["payload_param"]})

data[bn] = info[0]

info[0]["variance_info"] = board.split("-v")[1] if len(board.split("-v")) == 2 else None
data[board] = info[0]

# translate back to boot partition naming scheme
for bn, details in data.items():
translated = map_th_to_bp(bn)
if translated:
board_name = translated
else:
board_name = bn
if board_name in translated_data:
board_name += f" ({details['variance_info']})"
translated_data.update({board_name: details})

m = telemetry.markdown.ResultsMarkdown(data)
m = telemetry.markdown.ResultsMarkdown(translated_data)
m.generate_gist(github_gist_url, github_gist_token)

@click.command()
Expand Down
9 changes: 8 additions & 1 deletion telemetry/report/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,25 @@ def generate_param(self,data):
elif int(info["drivers_missing"])>0 or\
int(info["dmesg_errors_found"])>0 or\
int(info["pytest_errors"])>0 or\
int(info["pytest_failures"])>0:
int(info["pytest_failures"])>0 or\
(int(info["pytest_skipped"])==0 and int(info["pytest_tests"]==0)):
test_build_status = "UNSTABLE"
elif str(info["last_failing_stage"]) == "NA":
test_build_status = "PASSING"
else:
test_build_status = "INVALID"

# update test stage status
uboot_reached_status = "✔" if bool(info["uboot_reached"]) else "❌"
linux_prompt_reached_status = "✔" if bool(info["linux_prompt_reached"]) else "❌"
drivers_enumerated_status = "✔" if int(info["drivers_missing"]) == 0 and test_build_status != "FAILURE" else "❌"
dmesg_status = "✔" if int(info["dmesg_errors_found"]) == 0 and test_build_status != "FAILURE" else "❌"
pytest_tests_status = "✔" if int(info["pytest_failures"]) == 0 and test_build_status != "FAILURE" else "❌"

# added validations
pytest_tests_status = "⛔" if int(info["pytest_skipped"]) == 0 and int(info["pytest_tests"]) == 0 else pytest_tests_status

# update test stage details
if test_build_status == "FAILURE":
iio_drivers_missing_details = "No Details"
iio_drivers_found_details = "No Details"
Expand All @@ -69,6 +75,7 @@ def generate_param(self,data):
iio_drivers_found_details = "No iio drivers found" if len(info["enumerated_devs"]) == 0 else ("<br>").join(info["enumerated_devs"])
dmesg_errors_found_details = "No errors" if len(info["dmesg_err"]) == 0 else ("<br>").join(info["dmesg_err"])
pytest_failures_details = "No failures" if len(info["pytest_failure"]) == 0 else ("<br>").join(info["pytest_failure"])
pytest_failures_details = "Invalid" if pytest_tests_status == "⛔" else pytest_failures_details

last_failing_stage = str(info["last_failing_stage"])
last_failing_stage_failure = str(info["last_failing_stage_failure"])
Expand Down
37 changes: 37 additions & 0 deletions telemetry/report/utility.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
BOOT_PARTITION_BN_MAP = {
"zynq-adrv9364-z7020-bob-cmos" : "zynq-adrv9364-z7020-bob-vcmos",
"zynq-adrv9364-z7020-bob" : "zynq-adrv9364-z7020-bob-vlvds",
"zynqmp-zcu102-rev10-ad9081-204b-txmode9-rxmode4" : "zynqmp-zcu102-rev10-ad9081-v204b-txmode9-rxmode4",
"zynqmp-zcu102-rev10-ad9081-204c-txmode0-rxmode1" : "zynqmp-zcu102-rev10-ad9081-v204c-txmode0-rxmode1",
"zynqmp-zcu102-rev10-ad9081" : "zynqmp-zcu102-rev10-ad9081-vm4-l8",
"zynqmp-zcu102-rev10-ad9081-m8-l4" : "zynqmp-zcu102-rev10-ad9081-vm8-l4",
"zynq-zed-adv7511-adrv9002-rx2tx2" : "zynq-zed-adv7511-adrv9002-rx2tx2-vcmos",
"zynq-zed-adv7511-adrv9002" : "zynq-zed-adv7511-adrv9002-vcmos",
"zynqmp-zcu102-rev10-adrv9002-rx2tx2" : ["zynqmp-zcu102-rev10-adrv9002-rx2tx2-vcmos","zynqmp-zcu102-rev10-adrv9002-rx2tx2-vlvds"],
"zynqmp-zcu102-rev10-adrv9002" : ["zynqmp-zcu102-rev10-adrv9002-vcmos","zynqmp-zcu102-rev10-adrv9002-vlvds"],
"zynqmp-adrv9009-zu11eg-revb-adrv2crr-fmc-revb-jesd204-fsm":"zynqmp-adrv9009-zu11eg-revb-adrv2crr-fmc-revb",
"zynqmp-adrv9009-zu11eg-revb-adrv2crr-fmc-revb-sync-fmcomms8-jesd204-fsm":"zynqmp-adrv9009-zu11eg-revb-adrv2crr-fmc-revb-vsync-fmcomms8",
}

def map_bp_to_th(bp_bn_name):
'''Maps boot partition board name with the test harness board name'''
match = None
if bp_bn_name in BOOT_PARTITION_BN_MAP.keys():
match = BOOT_PARTITION_BN_MAP[bp_bn_name]
return match

def map_th_to_bp(th_bn_name):
'''Maps test harness board name board name with the boot partition board name'''
boot_partition_bn_th_map = dict()
for bn, thbn in BOOT_PARTITION_BN_MAP.items():
if type(thbn) == list:
for thbnv in thbn:
boot_partition_bn_th_map.update({thbnv:bn})
else:
boot_partition_bn_th_map.update({thbn:bn})

match = None
if th_bn_name in boot_partition_bn_th_map.keys():
match = boot_partition_bn_th_map[th_bn_name]
return match

0 comments on commit 5bffec6

Please sign in to comment.