def execute(self, *args, **kwargs): masterTbl = MasterTbl() target = masterTbl['target'] epoch = masterTbl['origEpoch'] prefix = "" if (target != "") : prefix = target + '-' uuid = prefix + full_date_string(epoch) + '-' + masterTbl['os_mach'] tst_report_fn = os.path.join(masterTbl['testReportDir'], uuid + masterTbl['testRptExt']) masterTbl['tstReportFn'] = tst_report_fn #-------------------------------------------------------- # Do not create a report when there are no tests to run if (not masterTbl['tstT']): return human_data = '' test_results = build_test_reportT(human_data, masterTbl) dir_name, fn = os.path.split(tst_report_fn) if (not os.path.exists(dir_name)): os.makedirs(dir_name) write_table(tst_report_fn, test_results)
def execute(self, *args, **kwargs): masterTbl = MasterTbl() rows, width = getTerminalSize() projectDir = masterTbl['projectDir'] rptT = masterTbl['rptT'] humanDataA = [] tstSummaryT = masterTbl['tstSummaryT'] totalTime = time.strftime("%T", time.gmtime(masterTbl['totalTestTime'])) totalTime += ("%.2f" % (masterTbl['totalTestTime'] - int(masterTbl['totalTestTime'])))[1:] testresultT = Tst.test_result_values() tstSummaryT = masterTbl['tstSummaryT'] HDR = "*"*width TR = "*** Test Results" TS = "*** Test Summary" TRl = width - len(TR) - 3 TR = TR + " "*TRl + "***" TS = TS + " "*TRl + "***" humanDataA.append(0) humanDataA.append(HDR) humanDataA.append(TR) humanDataA.append(HDR) humanDataA.append(" ") humanDataA.append(0) humanDataA.append(2) humanDataA.append(["Date:", masterTbl['date']]) humanDataA.append(["TARGET:", masterTbl['target']]) humanDataA.append(["Themis Version:", masterTbl['ThemisVersion']]) humanDataA.append(["Total Test Time:", totalTime]) humanDataA.append(-2) humanDataA.append(0) humanDataA.append(HDR) humanDataA.append(TS) humanDataA.append(HDR) humanDataA.append(" ") humanDataA.append(0) humanDataA.append(2) humanDataA.append(["Total: ", tstSummaryT['total']]) for k in tstSummaryT: count = tstSummaryT[k] if (k != "total" and count > 0): humanDataA.append([k+":", count]) humanDataA.append(-2) humanDataA.append(0) humanDataA.append(" ") humanDataA.append(0) humanDataA.append(5) humanDataA.append(["*******","*","****","*********","***************"]) humanDataA.append(["Results","R","Time","Test Name","version/message"]) humanDataA.append(["*******","*","****","*********","***************"]) resultA = [] for ident in rptT: tst = rptT[ident] aFlag = " " if (tst.get("active")): aFlag = "R" result = tst.get('result') runtime = tst.get('strRuntime') rIdx = str(10 - testresultT.get(result,0)) + "_" + ident txt = " " if (result in testresultT): resultA.append((rIdx, result, aFlag, runtime, ident, txt)) resultA = sorted(resultA, key = lambda result: result[0]) for v in resultA: humanDataA.append(v[1:]) humanDataA.append(-5) humanDataA.append(0) humanDataA.append(" ") humanDataA.append(0) if(tstSummaryT['total'] != tstSummaryT['passed']): humanDataA.append(2) humanDataA.append(["*******", "****************"]) humanDataA.append(["Results", "Output Directory"]) humanDataA.append(["*******", "****************"]) resultA = [] for ident in rptT: tst = rptT[ident] result = tst.get('result') if (result != "passed" and result in testresultT): resultA.append((result, fullFn(projectDir, tst.get('outputDir')))) resultA = sorted(resultA, key = lambda result: result[0] + "-" + result[1]) for v in resultA: humanDataA.append(v) humanDataA.append(-2) humanData = self.format_human_data(humanDataA) if (tstSummaryT['total'] > 0): print(humanData) testreportT = build_test_reportT(humanData, masterTbl) write_table(masterTbl['tstReportFn'], testreportT)