mirror of
https://git.yoctoproject.org/poky
synced 2026-04-20 00:32:13 +02:00
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 <adrian.freihofer@siemens.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
ad5df78c55
commit
873430ceca
@@ -16,7 +16,7 @@ import json
|
||||
|
||||
from oeqa.selftest.case import OESelftestTestCase
|
||||
from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer
|
||||
from oeqa.utils.commands import get_bb_vars, runqemu, get_test_layer
|
||||
from oeqa.utils.commands import get_bb_vars, runqemu, runqemu_check_taps, get_test_layer
|
||||
from oeqa.core.decorator import OETestTag
|
||||
|
||||
oldmetapath = None
|
||||
@@ -277,18 +277,8 @@ class DevtoolTestCase(OESelftestTestCase):
|
||||
machine = get_bb_var('MACHINE')
|
||||
if not machine.startswith('qemu'):
|
||||
self.skipTest('This test only works with qemu machines')
|
||||
if not os.path.exists('/etc/runqemu-nosudo'):
|
||||
if not runqemu_check_taps():
|
||||
self.skipTest('You must set up tap devices with scripts/runqemu-gen-tapdevs before running this test')
|
||||
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:
|
||||
self.skipTest('Failed to determine if tap devices exist with ifconfig or ip: %s' % result.output)
|
||||
for line in result.output.splitlines():
|
||||
if line.startswith('tap'):
|
||||
break
|
||||
else:
|
||||
self.skipTest('No tap devices found - you must set up tap devices with scripts/runqemu-gen-tapdevs before running this test')
|
||||
|
||||
def _test_devtool_add_git_url(self, git_url, version, pn, resulting_src_uri, srcrev=None):
|
||||
self.track_for_cleanup(self.workspacedir)
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user