Add debugger options for mavsdk test runner

This commit is contained in:
Julian Kent 2020-02-24 18:09:05 +01:00 committed by Daniel Agar
parent 77b854b7c3
commit 5bf2648c1f
1 changed files with 20 additions and 2 deletions

View File

@ -116,7 +116,7 @@ class Runner:
class Px4Runner(Runner):
def __init__(self, model, workspace_dir, log_dir, speed_factor):
def __init__(self, model, workspace_dir, log_dir, speed_factor, debugger):
super().__init__(log_dir)
self.cmd = workspace_dir + "/build/px4_sitl_default/bin/px4"
self.cwd = workspace_dir + "/build/px4_sitl_default/tmp/rootfs"
@ -133,6 +133,22 @@ class Px4Runner(Runner):
"PX4_SIM_SPEED_FACTOR": str(speed_factor)}
self.log_prefix = "px4"
if not debugger:
pass
elif debugger == "valgrind":
self.args = ["--track-origins=yes", "--leak-check=full", "-v", self.cmd] + self.args
self.cmd = "valgrind"
elif debugger == "callgrind":
self.args = ["--tool=callgrind", "-v", self.cmd] + self.args
self.cmd = "valgrind"
elif debugger == "gdb":
self.args = ["--args", self.cmd] + self.args
self.cmd = "gdb"
else:
print("Using custom debugger " , debugger)
self.args = [self.cmd] + self.args
self.cmd = debugger
class GzserverRunner(Runner):
def __init__(self, model, workspace_dir, log_dir, speed_factor):
@ -192,6 +208,8 @@ def main():
help="Display gzclient with simulation")
parser.add_argument("--model", type=str, default='all',
help="Specify which model to run")
parser.add_argument("--debugger", default="",
help="valgrind callgrind gdb lldb")
args = parser.parse_args()
if not is_everything_ready():
@ -307,7 +325,7 @@ def run_test_group(args):
def run_test(test, group, args):
px4_runner = Px4Runner(
group['model'], os.getcwd(), args.log_dir, args.speed_factor)
group['model'], os.getcwd(), args.log_dir, args.speed_factor, args.debugger)
px4_runner.start(group)
gzserver_runner = GzserverRunner(