import subprocess from plugins.agl_test_conf import REPORT_LOGS_DIR from plugins.agl_test_conf import TMP_LOGS_DIR from plugins.agl_test_conf import TMP_TEST_REPORT #Check if there is the command that we needed def find_cmd(cmd): output = subprocess.run(['which',cmd],stdout=subprocess.PIPE) if output.returncode==0: return 0 else: print("error: {} is not found".format(cmd)) return 1 #Make dir for THIS_TEST to save the log def create_dir(THIS_TEST): TMP_THIS_TEST_LOG = TMP_LOGS_DIR + THIS_TEST + "/log/" TMP_TEST_REPORT_THIS = TMP_TEST_REPORT + THIS_TEST subprocess.run(['mkdir','-p',TMP_THIS_TEST_LOG]) subprocess.run(['mkdir','-p',TMP_TEST_REPORT_THIS]) # print errors def printe(msg): print("**** ERROR: " + msg) # print debug info def printd(msg): # TODO print("==== DEBUG: " + msg)