From 90b4e075f4e0c180f4e52e29c4443c6294687363 Mon Sep 17 00:00:00 2001 From: Aníbal Limón Date: Tue, 31 Jan 2017 15:05:54 -0600 Subject: oeqa/runtime/cases: Rename syslog module to oe_syslog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Debian based distros has a builtin syslog module so when try to load tests using unittest it references the builtin module instead of runtime/cases. [YOCTO #10964] (From OE-Core rev: 9923e3cdb58c2b3c54ec5fe99b2cec4cdc9fff92) Signed-off-by: Aníbal Limón Signed-off-by: Mariano Lopez Signed-off-by: Richard Purdie --- meta/lib/oeqa/runtime/cases/oe_syslog.py | 66 ++++++++++++++++++++++++++++++++ meta/lib/oeqa/runtime/cases/syslog.py | 66 -------------------------------- 2 files changed, 66 insertions(+), 66 deletions(-) create mode 100644 meta/lib/oeqa/runtime/cases/oe_syslog.py delete mode 100644 meta/lib/oeqa/runtime/cases/syslog.py (limited to 'meta/lib/oeqa/runtime') diff --git a/meta/lib/oeqa/runtime/cases/oe_syslog.py b/meta/lib/oeqa/runtime/cases/oe_syslog.py new file mode 100644 index 0000000000..005b6978d9 --- /dev/null +++ b/meta/lib/oeqa/runtime/cases/oe_syslog.py @@ -0,0 +1,66 @@ +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.core.decorator.oeid import OETestID +from oeqa.core.decorator.data import skipIfDataVar +from oeqa.runtime.decorator.package import OEHasPackage + +class SyslogTest(OERuntimeTestCase): + + @OETestID(201) + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(["busybox-syslog", "sysklogd"]) + def test_syslog_running(self): + cmd = '%s | grep -i [s]yslogd' % self.tc.target_cmds['ps'] + status, output = self.target.run(cmd) + msg = "No syslogd process; ps output: %s" % output + self.assertEqual(status, 0, msg=msg) + +class SyslogTestConfig(OERuntimeTestCase): + + @OETestID(1149) + @OETestDepends(['oe_syslog.SyslogTest.test_syslog_running']) + def test_syslog_logger(self): + status, output = self.target.run('logger foobar') + msg = "Can't log into syslog. Output: %s " % output + self.assertEqual(status, 0, msg=msg) + + status, output = self.target.run('grep foobar /var/log/messages') + if status != 0: + if self.tc.td.get("VIRTUAL-RUNTIME_init_manager") == "systemd": + status, output = self.target.run('journalctl -o cat | grep foobar') + else: + status, output = self.target.run('logread | grep foobar') + msg = ('Test log string not found in /var/log/messages or logread.' + ' Output: %s ' % output) + self.assertEqual(status, 0, msg=msg) + + @OETestID(1150) + @OETestDepends(['oe_syslog.SyslogTest.test_syslog_running']) + def test_syslog_restart(self): + if "systemd" != self.tc.td.get("VIRTUAL-RUNTIME_init_manager", ""): + (_, _) = self.target.run('/etc/init.d/syslog restart') + else: + (_, _) = self.target.run('systemctl restart syslog.service') + + + @OETestID(202) + @OETestDepends(['oe_syslog.SyslogTestConfig.test_syslog_logger']) + @OEHasPackage(["!sysklogd", "busybox"]) + @skipIfDataVar('VIRTUAL-RUNTIME_init_manager', 'systemd', + 'Not appropiate for systemd image') + def test_syslog_startup_config(self): + cmd = 'echo "LOGFILE=/var/log/test" >> /etc/syslog-startup.conf' + self.target.run(cmd) + status, output = self.target.run('/etc/init.d/syslog restart') + msg = ('Could not restart syslog service. Status and output:' + ' %s and %s' % (status,output)) + self.assertEqual(status, 0, msg) + + cmd = 'logger foobar && grep foobar /var/log/test' + status,output = self.target.run(cmd) + msg = 'Test log string not found. Output: %s ' % output + self.assertEqual(status, 0, msg=msg) + + cmd = "sed -i 's#LOGFILE=/var/log/test##' /etc/syslog-startup.conf" + self.target.run(cmd) + self.target.run('/etc/init.d/syslog restart') diff --git a/meta/lib/oeqa/runtime/cases/syslog.py b/meta/lib/oeqa/runtime/cases/syslog.py deleted file mode 100644 index 537c519482..0000000000 --- a/meta/lib/oeqa/runtime/cases/syslog.py +++ /dev/null @@ -1,66 +0,0 @@ -from oeqa.runtime.case import OERuntimeTestCase -from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID -from oeqa.core.decorator.data import skipIfDataVar -from oeqa.runtime.decorator.package import OEHasPackage - -class SyslogTest(OERuntimeTestCase): - - @OETestID(201) - @OETestDepends(['ssh.SSHTest.test_ssh']) - @OEHasPackage(["busybox-syslog", "sysklogd"]) - def test_syslog_running(self): - cmd = '%s | grep -i [s]yslogd' % self.tc.target_cmds['ps'] - status, output = self.target.run(cmd) - msg = "No syslogd process; ps output: %s" % output - self.assertEqual(status, 0, msg=msg) - -class SyslogTestConfig(OERuntimeTestCase): - - @OETestID(1149) - @OETestDepends(['syslog.SyslogTest.test_syslog_running']) - def test_syslog_logger(self): - status, output = self.target.run('logger foobar') - msg = "Can't log into syslog. Output: %s " % output - self.assertEqual(status, 0, msg=msg) - - status, output = self.target.run('grep foobar /var/log/messages') - if status != 0: - if self.tc.td.get("VIRTUAL-RUNTIME_init_manager") == "systemd": - status, output = self.target.run('journalctl -o cat | grep foobar') - else: - status, output = self.target.run('logread | grep foobar') - msg = ('Test log string not found in /var/log/messages or logread.' - ' Output: %s ' % output) - self.assertEqual(status, 0, msg=msg) - - @OETestID(1150) - @OETestDepends(['syslog.SyslogTest.test_syslog_running']) - def test_syslog_restart(self): - if "systemd" != self.tc.td.get("VIRTUAL-RUNTIME_init_manager", ""): - (_, _) = self.target.run('/etc/init.d/syslog restart') - else: - (_, _) = self.target.run('systemctl restart syslog.service') - - - @OETestID(202) - @OETestDepends(['syslog.SyslogTestConfig.test_syslog_logger']) - @OEHasPackage(["!sysklogd", "busybox"]) - @skipIfDataVar('VIRTUAL-RUNTIME_init_manager', 'systemd', - 'Not appropiate for systemd image') - def test_syslog_startup_config(self): - cmd = 'echo "LOGFILE=/var/log/test" >> /etc/syslog-startup.conf' - self.target.run(cmd) - status, output = self.target.run('/etc/init.d/syslog restart') - msg = ('Could not restart syslog service. Status and output:' - ' %s and %s' % (status,output)) - self.assertEqual(status, 0, msg) - - cmd = 'logger foobar && grep foobar /var/log/test' - status,output = self.target.run(cmd) - msg = 'Test log string not found. Output: %s ' % output - self.assertEqual(status, 0, msg=msg) - - cmd = "sed -i 's#LOGFILE=/var/log/test##' /etc/syslog-startup.conf" - self.target.run(cmd) - self.target.run('/etc/init.d/syslog restart') -- cgit v1.2.3-54-g00ecf