summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Stanacar <stefanx.stanacar@intel.com>2013-06-28 11:54:48 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-07-09 10:49:08 +0100
commitdd3dc2804395f050df74fa936e65ce5e911442eb (patch)
tree9c26751b49da3d6c4ddb7bc0535244b0e14d2c0c
parent79cb89648702aa80ec986e0026c62948de905b87 (diff)
downloadopenembedded-core-dd3dc2804395f050df74fa936e65ce5e911442eb.tar.gz
openembedded-core-dd3dc2804395f050df74fa936e65ce5e911442eb.tar.bz2
openembedded-core-dd3dc2804395f050df74fa936e65ce5e911442eb.zip
lib/oeqa/runtime: image sanity tests
These are basic sanity tests. A test can be force run by setting TEST_SUITES = "ping ssh <module-name>" in local.conf. By default there are suites for minimal, sato and sato-sdk images. Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Radu Moisan <radu.moisan@intel.com>
-rw-r--r--meta/lib/oeqa/runtime/__init__.py0
-rw-r--r--meta/lib/oeqa/runtime/connman.py34
-rw-r--r--meta/lib/oeqa/runtime/dmesg.py13
-rw-r--r--meta/lib/oeqa/runtime/multilib.py14
-rw-r--r--meta/lib/oeqa/runtime/ping.py11
-rw-r--r--meta/lib/oeqa/runtime/rpm.py25
-rw-r--r--meta/lib/oeqa/runtime/smart.py27
-rw-r--r--meta/lib/oeqa/runtime/ssh.py16
-rw-r--r--meta/lib/oeqa/runtime/systemd.py24
-rw-r--r--meta/lib/oeqa/runtime/xorg.py21
10 files changed, 185 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/__init__.py b/meta/lib/oeqa/runtime/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/meta/lib/oeqa/runtime/__init__.py
diff --git a/meta/lib/oeqa/runtime/connman.py b/meta/lib/oeqa/runtime/connman.py
new file mode 100644
index 0000000000..835e1355c3
--- /dev/null
+++ b/meta/lib/oeqa/runtime/connman.py
@@ -0,0 +1,34 @@
+import unittest
+from oeqa.oetest import oeRuntimeTest, skipModule
+from oeqa.utils.decorators import *
+
+def setUpModule():
+ if not oeRuntimeTest.hasPackage("connman"):
+ skipModule("No connman package in image")
+
+
+class ConnmanTest(oeRuntimeTest):
+
+ @skipUnlessPassed('test_ssh')
+ def test_connmand_help(self):
+ (status, output) = self.target.run('/usr/sbin/connmand --help')
+ self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output))
+
+
+ @skipUnlessPassed('test_connmand_help')
+ def test_connmand_running(self):
+ status = self.target.run('ls -l `which ps` | grep busybox')[0]
+ if status == 0:
+ oeRuntimeTest.pscmd = 'ps'
+ else:
+ oeRuntimeTest.pscmd = 'ps -ef'
+ (status, output) = self.target.run(oeRuntimeTest.pscmd + ' | grep [c]onnmand')
+ self.assertEqual(status, 0, msg="no connmand process, ps output: %s" % self.target.run(oeRuntimeTest.pscmd)[1])
+
+ @skipUnlessPassed('test_connmand_running')
+ def test_connmand_unique(self):
+ self.target.run('/usr/sbin/connmand')
+ output = self.target.run(oeRuntimeTest.pscmd + ' | grep -c [c]onnmand')[1]
+ self.assertEqual(output, "1", msg="more than one connmand running in background, ps output: %s\n%s" % (output, self.target.run(oeRuntimeTest.pscmd)[1]))
+
+
diff --git a/meta/lib/oeqa/runtime/dmesg.py b/meta/lib/oeqa/runtime/dmesg.py
new file mode 100644
index 0000000000..b0e2175bec
--- /dev/null
+++ b/meta/lib/oeqa/runtime/dmesg.py
@@ -0,0 +1,13 @@
+import unittest
+from oeqa.oetest import oeRuntimeTest
+from oeqa.utils.decorators import *
+
+def setUpModule():
+ skipModuleUnless(oeRuntimeTest.tc.target.run('which dmesg')[0] == 0, "No dmesg in image or no connection")
+
+class DmesgTest(oeRuntimeTest):
+
+ @skipUnlessPassed('test_ssh')
+ def test_dmesg(self):
+ (status, output) = self.target.run('dmesg | grep -v mmci-pl18x | grep -i error')
+ self.assertEqual(status, 1, msg = "Error messages in dmesg log: %s" % output)
diff --git a/meta/lib/oeqa/runtime/multilib.py b/meta/lib/oeqa/runtime/multilib.py
new file mode 100644
index 0000000000..397d075115
--- /dev/null
+++ b/meta/lib/oeqa/runtime/multilib.py
@@ -0,0 +1,14 @@
+import unittest
+from oeqa.oetest import oeRuntimeTest, skipModule
+
+def setUpModule():
+ multilibs = oeRuntimeTest.tc.d.getVar("MULTILIBS", True) or ""
+ if "multlib:lib32" not in multilibs:
+ skipModule("this isn't a multilib:lib32 image")
+
+
+class MultilibFileTest(oeRuntimeTest):
+
+ def test_file_connman(self):
+ (status, output) = self.target.run('file -L /usr/sbin/connmand | grep "ELF 32-bit LSB executable"')
+ self.assertEqual(status, 0, msg="status and output : %s and %s" % (status,output))
diff --git a/meta/lib/oeqa/runtime/ping.py b/meta/lib/oeqa/runtime/ping.py
new file mode 100644
index 0000000000..d6a0c28628
--- /dev/null
+++ b/meta/lib/oeqa/runtime/ping.py
@@ -0,0 +1,11 @@
+import subprocess
+import unittest
+import sys
+from oeqa.oetest import oeRuntimeTest
+
+class PingTest(oeRuntimeTest):
+
+ def test_ping(self):
+ status = subprocess.call("ping -w 30 -c 1 %s" % oeRuntimeTest.tc.qemu.ip, shell=True, stdout=subprocess.PIPE)
+ self.assertEqual(status, 0)
+
diff --git a/meta/lib/oeqa/runtime/rpm.py b/meta/lib/oeqa/runtime/rpm.py
new file mode 100644
index 0000000000..57101b0704
--- /dev/null
+++ b/meta/lib/oeqa/runtime/rpm.py
@@ -0,0 +1,25 @@
+import unittest
+from oeqa.oetest import oeRuntimeTest, skipModule
+from oeqa.utils.decorators import *
+
+def setUpModule():
+ if not oeRuntimeTest.hasFeature("package-management"):
+ skipModule("rpm module skipped: target doesn't have package-management in IMAGE_FEATURES")
+ if "package_rpm" != oeRuntimeTest.tc.d.getVar("PACKAGE_CLASSES", True).split()[0]:
+ skipModule("rpm module skipped: target doesn't have rpm as primary package manager")
+
+
+class RpmHelpTest(oeRuntimeTest):
+
+ @skipUnlessPassed('test_ssh')
+ def test_rpm_help(self):
+ (status, output) = self.target.run('rpm --help')
+ self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output))
+
+class RpmQueryTest(oeRuntimeTest):
+
+ @skipUnlessPassed('test_rpm_help')
+ def test_rpm_query(self):
+ (status, output) = self.target.run('rpm -q rpm')
+ self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output))
+
diff --git a/meta/lib/oeqa/runtime/smart.py b/meta/lib/oeqa/runtime/smart.py
new file mode 100644
index 0000000000..8cfacd4602
--- /dev/null
+++ b/meta/lib/oeqa/runtime/smart.py
@@ -0,0 +1,27 @@
+import unittest
+from oeqa.oetest import oeRuntimeTest
+from oeqa.utils.decorators import *
+
+def setUpModule():
+ if not oeRuntimeTest.hasFeature("package-management"):
+ skipModule("Image doesn't have package management feature")
+ if not oeRuntimeTest.hasPackage("smart"):
+ skipModule("Image doesn't have smart installed")
+
+class SmartHelpTest(oeRuntimeTest):
+
+ def test_smart_help(self):
+ status = self.target.run('smart --help')[0]
+ self.assertEqual(status, 0)
+
+class SmartQueryTest(oeRuntimeTest):
+
+ @skipUnlessPassed('test_smart_help')
+ def test_smart_query(self):
+ (status, output) = self.target.run('smart query rpm')
+ self.assertEqual(status, 0, msg="smart query failed, output: %s" % output)
+
+ @skipUnlessPassed('test_smart_query')
+ def test_smart_info(self):
+ (status, output) = self.target.run('smart info rpm')
+ self.assertEqual(status, 0, msg="smart info rpm failed, output: %s" % output)
diff --git a/meta/lib/oeqa/runtime/ssh.py b/meta/lib/oeqa/runtime/ssh.py
new file mode 100644
index 0000000000..8c96020e54
--- /dev/null
+++ b/meta/lib/oeqa/runtime/ssh.py
@@ -0,0 +1,16 @@
+import subprocess
+import unittest
+import sys
+from oeqa.oetest import oeRuntimeTest, skipModule
+from oeqa.utils.decorators import *
+
+def setUpModule():
+ if not (oeRuntimeTest.hasPackage("dropbear") or oeRuntimeTest.hasPackage("openssh")):
+ skipModule("No ssh package in image")
+
+class SshTest(oeRuntimeTest):
+
+ @skipUnlessPassed('test_ping')
+ def test_ssh(self):
+ (status, output) = self.target.run('uname -a')
+ self.assertEqual(status, 0, msg="SSH Test failed: %s" % output)
diff --git a/meta/lib/oeqa/runtime/systemd.py b/meta/lib/oeqa/runtime/systemd.py
new file mode 100644
index 0000000000..edf4f39609
--- /dev/null
+++ b/meta/lib/oeqa/runtime/systemd.py
@@ -0,0 +1,24 @@
+import unittest
+from oeqa.oetest import oeRuntimeTest, skipModule
+from oeqa.utils.decorators import *
+
+def setUpModule():
+ if not oeRuntimeTest.hasFeature("systemd"):
+ skipModule("target doesn't have systemd in DISTRO_FEATURES")
+ if "systemd" != oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager", True):
+ skipModule("systemd is not the init manager for this image")
+
+
+class SystemdBasicTest(oeRuntimeTest):
+
+ @skipUnlessPassed('test_ssh')
+ def test_systemd_version(self):
+ (status, output) = self.target.run('systemctl --version')
+ self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output))
+
+class SystemdTests(oeRuntimeTest):
+
+ @skipUnlessPassed('test_systemd_version')
+ def test_systemd_failed(self):
+ (status, output) = self.target.run('systemctl --failed | grep "0 loaded units listed"')
+ self.assertEqual(status, 0, msg="Failed systemd services: %s" % self.target.run('systemctl --failed')[1])
diff --git a/meta/lib/oeqa/runtime/xorg.py b/meta/lib/oeqa/runtime/xorg.py
new file mode 100644
index 0000000000..96cc20a50b
--- /dev/null
+++ b/meta/lib/oeqa/runtime/xorg.py
@@ -0,0 +1,21 @@
+import unittest
+from oeqa.oetest import oeRuntimeTest, skipModule
+from oeqa.utils.decorators import *
+
+def setUpModule():
+ if not oeRuntimeTest.hasFeature("x11-base"):
+ skipModule("target doesn't have x11 in IMAGE_FEATURES")
+
+
+class XorgTest(oeRuntimeTest):
+
+ @skipUnlessPassed('test_ssh')
+ def test_xorg_running(self):
+ (status, output) = self.target.run('ps | grep -v xinit | grep [X]org')
+ self.assertEqual(status, 0, msg="Xorg does not appear to be running %s" % self.target.run('ps')[1])
+
+ @skipUnlessPassed('test_ssh')
+ def test_xorg_error(self):
+ (status, output) = self.target.run('cat /var/log/Xorg.0.log | grep -v "(EE) error," | grep -v "PreInit" | grep -v "evdev:" | grep -v "glx" | grep "(EE)"')
+ self.assertEqual(status, 1, msg="Errors in Xorg log: %s" % output)
+