Add unit test phytest analysis

This commit is contained in:
Robert Schmidt
2025-01-29 09:47:34 +01:00
parent e809841aea
commit 65dab3e027
4 changed files with 95 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ directory, i.e., `ci-scripts/`, and run
To run individual unit tests, start them like so:
python tests/analysis.py -v
python tests/build.py -v
python tests/cmd.py -v
python tests/corenetwork.py -v

View File

@@ -0,0 +1,57 @@
import sys
import logging
logging.basicConfig(
level=logging.DEBUG,
stream=sys.stdout,
format="[%(asctime)s] %(levelname)8s: %(message)s"
)
import os
import unittest
import yaml
sys.path.append('./') # to find OAI imports below
import cls_analysis
import cls_oai_html
import constants
class TestAnalysis(unittest.TestCase):
def setUp(self):
self.html = cls_oai_html.HTMLManagement()
self.html.testCaseId = "000000"
self.maxDiff = 10000 # to compare long files below
def test_gnb_phytest(self):
rtsf = "datalog_rt_stats.100.2x2.yaml"
l1f = "tests/analysis/gnb_phytest.success.nrL1.log"
macf = "tests/analysis/gnb_phytest.success.nrMAC.log"
status, s = cls_analysis.Analysis.analyze_rt_stats(rtsf, l1f, macf)
self.assertTrue(status)
self.assertEqual(s['Title'], "Processing Time (us) from datalog_rt_stats.100.2x2.yaml")
self.assertEqual(s['ColNames'], ["Metric", "Average; Max; Count", "Average vs Reference Deviation (Reference Value; Acceptability Deviation Threshold)"])
with open(rtsf, 'r') as f:
rt_stats = yaml.load(f, Loader=yaml.FullLoader)
# check that analyze_rt_stats() picked up all Ref/DeviationThreshold values from yaml file, e.g.
# s['Ref']['L1 Tx processing'] == corresponding value in yaml
# s['DeviationThreshold']['L1 Tx processing'] == corresponding value in yaml
for k, v in rt_stats['Ref'].items():
self.assertEqual(s['Ref'][k], v)
for k, v in rt_stats['DeviationThreshold'].items():
self.assertEqual(s['DeviationThreshold'][k], v)
for k, v in s['Ref'].items():
self.assertEqual(v, rt_stats['Ref'][k])
for k, v in s['DeviationThreshold'].items():
self.assertEqual(v, rt_stats['DeviationThreshold'][k])
self.assertEqual(s['Data']['L1 Tx processing'], ['476', '872', '102933', '1.00'])
self.assertEqual(s['Data']['DLSCH encoding'], ['216', '544', '77201', '1.08'])
self.assertEqual(s['Data']['L1 Rx processing'], ['488', '868', '38598', '0.92'])
self.assertEqual(s['Data']['UL Indication'], ['1', '10', '38598', '0.76'])
self.assertEqual(s['Data']['Slot Indication'], ['18', '94', '128667', '1.38'])
self.assertEqual(s['Data']['PUSCH inner-receiver'], ['307', '530', '25730', '0.85'])
self.assertEqual(s['Data']['feprx'], ['169', '310', '38600', '1.12'])
self.assertEqual(s['Data']['feptx_ofdm (per port, half_slot)'], ['56', '88', '102933', '0.98'])
self.assertEqual(s['Data']['feptx_total'], ['148', '299', '102933', '1.00'])
# TODO this one is not found, the CI does not recover this??
#self.assertEqual(s['Data']['DL & UL scheduling timing'], ['17', '97', '159371', '1.14'])
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,37 @@
Blacklisted PRBs 0/273
-5.-6.-4.-4.-4.-6.-6.-6.-8.-6.-6.-4.-4.-4.-3.-6.-6.-11.-8.-8.-5.-4.-5.-4.-5.
-6.-11.-11.-8.-8.-5.-5.-4.-4.-6.-8.-11.-11.-8.-8.-6.-5.-6.-6.-8.-11.-11.-11.-8.-6.
-6.-6.-6.-11.-11.-11.-11.-11.-11.-6.-6.-6.-8.-3.-11.-11.-11.-8.-8.-6.-6.-6.-11.-11.-11.
-11.-8.-6.-5.-6.-6.-8.-11.-11.-11.-6.-6.-5.-4.-4.-5.-8.-8.-8.-6.-5.-4.-3.-3.-4.
-4.-6.-6.-5.-3.-3.-2.-2.-2.-3.-3.-4.-5.-5.-3.-2.-1.-1.-2.-5.-4.-4.-4.-3.-2.
0.-1.-1.-1.-2.-2.-3.-2.-1. 0. 2.-11.13. 8. 7. 6. 5. 0. 0.-1. 0. 0. 0.-1.-3.
-3.-3.-3.-1.-1.-1.-1.-1.-1.-2.-3.-1.-1.-1.-1.-2.-1.-3.-4.-5.-8.-6.-3.-3.-3.
-3.-3.-5.-8.-8.-8.-6.-4.-4.-3.-4.-6.-6.-8.-8.-8.-6.-5.-6.-5.-6.-8.-11.-11.-11.
-8.-5.-5.-8.-6.-6.-8.-11.-11.-11.-8.-6.-6.-6.-8.-11.-11.-11.-8.-8.-6.-6.-5.-5.-8.
-11.-11.-8.-11.-6.-5.-5.-5.-5.-6.-11.-11.-8.-6.-3.-4.-5.-5.-6.-8.-6.-6.-5.-4.-4.
-4.-5.-6.-6.-11.-8.-6.-4.-3.-4.-3.-4.-5.-6.-8.-6.-5.-4.-3.-4.-3.-6.-5.
max_IO = 24 (137), min_I0 = 0 (17), avg_I0 = 11 dB(8.8.)
PRACH I0 = 0.0 dB
DLSCH RNTI 1234: current_Qm 6, current_RI 2, total_bytes TX -1130807110
ULSCH RNTI 1234, 389: ulsch_power[0] 41,5 ulsch_noise_power[0] 7.8, sync_pos 0
ulsch_power[1] 26.7, ulsch_noise_power[1] 7.8
round_trials 6434(1.0e+00):6432(1.0e+00):6432(1.0e+00):6432, DTX 0, current_Qm 6, current_RI 1, total_bytes RX/SCHED 0/385630560
L1 Tx job: 401.013 us; 128667; 895.809 us;
L1 Rx job: 183.883 us; 128667; 980.814 us;
L1 Tx processing: 476.247 us; 102933; 872.099 us;
DLSCH encoding: 216.371 us; 77201; 544.272 us;
DLSCH scrambling: 5.524 us; 77201; 19.192 us;
DLSCH modulation: 21.137 us; 77201; 36.428 us;
DLSCH resource mapping: 1.127 us; 1003613; 12.027 us;
DLSCH precoding: 3.667 us; 1003613; 17.411 us;
L1 Rx processing: 488.478 us; 38598; 867.672 us;
UL segment deinterleaving: 5.063 us; 488870; 27.005 us;
UL segment rate recovery: 11.554 us; 488870; 517.998 us;
UL segments decoding: 134.035 us; 488870; 759.164 us;
UL Indication: 0.763 us; 38598; 9.588 us;
Slot Indication: 17.891 us; 128667; 94.446 us;
PUSCH inner-receiver: 307.193 us; 25730; 529.580 us;
feprx: 169.305 us; 38600; 310.489 us;
feptx_ofdm (per port, half_slot): 56.093 us; 102933; 88.125 us;
feptx_total: 147.889 us; 102933; 299.307 us;