summaryrefslogtreecommitdiffstats
path: root/meta/lib
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:53:45 +0100
commit06d6f9d52e9cb636d007f35db38819eebf1f4000 (patch)
treedc848c9f407338d6b83a5406794d360549407277 /meta/lib
parent54f3848397640d3c6b6990bef727834bd364aa45 (diff)
downloadpoky-06d6f9d52e9cb636d007f35db38819eebf1f4000.tar.gz
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. (From OE-Core rev: dd3dc2804395f050df74fa936e65ce5e911442eb) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Radu Moisan <radu.moisan@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-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 @@
1import unittest
2from oeqa.oetest import oeRuntimeTest, skipModule
3from oeqa.utils.decorators import *
4
5def setUpModule():
6 if not oeRuntimeTest.hasPackage("connman"):
7 skipModule("No connman package in image")
8
9
10class ConnmanTest(oeRuntimeTest):
11
12 @skipUnlessPassed('test_ssh')
13 def test_connmand_help(self):
14 (status, output) = self.target.run('/usr/sbin/connmand --help')
15 self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output))
16
17
18 @skipUnlessPassed('test_connmand_help')
19 def test_connmand_running(self):
20 status = self.target.run('ls -l `which ps` | grep busybox')[0]
21 if status == 0:
22 oeRuntimeTest.pscmd = 'ps'
23 else:
24 oeRuntimeTest.pscmd = 'ps -ef'
25 (status, output) = self.target.run(oeRuntimeTest.pscmd + ' | grep [c]onnmand')
26 self.assertEqual(status, 0, msg="no connmand process, ps output: %s" % self.target.run(oeRuntimeTest.pscmd)[1])
27
28 @skipUnlessPassed('test_connmand_running')
29 def test_connmand_unique(self):
30 self.target.run('/usr/sbin/connmand')
31 output = self.target.run(oeRuntimeTest.pscmd + ' | grep -c [c]onnmand')[1]
32 self.assertEqual(output, "1", msg="more than one connmand running in background, ps output: %s\n%s" % (output, self.target.run(oeRuntimeTest.pscmd)[1]))
33
34
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 @@
1import unittest
2from oeqa.oetest import oeRuntimeTest
3from oeqa.utils.decorators import *
4
5def setUpModule():
6 skipModuleUnless(oeRuntimeTest.tc.target.run('which dmesg')[0] == 0, "No dmesg in image or no connection")
7
8class DmesgTest(oeRuntimeTest):
9
10 @skipUnlessPassed('test_ssh')
11 def test_dmesg(self):
12 (status, output) = self.target.run('dmesg | grep -v mmci-pl18x | grep -i error')
13 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 @@
1import unittest
2from oeqa.oetest import oeRuntimeTest, skipModule
3
4def setUpModule():
5 multilibs = oeRuntimeTest.tc.d.getVar("MULTILIBS", True) or ""
6 if "multlib:lib32" not in multilibs:
7 skipModule("this isn't a multilib:lib32 image")
8
9
10class MultilibFileTest(oeRuntimeTest):
11
12 def test_file_connman(self):
13 (status, output) = self.target.run('file -L /usr/sbin/connmand | grep "ELF 32-bit LSB executable"')
14 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 @@
1import subprocess
2import unittest
3import sys
4from oeqa.oetest import oeRuntimeTest
5
6class PingTest(oeRuntimeTest):
7
8 def test_ping(self):
9 status = subprocess.call("ping -w 30 -c 1 %s" % oeRuntimeTest.tc.qemu.ip, shell=True, stdout=subprocess.PIPE)
10 self.assertEqual(status, 0)
11
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 @@
1import unittest
2from oeqa.oetest import oeRuntimeTest, skipModule
3from oeqa.utils.decorators import *
4
5def setUpModule():
6 if not oeRuntimeTest.hasFeature("package-management"):
7 skipModule("rpm module skipped: target doesn't have package-management in IMAGE_FEATURES")
8 if "package_rpm" != oeRuntimeTest.tc.d.getVar("PACKAGE_CLASSES", True).split()[0]:
9 skipModule("rpm module skipped: target doesn't have rpm as primary package manager")
10
11
12class RpmHelpTest(oeRuntimeTest):
13
14 @skipUnlessPassed('test_ssh')
15 def test_rpm_help(self):
16 (status, output) = self.target.run('rpm --help')
17 self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output))
18
19class RpmQueryTest(oeRuntimeTest):
20
21 @skipUnlessPassed('test_rpm_help')
22 def test_rpm_query(self):
23 (status, output) = self.target.run('rpm -q rpm')
24 self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output))
25
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 @@
1import unittest
2from oeqa.oetest import oeRuntimeTest
3from oeqa.utils.decorators import *
4
5def setUpModule():
6 if not oeRuntimeTest.hasFeature("package-management"):
7 skipModule("Image doesn't have package management feature")
8 if not oeRuntimeTest.hasPackage("smart"):
9 skipModule("Image doesn't have smart installed")
10
11class SmartHelpTest(oeRuntimeTest):
12
13 def test_smart_help(self):
14 status = self.target.run('smart --help')[0]
15 self.assertEqual(status, 0)
16
17class SmartQueryTest(oeRuntimeTest):
18
19 @skipUnlessPassed('test_smart_help')
20 def test_smart_query(self):
21 (status, output) = self.target.run('smart query rpm')
22 self.assertEqual(status, 0, msg="smart query failed, output: %s" % output)
23
24 @skipUnlessPassed('test_smart_query')
25 def test_smart_info(self):
26 (status, output) = self.target.run('smart info rpm')
27 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 @@
1import subprocess
2import unittest
3import sys
4from oeqa.oetest import oeRuntimeTest, skipModule
5from oeqa.utils.decorators import *
6
7def setUpModule():
8 if not (oeRuntimeTest.hasPackage("dropbear") or oeRuntimeTest.hasPackage("openssh")):
9 skipModule("No ssh package in image")
10
11class SshTest(oeRuntimeTest):
12
13 @skipUnlessPassed('test_ping')
14 def test_ssh(self):
15 (status, output) = self.target.run('uname -a')
16 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 @@
1import unittest
2from oeqa.oetest import oeRuntimeTest, skipModule
3from oeqa.utils.decorators import *
4
5def setUpModule():
6 if not oeRuntimeTest.hasFeature("systemd"):
7 skipModule("target doesn't have systemd in DISTRO_FEATURES")
8 if "systemd" != oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager", True):
9 skipModule("systemd is not the init manager for this image")
10
11
12class SystemdBasicTest(oeRuntimeTest):
13
14 @skipUnlessPassed('test_ssh')
15 def test_systemd_version(self):
16 (status, output) = self.target.run('systemctl --version')
17 self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output))
18
19class SystemdTests(oeRuntimeTest):
20
21 @skipUnlessPassed('test_systemd_version')
22 def test_systemd_failed(self):
23 (status, output) = self.target.run('systemctl --failed | grep "0 loaded units listed"')
24 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 @@
1import unittest
2from oeqa.oetest import oeRuntimeTest, skipModule
3from oeqa.utils.decorators import *
4
5def setUpModule():
6 if not oeRuntimeTest.hasFeature("x11-base"):
7 skipModule("target doesn't have x11 in IMAGE_FEATURES")
8
9
10class XorgTest(oeRuntimeTest):
11
12 @skipUnlessPassed('test_ssh')
13 def test_xorg_running(self):
14 (status, output) = self.target.run('ps | grep -v xinit | grep [X]org')
15 self.assertEqual(status, 0, msg="Xorg does not appear to be running %s" % self.target.run('ps')[1])
16
17 @skipUnlessPassed('test_ssh')
18 def test_xorg_error(self):
19 (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)"')
20 self.assertEqual(status, 1, msg="Errors in Xorg log: %s" % output)
21