diff --git a/test/mavsdk_tests/mavsdk_test_runner.py b/test/mavsdk_tests/mavsdk_test_runner.py index 3562c60b9d..a9def26950 100755 --- a/test/mavsdk_tests/mavsdk_test_runner.py +++ b/test/mavsdk_tests/mavsdk_test_runner.py @@ -9,6 +9,7 @@ import psutil # type: ignore import signal import subprocess import sys +import time from logger_helper import color, colorize import process_helper as ph from typing import Any, Dict, List, NoReturn, TextIO, Optional @@ -382,14 +383,6 @@ class Tester: self.verbose) self.active_runners.append(gzserver_runner) - waitforgz_runner = ph.WaitforgzRunner( - os.getcwd(), - log_dir, - test['model'], - case, - self.verbose) - self.active_runners.append(waitforgz_runner) - gzmodelspawn_runner = ph.GzmodelspawnRunner( os.getcwd(), log_dir, @@ -428,6 +421,11 @@ class Tester: .format(runner.name)) break + # Workaround to prevent gz not being able to communicate + # with gzserver + if runner.name == "gzserver": + time.sleep(10) + if abort: self.stop_runners() sys.exit(1) diff --git a/test/mavsdk_tests/process_helper.py b/test/mavsdk_tests/process_helper.py index c8420a5ea4..703add84cd 100644 --- a/test/mavsdk_tests/process_helper.py +++ b/test/mavsdk_tests/process_helper.py @@ -6,7 +6,6 @@ import os import atexit import subprocess import threading -import pathlib import errno from typing import Any, Dict, List, TextIO, Optional @@ -31,7 +30,6 @@ class Runner: self.start_time = time.time() self.log_dir = log_dir self.log_filename = "" - self.wait_until_complete = False self.stop_thread: Any[threading.Event] = None def set_log_filename(self, log_filename: str) -> None: @@ -62,11 +60,6 @@ class Runner: self.stop_thread = threading.Event() self.thread = threading.Thread(target=self.process_output) self.thread.start() - if self.wait_until_complete: - timeout_s = 10.0 - if self.wait(timeout_s) != 0: - raise TimeoutError("Command '{}' not completed within {}" - .format(self.cmd, timeout_s)) def process_output(self) -> None: assert self.process.stdout is not None @@ -211,24 +204,6 @@ class GzserverRunner(Runner): self.env[var] = os.environ[var] -class WaitforgzRunner(Runner): - def __init__(self, - workspace_dir: str, - log_dir: str, - model: str, - case: str, - verbose: bool): - super().__init__(log_dir, model, case, verbose) - self.name = "waitforgz" - self.cwd = workspace_dir - self.env = {"PATH": os.environ['PATH'], - "HOME": os.environ['HOME']} - script_dir = pathlib.Path(__file__).parent.absolute() - self.cmd = os.path.join(script_dir, "waitforgz.sh") - self.args = [] - self.wait_until_complete = True - - class GzmodelspawnRunner(Runner): def __init__(self, workspace_dir: str, @@ -252,7 +227,6 @@ class GzmodelspawnRunner(Runner): self.model + "/" + self.model + ".sdf", "--model-name", self.model, "-x", "1.01", "-y", "0.98", "-z", "0.83"] - self.wait_until_complete = True class GzclientRunner(Runner): diff --git a/test/mavsdk_tests/waitforgz.sh b/test/mavsdk_tests/waitforgz.sh deleted file mode 100755 index 5a06b072e7..0000000000 --- a/test/mavsdk_tests/waitforgz.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -while gz stats -d 0 2>&1 | grep -q "An instance of Gazebo is not running."; do - echo "Gazebo not running yet ..." -done