commands/logrotate_tests.sh: Fix two issues
PATCH 1/1 commands/logrotate_tests.sh: Fix two issues
1) Pass correct arguments when calling tst_res command in logrotate_tests.sh
2) If syslog group doesn't exist on system, su option with it triggers a an 'unknow group' error in config file and then skips the config file. e.g. Running logrotate_sh gets either of the following errors, because logrotate command with above error returns non-zero exit status since commit e547b94 in logrotate:
---------------------------------------------------------
logrotate01 1 TFAIL : ltpapicmd.c:154: Test #1: logrotate command failed. Reason:
...
logrotate01 1 TFAIL : ltpapicmd.c:154: Test #1: logrotate command exited with 1 return code. Output:
---------------------------------------------------------
We just use syslog group if it actually exists.
--- testcases/commands/logrotate/logrotate_tests.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
testcases/commands/logrotate/logrotate_tests.sh +6 -2
@@ -154,6 +154,10 @@ test01() tst_resm TINFO "Test #1: 1. rotate /var/log/tst_logfile file." tst_resm TINFO "Test #1: 2. compresses it." + # Check if syslog group exists + local set_group="root" + grep -q syslog /etc/group && set_group="syslog" + # create config file. cat >$LTPTMP/tst_logrotate.conf <<-EOF #****** Begin Config file *******
@@ -164,7 +168,7 @@ test01() compress /var/log/tst_logfile { - su root syslog + su root ${set_group} rotate 5 weekly }
@@ -208,7 +212,7 @@ test01() $LTPTMP/tst_logrotate.out > $LTPTMP/tst_logrotate.err 2>&1 || RC=$? if [ $RC -ne 0 ] then - tst_res TFAIL > $LTPTMP/tst_logrotate.err 2>&1 \ + tst_res TFAIL $LTPTMP/tst_logrotate.err \ "Test #1: logrotate command failed. Reason:" else # Check if compressed log file is created.
Signature · 1 line
1.8.3.1
PATCH 1/1 commands/logrotate_tests.sh: Fix two issues
Hi Xiao,
Quoted 13 lines
1) Pass correct arguments when calling
tst_rescommand inlogrotate_tests.sh
2) If syslog group doesn't exist on system, su option with it triggers a an 'unknow group' error in config file and then skips the config file. e.g. Runninglogrotate_shgets either of the following errors, because logrotate command with above error returns non-zero exit status since commit e547b94 in logrotate:
---------------------------------------------------------
logrotate01 1 TFAIL : ltpapicmd.c:154: Test #1: logrotate command failed. Reason:
...
logrotate01 1 TFAIL : ltpapicmd.c:154: Test #1: logrotate command exited with 1 return code. Output:
---------------------------------------------------------
We just use syslog group if it actually exists.
Quoted 4 lines
Signed-off-by Xiao Yang <[email protected]>--- testcases/commands/logrotate/logrotate_tests.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
thanks for your commit, pushed with some changes (I split commit into 2, adjusted commit message, simplify variable name and reverse check logic to not repeat group name).
Kind regards,
Petr