mavsdk_tests: don't clear logs

This commit is contained in:
Julian Oes 2021-02-11 09:59:04 +01:00 committed by Lorenz Meier
parent 9d3ff12a94
commit 2971ce8664
1 changed files with 13 additions and 4 deletions

View File

@ -176,15 +176,24 @@ class Px4Runner(Runner):
def clear_rootfs(self) -> None:
rootfs_path = self.cwd
if self.verbose:
print("Deleting rootfs: {}".format(rootfs_path))
if os.path.isdir(rootfs_path):
shutil.rmtree(rootfs_path)
print("Clearing rootfs (except logs): {}".format(rootfs_path))
for item in os.listdir(rootfs_path):
if item == 'log':
continue
path = os.path.join(rootfs_path, item)
if os.path.isfile(path) or os.path.islink(path):
os.remove(path)
else:
shutil.rmtree(path)
def create_rootfs(self) -> None:
rootfs_path = self.cwd
if self.verbose:
print("Creating rootfs: {}".format(rootfs_path))
os.makedirs(rootfs_path)
try:
os.makedirs(rootfs_path)
except FileExistsError:
pass
class GzserverRunner(Runner):