From: CAI Q. <ca...@cc...> - 2008-10-29 14:32:17
|
Hi, --- Elder Costa <eld...@te...> wrote: > CAI Qian wrote: > > Hi, > > > > This patch fixes a comparison failure spotted by Elder Costa > because > > the script was generating empty files. > > > > Signed-off-by: CAI Qian <ca...@cc...> > > > > --- cron_tests.sh.orig 2008-10-29 12:42:46.510747851 +0800 > > +++ cron_tests.sh 2008-10-29 12:43:50.124748312 +0800 > > @@ -178,7 +178,7 @@ > > TS_MIN2=$(awk '{print $8}' $LTPTMP/tst1_cron.out | > > awk -F: '{printf("%d", $2);}') > > > > - if [ $TS_MIN2 -ne $TS_MIN1 ] > > + if [ "$TS_MIN2" != "$TS_MIN1" ] > > then > > # if the value of the minute field did not advance by 1 > > # flag as failure. > > Hello Cai. > > This does not solve the problem: the test still fails if the file is > empty. I think this issue would require the some rework on the script > > for it to better handle exceptions such as empty files. As the > original > problem was caused by bash specific statements which failed to create > > the script ran by cron (and AFAICT other files as well) I think the > issue is solved. May I propose to revert this line to the original > one > just to keep things simple? > Sure. Alternatively, do you think if this is sufficient? - if [ $TS_MIN2 -ne $TS_MIN1 ] + if [ "$TS_MIN2" ] && [ "$TS_MIN2" != "$TS_MIN1" ] > Elder. > > > |