From 873430cecaa512bb2055c79d69733f8601523049 Mon Sep 17 00:00:00 2001 From: Adrian Freihofer Date: Sat, 12 Jul 2025 14:50:42 +0200 Subject: oe-selftest: devtool: split tap detection into function Make the check for tap devices available as a function which can be used by other tests as well. (From OE-Core rev: ad8f3a8d959a245301118cf7b850f1a0ab567f01) Signed-off-by: Adrian Freihofer Signed-off-by: Richard Purdie --- meta/lib/oeqa/utils/commands.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'meta/lib/oeqa/utils') diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index b60a6e6c38..e049e1ee68 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py @@ -401,6 +401,22 @@ def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None, targetlogger.removeHandler(handler) qemu.stop() +def runqemu_check_taps(): + """Check if tap devices for runqemu are available""" + if not os.path.exists('/etc/runqemu-nosudo'): + return False + result = runCmd('PATH="$PATH:/sbin:/usr/sbin" ip tuntap show', ignore_status=True) + if result.status != 0: + result = runCmd('PATH="$PATH:/sbin:/usr/sbin" ifconfig -a', ignore_status=True) + if result.status != 0: + return False + for line in result.output.splitlines(): + if line.startswith('tap'): + break + else: + return False + return True + def updateEnv(env_file): """ Source a file and update environment. -- cgit v1.2.3-54-g00ecf