From b4916fdecbccbc99c3ce405d562d884dd0fa3552 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 5 Mar 2020 11:18:43 +0100 Subject: [PATCH] mavsdk_tests: move config into json file --- test/mavsdk_tests/configs/sitl.json | 23 +++++++++++++++++++ test/mavsdk_tests/mavsdk_test_runner.py | 30 +++++-------------------- 2 files changed, 28 insertions(+), 25 deletions(-) create mode 100644 test/mavsdk_tests/configs/sitl.json diff --git a/test/mavsdk_tests/configs/sitl.json b/test/mavsdk_tests/configs/sitl.json new file mode 100644 index 0000000000..a6636141e5 --- /dev/null +++ b/test/mavsdk_tests/configs/sitl.json @@ -0,0 +1,23 @@ +[ + { + "model": "iris", + "test_filter": "[multicopter]", + "timeout_min": 20 + }, + { + "model": "iris_opt_flow_mockup", + "test_filter": "[multicopter_offboard]", + "timeout_min": 20 + }, + { + "model": "iris_vision", + "test_filter": "[multicopter_offboard]", + "timeout_min": 20, + "max_speed_factor": 1 + }, + { + "model": "standard_vtol", + "test_filter": "[vtol]", + "timeout_min": 20 + } +] diff --git a/test/mavsdk_tests/mavsdk_test_runner.py b/test/mavsdk_tests/mavsdk_test_runner.py index 1aea969263..908651ebee 100755 --- a/test/mavsdk_tests/mavsdk_test_runner.py +++ b/test/mavsdk_tests/mavsdk_test_runner.py @@ -4,6 +4,7 @@ import argparse import atexit import datetime import errno +import json import os import psutil import subprocess @@ -11,31 +12,6 @@ import sys import signal -test_matrix = [ - { - "model": "iris", - "test_filter": "[multicopter]", - "timeout_min": 20, - }, - { - "model": "iris_opt_flow_mockup", - "test_filter": "[multicopter_offboard]", - "timeout_min": 20, - }, - { - "model": "iris_vision", - "test_filter": "[multicopter_offboard]", - "timeout_min": 20, - "max_speed_factor": 1, - }, - { - "model": "standard_vtol", - "test_filter": "[vtol]", - "timeout_min": 20, - }, -] - - class Runner: def __init__(self, log_dir): self.cmd = "" @@ -202,6 +178,7 @@ def main(): help="Specify which model to run") parser.add_argument("--debugger", default="", help="valgrind callgrind gdb lldb") + parser.add_argument("config_file", help="JSON config file to use") args = parser.parse_args() if not is_everything_ready(): @@ -281,6 +258,9 @@ def run(args): def run_test_group(args): overall_success = True + with open(args.config_file) as json_file: + test_matrix = json.load(json_file) + if args.model == 'all': models = test_matrix else: