diff options
author | Hector Fernandez <hector@iatec.biz> | 2020-07-07 17:27:33 +0200 |
---|---|---|
committer | Hector Fernandez <hector@iatec.biz> | 2020-07-07 17:27:33 +0200 |
commit | 907b96801230e04d02575a3732a73e452089637b (patch) | |
tree | 361ef65c4845ac34954cbdd6082dc38aefcda282 /test-cli/test_main.py | |
parent | a0b900477098a435b5e434512c491f6bf0365b80 (diff) | |
download | board-907b96801230e04d02575a3732a73e452089637b.zip board-907b96801230e04d02575a3732a73e452089637b.tar.gz board-907b96801230e04d02575a3732a73e452089637b.tar.bz2 |
After USBLOOP test, g_mass_storage must be stopped so the board can be rebooted correctly.
Diffstat (limited to 'test-cli/test_main.py')
-rw-r--r-- | test-cli/test_main.py | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/test-cli/test_main.py b/test-cli/test_main.py index 80dfbe2..942df61 100644 --- a/test-cli/test_main.py +++ b/test-cli/test_main.py @@ -30,6 +30,7 @@ from test.helpers.cmdline import LinuxKernel from test.helpers.amper import Amper from test.enums.StationStates import StationStates import time +import sh # global variables psdbObj = TestSrv_Database() @@ -51,8 +52,7 @@ def execute_station_error(text): while True: currentstate = psdbObj.read_station_state(globalVar.station) if currentstate == StationStates.STATION_REBOOT.name: - os.system("reboot") - exit(1) + reboot_board() time.sleep(1) @@ -62,12 +62,10 @@ def check_first_state(): while True: currentstate = psdbObj.read_station_state(globalVar.station) if currentstate == StationStates.STATION_REBOOT.name: - os.system("reboot") - exit(1) + reboot_board() time.sleep(1) elif currentstate == StationStates.STATION_REBOOT.name: - os.system("reboot") - exit(1) + reboot_board() else: starttime = time.time() while currentstate != StationStates.WAIT_TEST_START.name: @@ -81,25 +79,26 @@ def check_first_state(): while True: currentstate = psdbObj.read_station_state(globalVar.station) if currentstate == StationStates.STATION_REBOOT.name: - os.system("reboot") - exit(1) + reboot_board() time.sleep(1) elif currentstate == StationStates.STATION_REBOOT.name: - os.system("reboot") - exit(1) + reboot_board() + + +def reboot_board(): + sh.reboot() + exit(0) def set_next_state(newstate): statewritten = psdbObj.change_station_state(globalVar.station, newstate) if statewritten == StationStates.STATION_REBOOT.name: - os.system("reboot") - exit(1) + reboot_board() elif statewritten == StationStates.STATION_ERROR.name: while True: currentstate = psdbObj.read_station_state(globalVar.station) if currentstate == StationStates.STATION_REBOOT.name: - os.system("reboot") - exit(1) + reboot_board() time.sleep(1) @@ -107,8 +106,7 @@ def reboot_if_autotest(): # reset board if AUTOTEST is enabled autotest = psdbObj.get_setup_variable("AUTOTEST_" + globalVar.station) if int(autotest) == 1: - os.system("reboot") - exit(0) + reboot_board() def create_paramslist(params): |