mavsdk_tests: clear params between test cases

This commit is contained in:
Julian Oes 2020-07-31 09:43:00 +02:00 committed by Daniel Agar
parent a5a577a6c4
commit 630a6f3810
1 changed files with 13 additions and 1 deletions

View File

@ -3,6 +3,7 @@
import argparse
import datetime
import fnmatch
import glob
import json
import math
import os
@ -276,7 +277,7 @@ class Tester:
log_dir = self.get_log_dir(iteration, test['model'], key)
if self.verbose:
print("creating log directory: {}"
print("Creating log directory: {}"
.format(log_dir))
os.makedirs(log_dir, exist_ok=True)
@ -325,6 +326,8 @@ class Tester:
def run_test_case(self, test: Dict[str, Any],
case: str, log_dir: str) -> bool:
self.clear_params()
self.start_runners(log_dir, test, case)
logfile_path = self.determine_logfile_path(log_dir, 'combined')
@ -366,6 +369,15 @@ class Tester:
print(" - {}".format(runner.get_log_filename()))
return is_success
def clear_params(self):
param_files = glob.glob(
"build/px4_sitl_default/tmp/rootfs/eeprom/parameters_*",
recursive=False)
for param_file in param_files:
if self.verbose:
print("Deleting param file: {}".format(param_file))
os.unlink(param_file)
def start_runners(self,
log_dir: str,
test: Dict[str, Any],