diff --git a/cmake_targets/autotests/openair.py b/cmake_targets/autotests/openair.py index 8427735c61876fff0f2ecf7195131218262d1f49..b61a296761b9de4f2f5ae64a0c8c3cd8600f43a1 100644 --- a/cmake_targets/autotests/openair.py +++ b/cmake_targets/autotests/openair.py @@ -83,10 +83,13 @@ class openair(core): return (stdout, stderr) def connect(self, username, password, prompt='PEXPECT_OAI'): - while True: + max_retries=100 + i=0 + while i <= max_retries: self.prompt1 = prompt self.prompt2 = prompt self.password = '' + i=i+1 # WE do not store the password when sending commands for secuirity reasons. The password might be accidentally logged in such cases. #The password is used only to make ssh connections. In case user wants to run programs with sudo, then he/she needs to add following line in /etc/sudoers # your_user_name ALL=(ALL:ALL) NOPASSWD: ALL @@ -113,7 +116,9 @@ class openair(core): print error print "Retrying again in 1 seconds" time.sleep(1) - #sys.exit(1) + if i==max_retries: + print "Fatal Error: Terminating the program now..." + sys.exit(1) def connect2(self, username, password, prompt='$'): self.prompt1 = prompt diff --git a/cmake_targets/autotests/run_exec_lte-softmodem_tests.py b/cmake_targets/autotests/run_exec_lte-softmodem_tests.py index 2e1f5c4fc3b90e40258b00f75896fa0b6249bb18..905847230a8f8c7a7bda5cb4229cb9fe10e22608 100644 --- a/cmake_targets/autotests/run_exec_lte-softmodem_tests.py +++ b/cmake_targets/autotests/run_exec_lte-softmodem_tests.py @@ -273,9 +273,12 @@ def SSHSessionWrapper(machine, username, key_file, password, logdir_remote_testc error = error + '\n username = ' + username + '\n machine = ' + machine + '\n logdir_remote = ' + logdir_remote_testcase + '\n logdir_local_base = ' + logdir_local_base error = error + traceback.format_exc() print error - print " Trying again in 1 seconds" + print " Retrying again in 1 seconds" time.sleep(1) print "Continuing ..." + if i ==max_tries: + print "Fatal Error: Max no of retries reached. Exiting now..." + sys.exit(1)