diff options
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): |