support/testing: improve commands on syslog-ng test
PATCH 1/1 support/testing: improve commands on syslog-ng test
There is no need for double grep, so choose a better regexp. Use && instead of ; between commands so the sequence of commands fail faster.
Break the last sequence of commands in 2 calls run() so the proper return code can be tested for each.
---
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/322021813
--- support/testing/tests/package/test_syslog_ng.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
support/testing/tests/package/test_syslog_ng.py +8 -6
@@ -19,18 +19,20 @@ class TestSyslogNg(infra.basetest.BRTest): options=["-initrd", cpio_file]) self.emulator.login() - cmd = "grep syslog-ng /var/log/messages | grep starting" + cmd = "grep 'syslog-ng starting' /var/log/messages" _, exit_code = self.emulator.run(cmd) self.assertEqual(exit_code, 0) - cmd = "logger my-message;" - cmd += "sleep 1;" + cmd = "logger my-message && " + cmd += "sleep 1 && " cmd += "grep my-message /var/log/messages" _, exit_code = self.emulator.run(cmd) self.assertEqual(exit_code, 0) - cmd = "syslog-ng-ctl reload;" - cmd += "sleep 1;" - cmd += "grep syslog-ng /var/log/messages | grep -i warning" + cmd = "syslog-ng-ctl reload && " + cmd += "sleep 1" + _, exit_code = self.emulator.run(cmd) + self.assertEqual(exit_code, 0) + cmd = "grep -i 'syslog-ng.*warning' /var/log/messages" _, exit_code = self.emulator.run(cmd) self.assertEqual(exit_code, 1)
Signature · 1 line
2.17.1
Thomas Petazzoni
AppliedPATCH 1/1 support/testing: improve commands on syslog-ng test
Quoted 6 lines · On Tue, 15 Oct 2019 22:09:50 -0300 Ricardo Martincoski…
There is no need for double grep, so choose a better regexp. Use && instead of ; between commands so the sequence of commands fail faster.
Break the last sequence of commands in 2 callsrun()so the proper return code can be tested for each.
Quoted 6 lines
Signed-off-by Ricardo Martincoski <[email protected]>---
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/322021813--- support/testing/tests/package/test_syslog_ng.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com