2018-04-19 21:14:18 +02:00
|
|
|
import os
|
|
|
|
|
|
|
|
import infra.basetest
|
|
|
|
|
|
|
|
|
|
|
|
class TestSyslogNg(infra.basetest.BRTest):
|
|
|
|
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
|
|
|
"""
|
|
|
|
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
|
|
|
|
BR2_PACKAGE_SYSLOG_NG=y
|
|
|
|
BR2_TARGET_ROOTFS_CPIO=y
|
2019-07-31 01:13:21 +02:00
|
|
|
# BR2_TARGET_ROOTFS_TAR is not set
|
2019-08-03 07:22:14 +02:00
|
|
|
"""
|
2018-04-19 21:14:18 +02:00
|
|
|
|
|
|
|
def test_run(self):
|
|
|
|
cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
|
2019-08-03 07:22:14 +02:00
|
|
|
self.emulator.boot(arch="armv5",
|
|
|
|
kernel="builtin",
|
|
|
|
options=["-initrd", cpio_file])
|
2018-04-19 21:14:18 +02:00
|
|
|
self.emulator.login()
|
|
|
|
|
2019-10-16 03:09:50 +02:00
|
|
|
cmd = "grep 'syslog-ng starting' /var/log/messages"
|
2021-06-26 15:32:38 +02:00
|
|
|
self.assertRunOk(cmd)
|
2018-04-19 21:14:18 +02:00
|
|
|
|
2019-10-16 03:09:50 +02:00
|
|
|
cmd = "logger my-message && "
|
|
|
|
cmd += "sleep 1 && "
|
2018-04-19 21:14:18 +02:00
|
|
|
cmd += "grep my-message /var/log/messages"
|
2021-06-26 15:32:38 +02:00
|
|
|
self.assertRunOk(cmd)
|
2018-04-19 21:14:18 +02:00
|
|
|
|
2019-10-16 03:09:50 +02:00
|
|
|
cmd = "syslog-ng-ctl reload && "
|
|
|
|
cmd += "sleep 1"
|
2021-06-26 15:32:38 +02:00
|
|
|
self.assertRunOk(cmd)
|
|
|
|
|
2019-10-16 03:09:50 +02:00
|
|
|
cmd = "grep -i 'syslog-ng.*warning' /var/log/messages"
|
2018-04-19 21:14:18 +02:00
|
|
|
_, exit_code = self.emulator.run(cmd)
|
|
|
|
self.assertEqual(exit_code, 1)
|