diff options
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/devtool.py | 14 | ||||
| -rw-r--r-- | meta/lib/oeqa/utils/commands.py | 16 |
2 files changed, 18 insertions, 12 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 45263e1a3d..d5715b328b 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
| @@ -16,7 +16,7 @@ import json | |||
| 16 | 16 | ||
| 17 | from oeqa.selftest.case import OESelftestTestCase | 17 | from oeqa.selftest.case import OESelftestTestCase |
| 18 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer | 18 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer |
| 19 | from oeqa.utils.commands import get_bb_vars, runqemu, get_test_layer | 19 | from oeqa.utils.commands import get_bb_vars, runqemu, runqemu_check_taps, get_test_layer |
| 20 | from oeqa.core.decorator import OETestTag | 20 | from oeqa.core.decorator import OETestTag |
| 21 | 21 | ||
| 22 | oldmetapath = None | 22 | oldmetapath = None |
| @@ -277,18 +277,8 @@ class DevtoolTestCase(OESelftestTestCase): | |||
| 277 | machine = get_bb_var('MACHINE') | 277 | machine = get_bb_var('MACHINE') |
| 278 | if not machine.startswith('qemu'): | 278 | if not machine.startswith('qemu'): |
| 279 | self.skipTest('This test only works with qemu machines') | 279 | self.skipTest('This test only works with qemu machines') |
| 280 | if not os.path.exists('/etc/runqemu-nosudo'): | 280 | if not runqemu_check_taps(): |
| 281 | self.skipTest('You must set up tap devices with scripts/runqemu-gen-tapdevs before running this test') | 281 | self.skipTest('You must set up tap devices with scripts/runqemu-gen-tapdevs before running this test') |
| 282 | result = runCmd('PATH="$PATH:/sbin:/usr/sbin" ip tuntap show', ignore_status=True) | ||
| 283 | if result.status != 0: | ||
| 284 | result = runCmd('PATH="$PATH:/sbin:/usr/sbin" ifconfig -a', ignore_status=True) | ||
| 285 | if result.status != 0: | ||
| 286 | self.skipTest('Failed to determine if tap devices exist with ifconfig or ip: %s' % result.output) | ||
| 287 | for line in result.output.splitlines(): | ||
| 288 | if line.startswith('tap'): | ||
| 289 | break | ||
| 290 | else: | ||
| 291 | self.skipTest('No tap devices found - you must set up tap devices with scripts/runqemu-gen-tapdevs before running this test') | ||
| 292 | 282 | ||
| 293 | def _test_devtool_add_git_url(self, git_url, version, pn, resulting_src_uri, srcrev=None): | 283 | def _test_devtool_add_git_url(self, git_url, version, pn, resulting_src_uri, srcrev=None): |
| 294 | self.track_for_cleanup(self.workspacedir) | 284 | self.track_for_cleanup(self.workspacedir) |
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, | |||
| 401 | targetlogger.removeHandler(handler) | 401 | targetlogger.removeHandler(handler) |
| 402 | qemu.stop() | 402 | qemu.stop() |
| 403 | 403 | ||
| 404 | def runqemu_check_taps(): | ||
| 405 | """Check if tap devices for runqemu are available""" | ||
| 406 | if not os.path.exists('/etc/runqemu-nosudo'): | ||
| 407 | return False | ||
| 408 | result = runCmd('PATH="$PATH:/sbin:/usr/sbin" ip tuntap show', ignore_status=True) | ||
| 409 | if result.status != 0: | ||
| 410 | result = runCmd('PATH="$PATH:/sbin:/usr/sbin" ifconfig -a', ignore_status=True) | ||
| 411 | if result.status != 0: | ||
| 412 | return False | ||
| 413 | for line in result.output.splitlines(): | ||
| 414 | if line.startswith('tap'): | ||
| 415 | break | ||
| 416 | else: | ||
| 417 | return False | ||
| 418 | return True | ||
| 419 | |||
| 404 | def updateEnv(env_file): | 420 | def updateEnv(env_file): |
| 405 | """ | 421 | """ |
| 406 | Source a file and update environment. | 422 | Source a file and update environment. |
