From: Subrata <sub...@us...> - 2008-10-29 08:43:36
|
Update of /cvsroot/ltp/ltp/testcases/commands/cron In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9685/ltp/testcases/commands/cron Modified Files: cron_tests.sh Log Message: The attached patch fixes some errors when running with Ubuntu due to some bash specific syntax. It also has some minor cosmetic and indentation changes. CAVEATS: 1- The comparisons failed because the script was generating empty files and the comparisons in line 181 failed. However the test proceeded as if the comparisons were successful. There is still room for improvement. 2- I had to change Ubuntu default configuration (enable cron log file and rename it from cron.log to cron) for the test to succeed. Signed-Off-By: Elder Costa <eld...@te...> Index: cron_tests.sh =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/commands/cron/cron_tests.sh,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** cron_tests.sh 9 Dec 2003 18:39:40 -0000 1.12 --- cron_tests.sh 29 Oct 2008 08:43:28 -0000 1.13 *************** *** 89,93 **** DATE=\`date\` ! echo "Hello Hell today is \$DATE " &>$LTPTMP/tst1_cron.out exit 0 EOF --- 89,93 ---- DATE=\`date\` ! echo "Hello Hell today is \$DATE " > $LTPTMP/tst1_cron.out 2>&1 exit 0 EOF *************** *** 100,104 **** $LTPBIN/tst_resm TINFO "Test #1: Installing cron job ... " ! crontab $LTPTMP/tst1_cronjob.cron &>$LTPTMP/cron_tst2n1.out RC=$? --- 100,104 ---- $LTPBIN/tst_resm TINFO "Test #1: Installing cron job ... " ! crontab $LTPTMP/tst1_cronjob.cron >$LTPTMP/cron_tst2n1.out 2>&1 RC=$? *************** *** 115,119 **** tail -n 10 /var/log/messages | grep crontab | grep REPLACE \ ! &>$LTPTMP/cron_tst2n1.out RC=$? ##### --- 115,119 ---- tail -n 10 /var/log/messages | grep crontab | grep REPLACE \ ! > $LTPTMP/cron_tst2n1.out 2>&1 RC=$? ##### *************** *** 123,127 **** $LTPBIN/tst_resm TINFO "Test #1: /var/log/cron: Trying altenate log..." tail -n 10 /var/log/cron | grep crontab | grep REPLACE \ ! &>$LTPTMP/cron_tst2n1.out RC=$? fi --- 123,127 ---- $LTPBIN/tst_resm TINFO "Test #1: /var/log/cron: Trying altenate log..." tail -n 10 /var/log/cron | grep crontab | grep REPLACE \ ! > $LTPTMP/cron_tst2n1.out 2>&1 RC=$? fi *************** *** 183,200 **** # if the value of the minute field did not advance by 1 # flag as failure. ! FAILCNT=$(( $FAILCNT+1 )) ! echo "\n\t\tExpected $TS_MIN2 \n Received $TS_MIN1" \ > $LTPTMP/tst1_cron.log $LTPBIN/tst_res TFAIL $LTPTMP/tst1_cron.log \ "Test #1: Failed to update every minute. Reason:" ! crontab -r &>/dev/null break else ! echo "\n\t\t Expected $TS_MIN2 \n Received $TS_MIN1" \ > $LTPTMP/tst1_cron.log $LTPBIN/tst_res TINFO $LTPTMP/tst1_cron.log \ "Test #1: Values are good: " fi ! LOOP_CNTR=$(( $LOOP_CNTR-1 )) done --- 183,200 ---- # if the value of the minute field did not advance by 1 # flag as failure. ! FAILCNT=$(( $FAILCNT+1 )) ! echo "\n\t\tExpected $TS_MIN2 \n\t\tReceived $TS_MIN1" \ > $LTPTMP/tst1_cron.log $LTPBIN/tst_res TFAIL $LTPTMP/tst1_cron.log \ "Test #1: Failed to update every minute. Reason:" ! crontab -r >/dev/null 2>&1 break else ! echo "\n\t\tExpected $TS_MIN2 \n\t\tReceived $TS_MIN1" \ > $LTPTMP/tst1_cron.log $LTPBIN/tst_res TINFO $LTPTMP/tst1_cron.log \ "Test #1: Values are good: " fi ! LOOP_CNTR=$(( $LOOP_CNTR-1 )) done *************** *** 202,206 **** then # check if var/log/messages file was updated. ! grep "CMD ($LTPTMP/tst1_cronprg.sh)" /var/log/messages &>$LTPTMP/cron_tst2n1.out RC=$? ##### --- 202,206 ---- then # check if var/log/messages file was updated. ! grep "CMD ($LTPTMP/tst1_cronprg.sh)" /var/log/messages >$LTPTMP/cron_tst2n1.out 2>&1 RC=$? ##### *************** *** 210,214 **** $LTPBIN/tst_resm TINFO "Test #1: /var/log/cron: alternate..." grep "CMD ($LTPTMP/tst1_cronprg.sh)" /var/log/cron \ ! &>$LTPTMP/cron_tst2n1.out RC=$? fi --- 210,214 ---- $LTPBIN/tst_resm TINFO "Test #1: /var/log/cron: alternate..." grep "CMD ($LTPTMP/tst1_cronprg.sh)" /var/log/cron \ ! >$LTPTMP/cron_tst2n1.out 2>&1 RC=$? fi *************** *** 229,233 **** #remove the cron job that was installed. ! crontab -r &>/dev/null --- 229,233 ---- #remove the cron job that was installed. ! crontab -r >/dev/null 2>&1 *************** *** 251,259 **** EOF ! chmod +x $LTPTMP/tst2_cronprg.sh &>/dev/null $LTPBIN/tst_resm TINFO "Test #2: installing crontab file." ! crontab $LTPTMP/tst2_cronjob.cron &>$LTPTMP/cron_tst2n1.out if [ $? -ne 0 ] --- 251,259 ---- EOF ! chmod +x $LTPTMP/tst2_cronprg.sh >/dev/null 2>&1 $LTPBIN/tst_resm TINFO "Test #2: installing crontab file." ! crontab $LTPTMP/tst2_cronjob.cron >$LTPTMP/cron_tst2n1.out 2>&1 if [ $? -ne 0 ] *************** *** 267,271 **** tail -n 10 /var/log/messages | grep crontab | grep REPLACE \ ! &>$LTPTMP/cron_tst2n1.out RC=$? ##### --- 267,271 ---- tail -n 10 /var/log/messages | grep crontab | grep REPLACE \ ! >$LTPTMP/cron_tst2n1.out 2>&1 RC=$? ##### *************** *** 275,279 **** $LTPBIN/tst_resm TINFO "Test #1: /var/log/cron: alternate..." tail -n 10 /var/log/cron | grep crontab | grep REPLACE \ ! &>$LTPTMP/cron_tst2n1.out RC=$? fi --- 275,279 ---- $LTPBIN/tst_resm TINFO "Test #1: /var/log/cron: alternate..." tail -n 10 /var/log/cron | grep crontab | grep REPLACE \ ! >$LTPTMP/cron_tst2n1.out 2>&1 RC=$? fi *************** *** 287,291 **** $LTPBIN/tst_resm TINFO "Test #2: uninstalling crontab file." ! crontab -r &>$LTPTMP/cron_tst2n1.out RC=$? --- 287,291 ---- $LTPBIN/tst_resm TINFO "Test #2: uninstalling crontab file." ! crontab -r >$LTPTMP/cron_tst2n1.out 2>&1 RC=$? *************** *** 296,300 **** TFAILCNT=$(( $TFAILCNT+1 )) else ! tail -n 10 /var/log/messages | grep DELETE &>$LTPTMP/cron_tst2n1.out RC=$? ##### --- 296,300 ---- TFAILCNT=$(( $TFAILCNT+1 )) else ! tail -n 10 /var/log/messages | grep DELETE >$LTPTMP/cron_tst2n1.out 2>&1 RC=$? ##### *************** *** 304,308 **** $LTPBIN/tst_resm TINFO "Test #1: /var/log/cron: alternate..." tail -n 10 /var/log/cron | grep DELETE \ ! &>$LTPTMP/cron_tst2n1.out RC=$? fi --- 304,308 ---- $LTPBIN/tst_resm TINFO "Test #1: /var/log/cron: alternate..." tail -n 10 /var/log/cron | grep DELETE \ ! >$LTPTMP/cron_tst2n1.out 2>&1 RC=$? fi *************** *** 337,344 **** EOF ! chmod +x $LTPTMP/tst2_cronprg.sh &>/dev/null $LTPBIN/tst_resm TINFO "Test #3: installing crontab file ..." ! crontab $LTPTMP/tst2_cronjob.cron &>$LTPTMP/cron_tst2n1.out if [ $? -ne 0 ] then --- 337,344 ---- EOF ! chmod +x $LTPTMP/tst2_cronprg.sh >/dev/null 2>&1 $LTPBIN/tst_resm TINFO "Test #3: installing crontab file ..." ! crontab $LTPTMP/tst2_cronjob.cron >$LTPTMP/cron_tst2n1.out 2>&1 if [ $? -ne 0 ] then *************** *** 350,354 **** fi ! crontab -l | grep "$LTPTMP/tst2_cronprg.sh" &>$LTPTMP/cron_tst2n1.out RC=$? if [ $RC -ne 0 ] --- 350,354 ---- fi ! crontab -l | grep "$LTPTMP/tst2_cronprg.sh" >$LTPTMP/cron_tst2n1.out 2>&1 RC=$? if [ $RC -ne 0 ] *************** *** 363,367 **** $LTPBIN/tst_resm TINFO "Test #3: uninstalling crontab file." ! crontab -r &>/dev/null if [ $? -ne 0 ] --- 363,367 ---- $LTPBIN/tst_resm TINFO "Test #3: uninstalling crontab file." ! crontab -r >/dev/null 2>&1 if [ $? -ne 0 ] *************** *** 371,378 **** fi ! crontab -l &>$LTPTMP/cron_tst2.out if [ $? -ne 0 ] then ! grep "no crontab for" $LTPTMP/cron_tst2.out &>$LTPTMP/cron_tst2n1.out RC=$? if [ $RC -ne 0 ] --- 371,378 ---- fi ! crontab -l >$LTPTMP/cron_tst2.out 2>&1 if [ $? -ne 0 ] then ! grep "no crontab for" $LTPTMP/cron_tst2.out >$LTPTMP/cron_tst2n1.out 2>&1 RC=$? if [ $RC -ne 0 ] |