[oe-commits] Paul Eggleton : oe-selftest: devtool: add a proper test to see if tap devices exist

git at git.openembedded.org git at git.openembedded.org
Fri May 8 16:54:09 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: 2258345e19efff7717fe19a5026ec55f1b6f90b6
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=2258345e19efff7717fe19a5026ec55f1b6f90b6

Author: Paul Eggleton <paul.eggleton at linux.intel.com>
Date:   Thu May  7 14:52:25 2015 +0100

oe-selftest: devtool: add a proper test to see if tap devices exist

Check up front in test_devtool_deploy_target whether the tap devices
exist and skip if not. If we don't do this we get a significantly less
comprehensible error via pexpect.

Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/lib/oeqa/selftest/devtool.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index 2344fac..1d16113 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -587,6 +587,16 @@ class DevtoolTests(oeSelfTest):
             self.skipTest('This test only works with qemu machines')
         if not os.path.exists('/etc/runqemu-nosudo'):
             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')
         workspacedir = os.path.join(self.builddir, 'workspace')
         self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
         import pexpect



More information about the Openembedded-commits mailing list