summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Palalau <alexandru.palalau@intel.com>2013-07-12 13:44:37 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-07-16 10:04:16 +0100
commit2079a30b1f0d56271484adc708aa43c3f2808e2e (patch)
treecfce85101a3a25510a6ec06f5c12f14b9f15d79b
parent7f57d3c524068531eee1945ea6f700db9c4bbf1e (diff)
downloadpoky-2079a30b1f0d56271484adc708aa43c3f2808e2e.tar.gz
lib/oeqa/runtime: add tests for syslog and df
Add tests for free space and syslog. Changed in v2: - limit df's output to / - syslog: fix restart in case of systemd (From OE-Core rev: 1b39d57e7b5c9b69d565cf4d188ebc2f14e66ae6) Signed-off-by: Alexandru Palalau <alexandru.palalau@intel.com> Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/testimage.bbclass4
-rw-r--r--meta/lib/oeqa/runtime/df.py13
-rw-r--r--meta/lib/oeqa/runtime/syslog.py37
3 files changed, 52 insertions, 2 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index f66f514904..22f0a9269d 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -2,8 +2,8 @@ TEST_LOG_DIR ?= "${WORKDIR}/testimage"
2 2
3DEFAULT_TEST_SUITES = "ping auto" 3DEFAULT_TEST_SUITES = "ping auto"
4DEFAULT_TEST_SUITES_pn-core-image-minimal = "ping" 4DEFAULT_TEST_SUITES_pn-core-image-minimal = "ping"
5DEFAULT_TEST_SUITES_pn-core-image-sato = "ping ssh connman rpm smart xorg dmesg" 5DEFAULT_TEST_SUITES_pn-core-image-sato = "ping ssh connman df rpm smart xorg syslog dmesg"
6DEFAULT_TEST_SUITES_pn-core-image-sato-sdk = "ping ssh connman rpm smart gcc xorg dmesg" 6DEFAULT_TEST_SUITES_pn-core-image-sato-sdk = "ping ssh connman df rpm smart gcc xorg syslog dmesg"
7 7
8TEST_SUITES ?= "${DEFAULT_TEST_SUITES}" 8TEST_SUITES ?= "${DEFAULT_TEST_SUITES}"
9 9
diff --git a/meta/lib/oeqa/runtime/df.py b/meta/lib/oeqa/runtime/df.py
new file mode 100644
index 0000000000..c9119898dc
--- /dev/null
+++ b/meta/lib/oeqa/runtime/df.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 df')[0] == 0, "No df in image or no connection")
7
8class DfTest(oeRuntimeTest):
9
10 @skipUnlessPassed("test_ssh")
11 def test_df(self):
12 (status,output) = self.target.run("df / | sed -n '2p' | awk '{print $4}'")
13 self.assertTrue(int(output)>5120, msg="Not enough space on image. Current size is %s" % output)
diff --git a/meta/lib/oeqa/runtime/syslog.py b/meta/lib/oeqa/runtime/syslog.py
new file mode 100644
index 0000000000..cec4f978c2
--- /dev/null
+++ b/meta/lib/oeqa/runtime/syslog.py
@@ -0,0 +1,37 @@
1import unittest
2from oeqa.oetest import oeRuntimeTest, skipModule
3from oeqa.utils.decorators import *
4
5def setUpModule():
6 if not oeRuntimeTest.hasPackage("syslog"):
7 skipModule("No syslog package in image")
8
9class SyslogTest(oeRuntimeTest):
10
11 @skipUnlessPassed("test_ssh")
12 def test_syslog_help(self):
13 (status,output) = self.target.run('/sbin/syslogd --help')
14 self.assertEqual(status, 1, msg="status and output: %s and %s" % (status,output))
15
16 @skipUnlessPassed("test_syslog_help")
17 def test_syslogd_running(self):
18 (status,output) = self.target.run(oeRuntimeTest.pscmd + ' | grep -i [s]yslogd')
19 self.assertEqual(status, 0, msg="no syslogd process, ps output: %s" % self.target.run(oeRuntimeTest.pscmd)[1])
20
21class SyslogTestConfig(oeRuntimeTest):
22
23 def setUp(self):
24 self.target.run('echo "LOGFILE=/var/log/test" >> /etc/syslog-startup.conf')
25
26 @skipUnlessPassed("test_syslogd_running")
27 def test_syslogd_configurable(self):
28 if "systemd" != oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager"):
29 (status,output) = self.target.run('/etc/init.d/syslog restart')
30 else:
31 (status,output) = self.target.run('systemctl restart syslog.service')
32 self.assertEqual(status, 0, msg="Could not restart syslog service. Status and output: %s and %s" % (status,output))
33 (status,output) = self.target.run('logger foobar && grep foobar /var/log/test')
34 self.assertEqual(status, 0, msg="Test log string not found. Output: %s " % output)
35
36 def tearDown(self):
37 self.target.run("sed -i 's#LOGFILE=/var/log/test##' /etc/syslog-startup.conf")