diff options
author | Hector Fernandez <hector@iatec.biz> | 2020-04-16 17:09:19 +0200 |
---|---|---|
committer | Hector Fernandez <hector@iatec.biz> | 2020-04-16 17:09:19 +0200 |
commit | 6a680137694233008005415e22cf889b85baa292 (patch) | |
tree | b0b1c68dab8a76383e18c4d16f231f6171524ea2 /test-cli/test_main.py | |
parent | 9f613e33f27f772682ab7d7bd2261a9c4bd014c5 (diff) | |
download | board-6a680137694233008005415e22cf889b85baa292.zip board-6a680137694233008005415e22cf889b85baa292.tar.gz board-6a680137694233008005415e22cf889b85baa292.tar.bz2 |
First release
Diffstat (limited to 'test-cli/test_main.py')
-rw-r--r-- | test-cli/test_main.py | 35 |
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) |