From b6d1863e77ff5aa07466c835b88fb8be94d6dd97 Mon Sep 17 00:00:00 2001 From: douglas-raillard-arm Date: Mon, 29 Mar 2021 19:06:34 +0100 Subject: [PATCH] collector/dmesg: DmesgCollector: Avoid not rooted targets Fail early if the target is not rooted, as root is required by DmesgCollector.start() anyway. --- devlib/collector/dmesg.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/devlib/collector/dmesg.py b/devlib/collector/dmesg.py index 4de40b2..40676c7 100644 --- a/devlib/collector/dmesg.py +++ b/devlib/collector/dmesg.py @@ -21,6 +21,7 @@ from datetime import timedelta from devlib.collector import (CollectorBase, CollectorOutput, CollectorOutputEntry) from devlib.target import KernelConfigTristate +from devlib.exception import TargetStableError class KernelLogEntry(object): @@ -153,6 +154,10 @@ class DmesgCollector(CollectorBase): def __init__(self, target, level=LOG_LEVELS[-1], facility='kern'): super(DmesgCollector, self).__init__(target) + + if not target.is_rooted: + raise TargetStableError('Cannot collect dmesg on non-rooted target') + self.output_path = None if level not in self.LOG_LEVELS: