Skip to contentSkip to conversation

cron: Rewrite and cleanup cron_tests.sh script

PATCH New Petr Vorel 2 participants 2 messages Mar 9, 2017

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH v2 1/1 cron: Rewrite and cleanup cron_tests.sh script

Look for results into more possible log locations, look also into journalctl output.

This fixes systems with different cron log (Debian, Ubuntu and their derivates, see github issue #136) and systems which log into journalctl only (openSUSE Tumbleweed).

---
 runtest/commands                      |   2 +-
 testcases/commands/cron/cron_tests.sh | 606 +++++++++++++---------------------
 2 files changed, 232 insertions(+), 376 deletions(-)
runtest/commands +1 -1
index fe9ce5d2d..fd5170339 100644
@@ -5,7 +5,7 @@ ldd01 ldd01
 nm01 nm01
 file01 file_test.sh
 tar01  tar_tests.sh
-cron export TCdat=$LTPROOT/testcases/bin; cron_tests.sh
+cron cron_tests.sh
 logrotate export TCdat=$LTPROOT/testcases/bin; logrotate_tests.sh
 mail export TCdat=$LTPROOT/testcases/bin; mail_tests.sh
 cpio01 cpio_tests.sh
testcases/commands/cron/cron_tests.sh +231 -375

649 lines not on this page · raw message

Signature · 1 line
2.12.0
#1 lore raw

PATCH v2 1/1 cron: Rewrite and cleanup cron_tests.sh script

Hi!

Quoted 6 lines

Look for results into more possible log locations, look also into journalctl output.

This fixes systems with different cron log (Debian, Ubuntu and their derivates, see github issue #136) and systems which log into journalctl only (openSUSE Tumbleweed).

Looks good, pushed, thanks.

testcases/commands/cron/cron_tests.sh line 134

Quoted 5 lines
testcases/commands/cron/cron_tests.sh +5 -0
+	sleep 10
+
+	grep_logs 'crontab.*REPLACE' \
+		"cron activity not recorded" \
+		"cron activity logged"

We can improve the grep_logs function and instead of sleeping for 10 seconds before we call it, we could grep the logs in a loop ten times, do 1s sleep at the end of the loop and exit with pass once the expected logs are found and with a failure once we are out of iterations. That should save ~20 seconds of the test runtime.

Signature · 2 lines
Cyril Hrubis
[email protected]