From 60c3016dc219eb83c730e2f5513a4b750fc403bb Mon Sep 17 00:00:00 2001 From: Leo Yan Date: Wed, 22 Sep 2021 14:46:34 +0800 Subject: [PATCH 1/2] lisa.target: Don't freeze process 'rs.media.module' When execute command: [LISAShell lisa] \> lisa-test 'OneSmallTask*' The command stucks after LISA setting up CGroup with freezing processes. After digging with 'strace mount' in the console, it shows the mount program tries to communicate with 'emulated' component; and 'emulated' threads are spawn by the process 'rs.media.module'. This patch adds process 'rs.media.module' into exclude array to avoid freezing it, so that 'mount' command can execute successfully and dismiss the stuck issue. Signed-off-by: Leo Yan --- lisa/target.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisa/target.py b/lisa/target.py index 214e32654..9b7bfade3 100644 --- a/lisa/target.py +++ b/lisa/target.py @@ -215,6 +215,10 @@ class Target(Loggable, HideExekallID, ExekallTaggable, Configurable): ], 'android': [ 'sh', 'adbd', + # AOSP 'mount' command needs to communicate with 'emulated' threads, + # the threads are spawn by the process 'rs.media.module', so need to + # avoid freezing it to avoid stuck with execute 'mount' command. + 'rs.media.module', 'usb', 'transport', # We don't actually need this task but on Google Pixel it apparently # cannot be frozen, so the cgroup state gets stuck in FREEZING if we -- GitLab From a1e31b92265b97df36677d2bbe59fd81f2796ee9 Mon Sep 17 00:00:00 2001 From: Leo Yan Date: Wed, 22 Sep 2021 22:29:19 +0800 Subject: [PATCH 2/2] lisa.target: Enable root if username is not set Class 'AndroidTarget' in devlib has removed the method AndroidTarget::adb_root, thus it fails to execute 'adb root' for the connection, and it complaints warning for "adb root" failure. This leads to 'lisa-test' command execution with insufficient permission to retrieve dmesg, and copy trace files. To resolve this issue, one option is to add the config 'username: root' into file target_conf.yml. If the user doesn't set any username in the target config file, this patch will automatically assign 'conn_settings['adb_as_root']' to 1, so it can allow the adb connection to have root permission and dismiss the testing failure. Signed-off-by: Leo Yan --- lisa/target.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lisa/target.py b/lisa/target.py index 9b7bfade3..da3472684 100644 --- a/lisa/target.py +++ b/lisa/target.py @@ -633,9 +633,9 @@ class Target(Loggable, HideExekallID, ExekallTaggable, Configurable): device = 'DEFAULT' conn_settings['device'] = device - # If the username was explicitly set to "root", root the target as - # early as possible - conn_settings['adb_as_root'] = (username == 'root') + # If the username was explicitly set to "root", or username is None, + # root the target as early as possible + conn_settings['adb_as_root'] = (username == 'root' or username is None) elif kind == 'linux': devlib_target_cls = devlib.LinuxTarget @@ -692,14 +692,6 @@ class Target(Loggable, HideExekallID, ExekallTaggable, Configurable): target.connect(check_boot_completed=wait_boot, timeout=wait_boot_timeout) - # None as username means adb root will be attempted, but failure will - # not prevent from connecting to the target. - if kind == 'android' and username is None: - try: - target.adb_root(enable=True) - except Exception as e: # pylint: disable=broad-except - logger.warning(f'"adb root" failed: {e}') - logger.debug(f'Target info: {dict(abi=target.abi, cpuinfo=target.cpuinfo, workdir=target.working_directory)}') target.setup() -- GitLab