def test_run(self, target, barcode, kernel, rootfs, test, task_id): """@todo: Docstring for test_run :arg1: @todo :returns: @todo """ cmd,timeout,test_case=( test['cmd'], test['timeout'], test['test_case'] ) try: _, out = target.run(cmd, timeout=20) except Exception as e: raise out = "we hit an exception, reboot the target" target.vlm.unreserve_target() target = Target(barcode, kernel, rootfs) target.login(deploy=False) finally: log_dir='logs/{}_{}'.format(barcode,task_id) if not os.path.exists(log_dir): os.makedirs(log_dir) log_file = "{}.log".format(test_case) log=os.path.join(log_dir,log_file) log = Logging(log) log(out) return out
def task_run(self, barcode, kernel, rootfs, plan, task_id): """@todo: Docstring for task_run :returns: @todo """ target = Target(barcode, kernel, rootfs) target.login(deploy=True) for test in plan: self.test_run(target, barcode, kernel, rootfs, test, task_id) target.vlm.unreserve_target()