diff options
-rw-r--r-- | meta/classes/testimage.bbclass | 4 | ||||
-rw-r--r-- | meta/lib/oeqa/runtime/df.py | 13 | ||||
-rw-r--r-- | meta/lib/oeqa/runtime/syslog.py | 37 |
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 | ||
3 | DEFAULT_TEST_SUITES = "ping auto" | 3 | DEFAULT_TEST_SUITES = "ping auto" |
4 | DEFAULT_TEST_SUITES_pn-core-image-minimal = "ping" | 4 | DEFAULT_TEST_SUITES_pn-core-image-minimal = "ping" |
5 | DEFAULT_TEST_SUITES_pn-core-image-sato = "ping ssh connman rpm smart xorg dmesg" | 5 | DEFAULT_TEST_SUITES_pn-core-image-sato = "ping ssh connman df rpm smart xorg syslog dmesg" |
6 | DEFAULT_TEST_SUITES_pn-core-image-sato-sdk = "ping ssh connman rpm smart gcc xorg dmesg" | 6 | DEFAULT_TEST_SUITES_pn-core-image-sato-sdk = "ping ssh connman df rpm smart gcc xorg syslog dmesg" |
7 | 7 | ||
8 | TEST_SUITES ?= "${DEFAULT_TEST_SUITES}" | 8 | TEST_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 @@ | |||
1 | import unittest | ||
2 | from oeqa.oetest import oeRuntimeTest | ||
3 | from oeqa.utils.decorators import * | ||
4 | |||
5 | def setUpModule(): | ||
6 | skipModuleUnless(oeRuntimeTest.tc.target.run('which df')[0] == 0, "No df in image or no connection") | ||
7 | |||
8 | class 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 @@ | |||
1 | import unittest | ||
2 | from oeqa.oetest import oeRuntimeTest, skipModule | ||
3 | from oeqa.utils.decorators import * | ||
4 | |||
5 | def setUpModule(): | ||
6 | if not oeRuntimeTest.hasPackage("syslog"): | ||
7 | skipModule("No syslog package in image") | ||
8 | |||
9 | class 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 | |||
21 | class 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") | ||