本文整理汇总了Python中task.Task.postaction方法的典型用法代码示例。如果您正苦于以下问题:Python Task.postaction方法的具体用法?Python Task.postaction怎么用?Python Task.postaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类task.Task
的用法示例。
在下文中一共展示了Task.postaction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compile_enb
# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import postaction [as 别名]
def compile_enb(self, build_arguments, log_suffix=""):
log("INFO: ALU test: compile softmodem on " + self.enb_machine)
envcomp = list(self.env)
envcomp.append('BUILD_ARGUMENTS="' + build_arguments + '"')
#we don't care about BUILD_OUTPUT but required (TODO: change that)
envcomp.append('BUILD_OUTPUT=/')
logdir = self.logdir + "/compile_log"
remote_files = "'/tmp/oai_test_setup/oai/cmake_targets/log/*'"
post_action = "mkdir -p "+ logdir + \
" && sshpass -p " + self.oai_password + \
" scp -r " + self.oai_user + \
"@" + self.enb_machine + ":" + remote_files + " " + logdir + \
" || true"
task = Task("actions/compilation.bash",
"compile_softmodem",
self.enb_machine,
self.oai_user,
self.oai_password,
envcomp,
self.logdir + "/compile_softmodem." + log_suffix + \
self.enb_machine,
post_action=post_action)
ret = task.wait()
if ret != 0:
log("ERROR: softmodem compilation failure");
raise TestFailed()
task.postaction()
示例2: run
# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import postaction [as 别名]
def run(self):
id = self.id
machine = self.machine
test = self.test
# step 1: compile
log("INFO: start compilation of test " + id + " on machine " +
machine.name)
tasks = []
runenv = list(env)
runenv.append('OPENAIR_DIR=/tmp/oai_test_setup/oai')
runenv.append('PRE_BUILD="'
+ test.findtext('pre_compile_prog')
+ '"')
runenv.append('BUILD_PROG="'
+ test.findtext('compile_prog')
+ '"')
runenv.append('BUILD_ARGUMENTS="'
+ test.findtext('compile_prog_args')
+ '"')
runenv.append('PRE_EXEC="'
+ test.findtext('pre_exec') + " "
+ test.findtext('pre_exec_args')
+ '"')
logdir = openair_dir +"/cmake_targets/autotests/log/"+ id + \
"/compile_log"
remote_files = "'/tmp/oai_test_setup/oai/cmake_targets/log/*'"
post_action = "mkdir -p "+ logdir + \
" && sshpass -p " + oai_password + \
" scp -r " + oai_user + "@" + machine.name + ":" + \
remote_files + " " + logdir + \
" || true"
task = Task("actions/execution_compile.bash",
"compilation of test " + id + " on " + machine.name,
machine.name,
oai_user,
oai_password,
runenv,
openair_dir + "/cmake_targets/autotests/log/"
+ id + "_compile."
+ machine.name,
post_action=post_action)
ret = task.wait()
task.postaction()
if ret != 0:
log("ERROR: compilation of test " + id + " failed: " + str(ret))
machine.unbusy()
return
#step 2: run all tests
nruns = test.findtext('nruns')
args = test.findtext('main_exec_args')
i = 0
for arg in args.splitlines():
i = i+1
runenv2 = list(runenv)
runenv2.append('OPENAIR_TARGETS=/tmp/oai_test_setup/oai/targets')
runenv2.append('EXEC="'
+ test.findtext('main_exec')
+ '"')
runenv2.append('EXEC_ARGS="' + arg + '"')
for run in range(int(nruns)):
log("INFO: start execution of test " + id + " case " +
str(i) + " run " + str(run) + " on machine " +
machine.name)
task =Task("actions/execution.bash",
"execution of test " + id + " on " + machine.name,
machine.name,
oai_user,
oai_password,
runenv2,
openair_dir + "/cmake_targets/autotests/log/"
+ id + "_case_" + str(i) + "_run_" + str(run)
+ "." + machine.name)
ret = task.wait()
if ret != 0:
log("ERROR: execution of test " +id+ " failed: " +
str(ret))
machine.unbusy()