mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 07:53:35 +08:00
mavsdk_tests: try to restart gzserver
Sometimes gzserver seems to just not start correctly. With this commit we try to just restart.
This commit is contained in:
@@ -457,20 +457,10 @@ class Tester:
|
||||
runner.set_log_filename(
|
||||
self.determine_logfile_path(log_dir, runner.name))
|
||||
|
||||
runner.start()
|
||||
|
||||
if runner.has_started_ok():
|
||||
continue
|
||||
|
||||
else:
|
||||
if not self.try_to_run_several_times(runner):
|
||||
abort = True
|
||||
print("A timeout happened for runner: {}"
|
||||
.format(runner.name))
|
||||
break
|
||||
|
||||
runner.stop
|
||||
time.sleep(1)
|
||||
|
||||
if abort:
|
||||
print("Could not start runner: {}".format(runner.name))
|
||||
self.collect_runner_output()
|
||||
@@ -478,6 +468,19 @@ class Tester:
|
||||
self.stop_runners()
|
||||
sys.exit(1)
|
||||
|
||||
def try_to_run_several_times(self, runner: ph.Runner) -> bool:
|
||||
for _ in range(3):
|
||||
runner.start()
|
||||
|
||||
if runner.has_started_ok():
|
||||
return True
|
||||
|
||||
else:
|
||||
runner.stop()
|
||||
time.sleep(1)
|
||||
|
||||
return False
|
||||
|
||||
def stop_runners(self) -> None:
|
||||
for runner in self.active_runners:
|
||||
runner.stop()
|
||||
|
||||
Reference in New Issue
Block a user