Ulrich Carmesin
3 years ago
4 changed files with 268 additions and 12 deletions
@ -0,0 +1,59 @@ |
|||
import basic.program |
|||
import basic.constants as B |
|||
import components.component |
|||
|
|||
DEFAULT_GRAN = "tc" |
|||
DEFAULT_APP = "TEST" |
|||
DEFAULT_ENV = "ENV01" |
|||
DEFAULT_DIR = "/home/ulrich/6_Projekte/Programme/datest/test/conf/lauf" |
|||
DEFAULT_TIME = "2022-03-19_12-09-09" |
|||
DEFAULT_MODE = "unit" |
|||
gran = "" |
|||
app = "" |
|||
env = "" |
|||
tstamp = "" |
|||
mode = "" |
|||
path = "" |
|||
|
|||
def getJob(pgran="", papp="", penv="", ptstamp="", pmode=""): |
|||
job = basic.program.Job.popInstance() |
|||
if not job is None: |
|||
job.stopJob() |
|||
if len(pgran) < 1: |
|||
gran = DEFAULT_GRAN |
|||
else: |
|||
gran = pgran |
|||
if len(papp) < 1: |
|||
app = DEFAULT_APP |
|||
else: |
|||
app = papp |
|||
if len(penv) < 1: |
|||
env = DEFAULT_ENV |
|||
else: |
|||
env = penv |
|||
if len(ptstamp) < 1: |
|||
tstamp = DEFAULT_TIME |
|||
else: |
|||
tstamp = ptstamp |
|||
if len(pmode) < 1: |
|||
mode = DEFAULT_MODE |
|||
else: |
|||
mode = pmode |
|||
if gran == "tc": |
|||
path = DEFAULT_DIR+"/TC0001/"+tstamp |
|||
elif gran == "ts": |
|||
path = DEFAULT_DIR + "/testlauf/TST001_" + tstamp |
|||
job = basic.program.Job("unit") |
|||
args = {"application": app, "environment": env, "modus": mode, gran+"time": tstamp, |
|||
gran+"dir": path, |
|||
"step": 2} |
|||
# "usecase": "TST001", "tstime": "2022-03-17_17-28"} |
|||
job.par.setParameterArgs(args) |
|||
return job |
|||
|
|||
|
|||
def getComp(): |
|||
comp = components.component.Component() |
|||
comp.conf = {} |
|||
comp.name = "testcomp" |
|||
pass |
@ -0,0 +1,39 @@ |
|||
import utils.config_tool |
|||
import utils.file_tool |
|||
import basic.program |
|||
|
|||
|
|||
def importEnvProperty(): |
|||
job = basic.program.Job.getInstance() |
|||
path = utils.config_tool.getConfig("tool", "env") |
|||
props = utils.file_tool.readFileDict(path, job.m) |
|||
job.conf.confs["env"] = props["prop"] |
|||
|
|||
|
|||
def exportEnvProperty(): |
|||
job = basic.program.Job.getInstance() |
|||
props = {} |
|||
if not hasattr(job, "conf"): return |
|||
if not hasattr(job.conf, "confs"): return |
|||
if not "env" in job.confconfs: return |
|||
props["prop"] = job.conf.confs["env"] |
|||
path = utils.config_tool.getConfig("tool", "env") |
|||
utils.file_tool.writeFileDict(job.m, path, props) |
|||
|
|||
|
|||
def setEnvProp(props): |
|||
job = basic.program.Job.getInstance() |
|||
path = utils.config_tool.getConfig("tool", "env") |
|||
utils.file_tool.writeFileDict(job.m, path, props) |
|||
|
|||
|
|||
def getEnvProperty(propname): |
|||
job = basic.program.Job.getInstance() |
|||
if "env" not in job.conf.confs: |
|||
importEnvProperty() |
|||
prop = job.conf.confs[propname] |
|||
if (prop["type"] == "succ"): |
|||
val = prop["value"] |
|||
val += 1 |
|||
prop["value"] = val |
|||
return val |
@ -0,0 +1,70 @@ |
|||
import basic.constants as B |
|||
# ------------------------------------------------------------- |
|||
# values and keywords |
|||
KEY_PRECOND = "precond" |
|||
KEY_POSTCOND = "postcond" |
|||
KEY_RESULT = "result" |
|||
KEY_ORIGIN = "origin" |
|||
KEY_PARTS = "parts" |
|||
KEY_SUMFILE = "sumfile" |
|||
KEY_BACKUP = "backup" |
|||
KEY_REFFILE = "reffile" |
|||
KEY_TESTCASE = "tc" |
|||
KEY_TESTSUITE = "ts" |
|||
KEY_DEBUGNAME = "debugname" |
|||
KEY_LOGNAME = "logname" |
|||
|
|||
# ------------------------------------------------------------- |
|||
# parameter with arguments |
|||
PAR_APP = "job.par." + B.PAR_APP |
|||
PAR_ENV = "job.par." + B.PAR_ENV |
|||
PAR_REL = "job.par." + B.PAR_REL |
|||
PAR_TSDIR = "job.par." + B.PAR_TSDIR |
|||
PAR_TCDIR = "job.par." + B.PAR_TCDIR |
|||
PAR_XPDIR = "job.par." + B.PAR_XPDIR |
|||
PAR_TDTYP = "job.par." + B.PAR_TDTYP |
|||
PAR_TDSRC = "job.par." + B.PAR_TDSRC |
|||
PAR_TDNAME = "job.par." + B.PAR_TDNAME |
|||
PAR_LOG = "job.par." + B.PAR_LOG |
|||
PAR_MODUS = "job.par." + B.PAR_MODUS |
|||
PAR_COMP = "job.par." + B.PAR_COMP |
|||
PAR_FCT = "job.par." + B.PAR_FCT |
|||
PAR_TOOL = "job.par." + B.PAR_TOOL |
|||
PAR_STEP = "job.par." + B.PAR_STEP |
|||
PAR_DESCRIPT = "job.par." + B.PAR_DESCRIPT |
|||
PAR_TESTCASE = "job.par." + B.PAR_TESTCASE |
|||
PAR_TESTCASES = "job.par." + B.PAR_TESTCASES |
|||
PAR_TESTSUITE = "job.par." + B.PAR_TESTSUITE |
|||
PAR_TCTIME = "job.par." + B.PAR_TCTIME |
|||
PAR_TSTIME = "job.par." + B.PAR_TSTIME |
|||
PAR_TESTINSTANCES = "job.par." + B.PAR_TESTINSTANCES |
|||
|
|||
# ------------------------------------------------------------- |
|||
# attributes |
|||
|
|||
# ------------------------------------------------------------- |
|||
# structure - nodes |
|||
P_DEBUGS = "debugs" |
|||
P_ENVBASE = "envbase" |
|||
P_ENVLOG = "envlog" |
|||
P_ENVPARFILE = "envparfile" |
|||
P_TCBASE = "tcbase" |
|||
P_TCLOG = "tclog" |
|||
P_TCRESULT = "tcresult" |
|||
P_TCPARFILE = "tcparfile" |
|||
P_TCDIFF = "tcdiff" |
|||
P_TCPREDIFF = "tcprediff" |
|||
P_TCRUNDIFF = "tcrundiff" |
|||
P_TCPRECOND = "tcprecond" |
|||
P_TCPOSTCOND = "tcpostcond" |
|||
P_TSBASE = "tsbase" |
|||
P_TSLOG = "tslog" |
|||
P_TSPARFILE = "tsparfile" |
|||
P_TSSUM = "tssum" |
|||
P_XPBASE = "xpbase" |
|||
P_XPRESULT = "xpresult" |
|||
P_XPBACKUP = "xpbackup" |
|||
|
|||
# ------------------------------------------------------------- |
|||
# exception texts |
|||
EXP_COMP_MISSING = "Component is missing for {}" |
Loading…
Reference in new issue