From: Wanlong Gao <gaowanlong@cn.fujitsu.com>
To: Shang Yanfeng <YanFeng.Shang@windriver.com>
Cc: ltp-list@lists.sourceforge.net, Markos.Chandras@imgtec.com
Subject: Re: [LTP] [PATCH] updated logrotate_test.sh for some issue
Date: Tue, 07 Feb 2012 15:22:32 +0800 [thread overview]
Message-ID: <4F30D138.7000509@cn.fujitsu.com> (raw)
In-Reply-To: <1327811245-12314-1-git-send-email-YanFeng.Shang@windriver.com>
Hi Shang:
> 1. fixed some formatting issue.
You should submit a separated patch to fix the formatting or coding style
issue, than with other fixes.
Since, this patch is so messy that making it hardly to be reviewed. ;)
Thanks
-Wanlong Gao
> 2. Because some log file isn't exist defaultly in configure file in
> logrotate.d directory,add missingok parameter.
> 3. previous case use tst_logrotate.cron and tst_addtolog.cron configure file,
> when using the second cron confiure file,the first expires,so updated its
> to one configure.
>
> Signed-off-by: Shang Yanfeng <YanFeng.Shang@windriver.com>
> ---
> testcases/commands/logrotate/logrotate_tests.sh | 59 ++++++++---------------
> 1 files changed, 21 insertions(+), 38 deletions(-)
>
> diff --git a/testcases/commands/logrotate/logrotate_tests.sh b/testcases/commands/logrotate/logrotate_tests.sh
> index 827dd5f..6efb184 100755
> --- a/testcases/commands/logrotate/logrotate_tests.sh
> +++ b/testcases/commands/logrotate/logrotate_tests.sh
> @@ -28,11 +28,11 @@
> # logfile is set for rotation every week. Execute the command
> # logrotate -f <file.conf>, check to see if it forced rotation.
> # Test #2: Check if logrotate running as a cronjob will rotate a
> -# logfile when it exceeds a specific size. Create two cronjobs
> +# logfile when it exceeds a specific size. Create two cronjobs
> # 1. runs a command to log a string to a logfile. 2. runs
> # logrotate <file.conf> every minute. The conf file specifies
> # that the rotation happen only if the log file exceeds 2k file
> -# size.
> +# size.
> #
> # Author: Manoj Iyer, manjo@mail.utexas.edu
> #
> @@ -47,7 +47,7 @@
> #
> # Input: - $1 - calling test case.
> # - $2 - command that needs to be checked.
> -#
> +#
> # Return: - zero on success.
> # - non-zero on failure.
> chk_ifexists()
> @@ -66,9 +66,9 @@ chk_ifexists()
> # Function: init
> #
> # Description: - Check if command required for this test exits.
> -# - Create temporary directories required for this test.
> +# - Create temporary directories required for this test.
> # - Initialize global variables.
> -#
> +#
> # Return: - zero on success.
> # - non-zero on failure.
> init()
> @@ -134,7 +134,7 @@ cleanup()
> # - use force option to force logrotate to cause the log file to
> # be rotated.
> # - compress the file after rotation.
> -#
> +#
> # Return: - zero on success.
> # - non-zero on failure.
> test01()
> @@ -161,7 +161,7 @@ test01()
>
> # compress the log files
> compress
> -
> + missingok
> # RPM packages drop log rotation information into this directory
> include /etc/logrotate.d
>
> @@ -182,7 +182,7 @@ test01()
> while [ $count -lt 10 ]
> do
> echo "This a dummy log file used to test logrotate command." >> \
> - /var/log/tst_logfile
> + /var/log/tst_logfile
> count=$(( $count+1 ))
> done
>
> @@ -283,41 +283,24 @@ cat >/var/log/tst_largelogfile <<EOF
> # getting rotated.
> EOF
>
> -# create logrotate cron job.
> -cat >$LTPTMP/tst_logrotate.cron <<EOF
> -* * * * * logrotate $LTPTMP/tst_largelog.conf
> -EOF
> -
> -chmod 777 $LTPTMP/tst_logrotate.cron > /dev/null 2>&1
> -
> -tst_resm TINFO "Test #2: Installing cron job to run logrotate"
> -crontab $LTPTMP/tst_logrotate.cron > $LTPTMP/tst_logrotate.out 2>&1 || RC=$?
> -if [ $RC -ne 0 ]
> -then
> - echo "Exit status of crontab command: $RC" >> tst_logrotate.out 2>/dev/null
> - tst_brk TBROK $LTPTMP/tst_logrotate.out NULL \
> - "Test #2: crontab Broke while installing cronjob. Reason:"
> - TFAILCNT=$(( $TFAILCN+1 ))
> -else
> - tst_resm TINFO "Test #2: Cronjob installed successfully"
> -fi
> -
> -# cron job to increase the log file size.
> -cat >$LTPTMP/tst_addtolog.cron <<EOF
>
> -* * * * * echo "To Err Is Human, To Really Screw Up You Need A Computer." >>/var/log/tst_largelogfile 2>/dev/null
> +tst_resm TINFO "Test #2: Installing cron jobs to run logrotate and to increase logsize"
> +# Path of cron does not include /usr/sbin
> +crontab - > $LTPTMP/tst_logrotate.out 2>&1 <<EOF
> +* * * * * $(which logrotate) $LTPTMP/tst_largelog.conf
> +* * * * * echo "To Err Is Human, To Really Screw Up You Need A Computer." >>/var/log/tst_largelogfile 2>/dev/null
> EOF
>
> -tst_resm TINFO "Test #2: Installing cron job to increase logsize"
> -crontab $LTPTMP/tst_addtolog.cron > $LTPTMP/tst_logrotate.out 2>&1 || RC=$?
> +RC=$?
> +
> if [ $RC -ne 0 ]
> then
> echo "Exit status of crontab command: $RC" >> tst_logrotate.out 2>/dev/null
> - tst_brk TBROK $LTPTMP/tst_logrotate.out NULL \
> - "Test #2: crontab Broke while installing cronjob. Reason:"
> - TFAILCNT=$(( $TFAILCN+1 ))
> + tst_brk TBROK $LTPTMP/tst_logrotate.out NULL \
> + "Test #2: crontab Broke while installing cron jobs. Reason:"
> + TFAILCNT=$(( $TFAILCN+1 ))
> else
> - tst_resm TINFO "Test #2: Cronjob installed successfully"
> + tst_resm TINFO "Test #2: Cron jobs installed successfully"
> fi
>
> # let cron jobs get started.
> @@ -368,12 +351,12 @@ fi
> #
> # Description: - Execute all tests and report results.
> #
> -# Exit: - zero on success
> +# Exit: - zero on success
> # - non-zero on failure.
>
> RC=0
> init || exit $?
>
> -test01 || RC=$?
> +test01 && test02 || RC=$?
>
> exit $RC
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
prev parent reply other threads:[~2012-02-07 7:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-29 4:27 [LTP] [PATCH] updated logrotate_test.sh for some issue Shang Yanfeng
2012-02-07 7:22 ` Wanlong Gao [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F30D138.7000509@cn.fujitsu.com \
--to=gaowanlong@cn.fujitsu.com \
--cc=Markos.Chandras@imgtec.com \
--cc=YanFeng.Shang@windriver.com \
--cc=ltp-list@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.