mavsdk_tests: check if build everything is built

This commit is contained in:
Julian Oes 2019-11-11 15:33:34 +01:00 committed by Lorenz Meier
parent 0a3152786b
commit cc249f980b
1 changed files with 24 additions and 10 deletions

View File

@ -139,18 +139,32 @@ class TestRunner(Runner):
self.log_prefix = "test_runner"
def is_running(process_name):
for proc in psutil.process_iter(attrs=['name']):
if proc.info['name'] == process_name:
True
return False
def is_everything_ready():
result = True
for proc in psutil.process_iter(attrs=['name']):
if proc.info['name'] == 'gzserver':
print("gzserver process already running\n"
"run `killall gzserver` and try again")
result = False
elif proc.info['name'] == 'px4':
print("px4 process already running\n"
"run `killall px4` and try again")
result = False
if is_running('px4'):
print("px4 process already running\n"
"run `killall px4` and try again")
result = False
if is_running('gzserver'):
print("gzserver process already running\n"
"run `killall gzserver` and try again")
result = False
if not os.path.isfile('build/px4_sitl_default/bin/px4'):
print("PX4 SITL is not built\n"
"run `PX4_MAVSDK_TESTING=y DONT_RUN=1 "
"make px4_sitl gazebo mavsdk_tests`")
if not os.path.isfile('build/px4_sitl_default/mavsdk_tests'):
print("Test runner is not built\n"
"run `PX4_MAVSDK_TESTING=y DONT_RUN=1 "
"make px4_sitl gazebo mavsdk_tests`")
result = False
return result