summaryrefslogtreecommitdiff
path: root/test-cli/test_main.py
diff options
context:
space:
mode:
Diffstat (limited to 'test-cli/test_main.py')
-rw-r--r--test-cli/test_main.py35
1 files changed, 18 insertions, 17 deletions
diff --git a/test-cli/test_main.py b/test-cli/test_main.py
index 8798cb3..23250ca 100644
--- a/test-cli/test_main.py
+++ b/test-cli/test_main.py
@@ -31,6 +31,7 @@ from test.helpers.qrreader import QRReader
psdbObj = TestSrv_Database()
xmlObj = None
loggerObj = None
+test_abspath = None
# define clear function
@@ -136,34 +137,32 @@ def main():
loggerObj.getlogger().info("Tests running")
testresult = runner.run(create_testsuite())
# execute aditional tasks, only if the test was succesfull
- # if testresult.wasSuccessful():
- if True:
+ if testresult.wasSuccessful():
loggerObj.getlogger().info("Extra tasks running")
# create task control
globalVar.taskid_ctl = psdbObj.open_task(globalVar.g_uuid)
# get extra variables
varlist = get_taskvars_list(globalVar.g_uuid)
- alltasksok = False;
+ alltasksok = False
# flash eeprom
- # resulteeprom = 0
- # if "eeprompath" in varlist and len(varlist["eeprompath"]) > 0:
- # mac0 = psdbObj.get_board_macaddr(globalVar.g_uuid)
- # resulteeprom, eepromdata = flash_eeprom(varlist["eeprompath"], globalVar.g_uuid, mac0)
- # psdbObj.create_task_result(globalVar.taskid_ctl, "FLASHEEPROM",
- # "TASK_OK" if resulteeprom == 0 else "TASK_FAIL", eepromdata)
+ resulteeprom = 0
+ if "eeprompath" in varlist and len(varlist["eeprompath"]) > 0:
+ mac0 = psdbObj.get_board_macaddr(globalVar.g_uuid)
+ resulteeprom, eepromdata = flash_eeprom(varlist["eeprompath"], globalVar.g_uuid, mac0)
+ psdbObj.create_task_result(globalVar.taskid_ctl, "FLASHEEPROM",
+ "TASK_OK" if resulteeprom == 0 else "TASK_FAIL", eepromdata)
# flash non-volatile memory
- # resultmemory = 0
- # if "image" in varlist and len(varlist["image"]) > 0:
- # resultmemory = flash_memory(varlist["image"])
- # psdbObj.create_task_result(globalVar.taskid_ctl, "FLASHMEMORY",
- # "TASK_OK" if resultmemory == 0 else "TASK_FAIL", varlist["image"])
+ resultmemory = 0
+ if "image" in varlist and len(varlist["image"]) > 0:
+ resultmemory = flash_memory(varlist["image"])
+ psdbObj.create_task_result(globalVar.taskid_ctl, "FLASHMEMORY",
+ "TASK_OK" if resultmemory == 0 else "TASK_FAIL", varlist["image"])
# update status with the result
- # if resulteeprom == 0 and resultmemory == 0:
- if True:
+ if resulteeprom == 0 and resultmemory == 0:
alltasksok = True
psdbObj.update_taskctl_status(globalVar.taskid_ctl, "TASK_BOARD_OK")
else:
@@ -189,6 +188,8 @@ def main():
if __name__ == "__main__":
# Clear the shell screen
clear()
+ test_abspath = os.path.dirname(os.path.abspath(__file__))
+ print(test_abspath)
# create logger
loggerObj = ISEE_Logger(logging.INFO)
@@ -196,7 +197,7 @@ if __name__ == "__main__":
# Try to parse the setup.xml file
try:
- xmlObj = XMLSetup("setup.xml")
+ xmlObj = XMLSetup(os.path.join(test_abspath, "setup.xml"))
except:
print("Error: Cannot parse setup.xml file")
exit(1)