Commit 0333a528 authored by Robert Schmidt's avatar Robert Schmidt

Simplify physim1 python class

parent 8b0d8661
...@@ -57,7 +57,6 @@ class PhySim: ...@@ -57,7 +57,6 @@ class PhySim:
self.ranAllowMerge= False self.ranAllowMerge= False
self.ranTargetBranch= "" self.ranTargetBranch= ""
self.testResult = {} self.testResult = {}
self.testCount = [0,0,0]
self.testSummary = {} self.testSummary = {}
self.testStatus = False self.testStatus = False
...@@ -152,7 +151,7 @@ class PhySim: ...@@ -152,7 +151,7 @@ class PhySim:
isFinished1 = True isFinished1 = True
mySSH.command('oc logout', '\$', 30) mySSH.command('oc logout', '\$', 30)
mySSH.close() mySSH.close()
self.AnalyzeLogFile_phySim(HTML) self.AnalyzeLogFile_phySim()
RAN.prematureExit = True RAN.prematureExit = True
return return
else: else:
...@@ -171,7 +170,7 @@ class PhySim: ...@@ -171,7 +170,7 @@ class PhySim:
logging.error('\u001B[1m Some PODS Running FAILED \u001B[0m') logging.error('\u001B[1m Some PODS Running FAILED \u001B[0m')
mySSH.command('oc get pods -l app.kubernetes.io/instance=physim 2>&1 | tee -a cmake_targets/log/physim_pods_summary.txt', '\$', 6) mySSH.command('oc get pods -l app.kubernetes.io/instance=physim 2>&1 | tee -a cmake_targets/log/physim_pods_summary.txt', '\$', 6)
mySSH.command('helm uninstall physim 2>&1 >> cmake_targets/log/physim_helm_summary.txt', '\$', 6) mySSH.command('helm uninstall physim 2>&1 >> cmake_targets/log/physim_helm_summary.txt', '\$', 6)
self.AnalyzeLogFile_phySim(HTML) self.AnalyzeLogFile_phySim()
isFinished1 = False isFinished1 = False
while(isFinished1 == False): while(isFinished1 == False):
time.sleep(20) time.sleep(20)
...@@ -237,7 +236,7 @@ class PhySim: ...@@ -237,7 +236,7 @@ class PhySim:
logging.debug('\u001B[1m UnDeployed PhySim Successfully on OC Cluster\u001B[0m') logging.debug('\u001B[1m UnDeployed PhySim Successfully on OC Cluster\u001B[0m')
mySSH.command('oc logout', '\$', 6) mySSH.command('oc logout', '\$', 6)
mySSH.close() mySSH.close()
self.AnalyzeLogFile_phySim(HTML) self.AnalyzeLogFile_phySim()
if self.testStatus and isFinished: if self.testStatus and isFinished:
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult) HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult)
...@@ -251,7 +250,7 @@ class PhySim: ...@@ -251,7 +250,7 @@ class PhySim:
HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult) HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult)
logging.error('\u001B[1m Physical Simulator Fail\u001B[0m') logging.error('\u001B[1m Physical Simulator Fail\u001B[0m')
def AnalyzeLogFile_phySim(self, HTML): def AnalyzeLogFile_phySim(self):
lIpAddr = self.eNBIPAddress lIpAddr = self.eNBIPAddress
lUserName = self.eNBUserName lUserName = self.eNBUserName
lPassWord = self.eNBPassword lPassWord = self.eNBPassword
...@@ -270,31 +269,28 @@ class PhySim: ...@@ -270,31 +269,28 @@ class PhySim:
mySSH.close() mySSH.close()
# physim test log analysis # physim test log analysis
nextt = 0 nextt = 0
nbTests = 0
nbFailed = 0
if (os.path.isfile(f'./physim_test_logs_{self.testCase_id}/physim_test.txt')): if (os.path.isfile(f'./physim_test_logs_{self.testCase_id}/physim_test.txt')):
with open(f'./physim_test_logs_{self.testCase_id}/physim_test.txt', 'r') as logfile: with open(f'./physim_test_logs_{self.testCase_id}/physim_test.txt', 'r') as logfile:
for line in logfile: for line in logfile:
if re.search('execution 015', str(line)) or re.search('Bypassing compilation', str(line)): # the following regex would match the following line:
nextt = 1 # execution nr_pbchsim.106rb.test1 {Test1: PBCH-only, 106 PRB} Run_Result = " Run_1 =PASS Run_2 =PASS Run_3 =PASS" Result = PASS
elif nextt == 1: # ^testname ^testdescription ^test1 ^test2 ^test3 ^status
if not re.search('Test Results', str(line)): ret = re.search('execution +(?P<name>[a-zA-Z0-9\._\-\+]+) +{(?P<desc>[A-Za-z0-9\.\_\-\+:,;\/\%\=\(\) ]+)} *Run_Result *= *\" *Run_1 *= *(?P<run1>[A-Za-z]+) *Run_2 *= *(?P<run2>[A-Za-z]+) *Run_3 *= *(?P<run3>[A-Za-z]+) *\" + Result *= *(?P<status>[A-Za-z]+)', line)
nextt = 0 if ret is None:
ret2 = re.search('T[^\n]*', str(line)) continue
if ret2 is not None: nbTests += 1
ret3 = ret2.group() r = [ret.group('run1'), ret.group('run2'), ret.group('run3')]
ret3 = ret3.replace("", "") nbPass = sum([x == 'PASS' for x in r])
if re.search('execution 015', str(line)): resultstr = 'PASS'
self.testCount[0] += 1 if nbPass < 3 or ret.group('status') != 'PASS':
testName = line.split() resultstr = f'FAIL ({3-nbPass}/3)'
ret1 = re.search('Result = PASS', str(line)) nbFailed += 1
if ret1 is not None: self.testResult[ret.group('name')] = [ret.group('desc'), resultstr]
self.testResult[testName[1]] = [ret3, 'PASS'] self.testSummary['Nbtests'] = nbTests
self.testCount[1] += 1 self.testSummary['Nbpass'] = nbTests - nbFailed
else: self.testSummary['Nbfail'] = nbFailed
self.testResult[testName[1]] = [ret3, 'FAIL']
self.testCount[2] += 1
self.testSummary['Nbtests'] = self.testCount[0]
self.testSummary['Nbpass'] = self.testCount[1]
self.testSummary['Nbfail'] = self.testCount[2]
if self.testSummary['Nbfail'] == 0: if self.testSummary['Nbfail'] == 0:
self.testStatus = True self.testStatus = True
return 0 return 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment