summaryrefslogtreecommitdiffstats
path: root/plugins/agl_test_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/agl_test_utils.py')
-rw-r--r--plugins/agl_test_utils.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/plugins/agl_test_utils.py b/plugins/agl_test_utils.py
new file mode 100644
index 0000000..b1204a0
--- /dev/null
+++ b/plugins/agl_test_utils.py
@@ -0,0 +1,31 @@
+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)