from datetime import datetime import basic.program import basic.program as program import utils.tdata_tool PROGRAM_NAME = "test_executer" def getTime(): time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") return time def start(job): job.m.setMsg("# # # # # start executer # # # # # ") tdata = utils.tdata_tool.getTestdata() myjob = job for step in tdata["_steps"]: for arg in step["args"]: if arg == "start": if "testsuite" in step["args"][arg]: jobargs = {"application": job.par.application, "environment": job.par.environment, "usecase": job.par.usecase, "tstime": getTime()} job.popInstance() job = basic.program.Job("unit") job.par.setParameterArgs(jobargs) job.setProgram(step["args"][arg]) print("Job initialisiert "+job.program+" in Verzeichnis "+getattr(job.par, "tsdir")) job.stopJob(1) job.popInstance() basic.program.Job.pushInstance(myjob) print("ende") job = myjob if "testcase" in step["args"][arg]: jobargs = {"application": job.par.application, "environment": job.par.environment, "testcase": step["comp"], "tctime": getTime()} job.popInstance() job = basic.program.Job("unit") job.par.setParameterArgs(jobargs) job.setProgram(step["args"][arg]) print("Job initialisiert "+job.program+" in Verzeichnis "+getattr(job.par, "tcdir")) job.stopJob(1) job.popInstance() basic.program.Job.pushInstance(myjob) print("ende") job = myjob if __name__ == '__main__': print(PROGRAM_NAME) x = program.Job(PROGRAM_NAME) #m = message.Message(3) #m.closeMessage() x.startJob() x.m.logInfo("hier eine LogInfo") x.m.logDebug("hier eine DbugMeldung") x.m.logDebug(str(vars(x.par)) + "\n" + str(vars(x.conf))) if x.m.isRc("fatal"): x.stopJob() exit(x.m.rc * (-1) + 3) start(x) x.stopJob()