Thanks Cai for pointing those out.
On Sat, 2008-11-15 at 10:10 -0800, CAI Qian wrote:
> Hi,
>
>
>
> ----- Original Message ----
> > From: Subrata Modak <[EMAIL PROTECTED]>
> > To: ltp-list <[EMAIL PROTECTED]>
> > Sent: Wednesday, November 12, 2008 7:30:24 PM
> > Subject: [LTP] [PATCH 1/6] Integrate unzip tests to runtest/commands file
> >
> > Signed-Off-By: Subrata Modak
> > --
> >
> > --- ltp-intermediate-20081112/testcases/commands/Makefile.orig
> > 2008-11-12 14:27:09.000000000 +0530
> > +++ ltp-intermediate-20081112/testcases/commands/Makefile 2008-11-12
> > 14:41:32.000000000 +0530
> > @@ -1,5 +1,5 @@
> > #SUBDIRS = `ls */Makefile | sed "s/Makefile//g" | grep -v at | grep -v
> > unzip`
> > -SUBDIRS = `ls */Makefile | sed "s/Makefile//g" | grep -v unzip`
> > +SUBDIRS = `ls */Makefile | sed "s/Makefile//g"`
> >
> > all:
> > @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i ; done
> > ---
> > ltp-intermediate-20081112/testcases/commands/unzip/unzip_tests.sh.orig
> > 2008-11-12 14:34:59.000000000 +0530
> > +++ ltp-intermediate-20081112/testcases/commands/unzip/unzip_tests.sh
> > 2008-11-12 15:30:45.000000000 +0530
> > @@ -50,12 +50,12 @@
> > #
> > # Return: - zero on success.
> > # - non-zero on failure.
> > +
> > chk_ifexists()
> > {
> > RC=0
> > -
> > - which $2 &>$LTPTMP/tst_unzip.err || RC=$?
> > - if [ $RC -ne 0 ]
> > + which $2 > $LTPTMP/tst_unzip.err || RC=$?
>
> The better convention would be,
>
> which $2 > $LTPTMP/tst_unzip.err 2>&1 || RC=$?
>
> > + if [ $? -ne 0 ]
>
> I cannot see why it needs $? instead of $RC here. It is almost certain that
> $? will always be 0 here.
>
> > then
> > tst_brkm TBROK NULL "$1: command $2 not found."
> > fi
> > @@ -92,7 +92,7 @@ init()
> > # Initialize global variables.
> > export RC=0
> > export TST_TOTAL=1
> > - export TCID="unzip"
> > + export TCID="unzip01"
> > export TST_COUNT=0
> >
> > # Inititalize cleanup function.
> > @@ -105,7 +105,7 @@ init()
> > chk_ifexists INIT awk || return $RC
> >
> > # create the temporary directory used by this testcase
> > - if [ -z $TMP ]
> > + if [ -d $TMP ]
>
> This is wrong logic. The full original block here is,
>
> # create the temporary directory used by this testcase
> if [ -d $TMP ]
> then
> LTPTMP=/tmp/tst_unzip.$$
> TMP=/tmp
> else
> LTPTMP=$TMP/tst_unzip.$$
> fi
>
> So, changing it to,
>
> if [ ! -d "$TMP" ]
>
> works correctly.
>
> > then
> > LTPTMP=/tmp/tst_unzip.$$
> > TMP=/tmp
> > @@ -113,7 +113,7 @@ init()
> > LTPTMP=$TMP/tst_unzip.$$
> > fi
> >
> > - mkdir -p $LTPTMP &>/dev/null || RC=$?
> > + mkdir -p $LTPTMP >/dev/null || RC=$?
>
> Same here.
>
> mkdir -p $LTPTMP >/dev/null 2>&1 || RC=$?
>
> > if [ $RC -ne 0 ]
> > then
> > tst_brkm TBROK "INIT: Unable to create temporary directory"
> > @@ -162,15 +162,14 @@ test01()
> >
> > tst_resm TINFO "Test #1: unzip command un-compresses a .zip file."
> >
> > - unzip $TMP/tst_unzip_file.zip &>$LTPTMP/tst_unzip.out || RC=$?
> > + unzip $TMP/tst_unzip_file.zip >$LTPTMP/tst_unzip.out || RC=$?
>
> Same as the above.
>
> > if [ $RC -ne 0 ]
> > then
> > tst_res TFAIL $LTPTMP/tst_unzip.out \
> > "Test #1: unzip command failed. Return value = $RC. Details:"
> > return $RC
> > else
> > - diff -iwB $LTPTMP/tst_unzip.out $LTPTMP/tst_unzip.out.exp \
> > - &>$LTPTMP/tst_unzip.out.err || RC=$?
> > + diff -iwB $LTPTMP/tst_unzip.out $LTPTMP/tst_unzip.out.exp >
> > $LTPTMP/tst_unzip.out.err || RC=$?
>
> Same as the above.
>
> > if [ $RC -ne 0 ]
> > then
> > tst_res TFAIL $LTPTMP/tst_unzip.err \
> > --- ltp-intermediate-20081112/runtest/commands.orig 2008-11-12
> > 14:28:58.000000000 +0530
> > +++ ltp-intermediate-20081112/runtest/commands 2008-11-12
> > 15:33:37.000000000 +0530
> > @@ -10,3 +10,5 @@ cron export TCdat=$LTPROOT/testcases/bin
> > logrotate export TCdat=$LTPROOT/testcases/bin; logrotate_tests.sh
> > mail export TCdat=$LTPROOT/testcases/bin; mail_tests.sh
> > cpio export TCdat=$LTPROOT/testcases/bin; cpio_tests.sh
> > +unzip01 unzip_tests.sh
> > +
> >
>
> Since the code has already been committed to CVS, I submit a patch on the top
> of it.
>
> Signed-off-by: CAI Qian <[EMAIL PROTECTED]>
But this fails to apply even on today´s snapshot. Can you please look
into this ?
ltp-intermediate-20081117]$ patch --dry-run -p0
< ../17_11_2008-\([EMAIL PROTECTED]
\)-Integrate_unzip_tests_to_runtest-commands_file.patch
patching file testcases/commands/unzip/unzip_tests.sh
Hunk #1 FAILED at 54.
Hunk #2 FAILED at 105.
Hunk #3 FAILED at 113.
Hunk #4 FAILED at 162.
4 out of 4 hunks FAILED -- saving rejects to file
testcases/commands/unzip/unzip_tests.sh.rej
Regards--
Subrata
>
> --- testcases/commands/unzip/unzip_tests.sh.orig 2008-11-16
> 02:10:26.862720782 +0800
> +++ testcases/commands/unzip/unzip_tests.sh 2008-11-16 01:49:51.141720286
> +0800
> @@ -54,8 +54,8 @@
> chk_ifexists()
> {
> RC=0
> - which $2 > $LTPTMP/tst_unzip.err || RC=$?
> - if [ $RC -ne 0 ]
> + which $2 > $LTPTMP/tst_unzip.err 2>&1 || RC=$?
> + if [ $? -ne 0 ]
> then
> tst_brkm TBROK NULL "$1: command $2 not found."
> fi
> @@ -105,7 +105,7 @@
> chk_ifexists INIT awk || return $RC
>
> # create the temporary directory used by this testcase
> - if [ -d $TMP ]
> + if [ ! -d "$TMP" ]
> then
> LTPTMP=/tmp/tst_unzip.$$
> TMP=/tmp
> @@ -113,7 +113,7 @@
> LTPTMP=$TMP/tst_unzip.$$
> fi
>
> - mkdir -p $LTPTMP >/dev/null || RC=$?
> + mkdir -p $LTPTMP >/dev/null 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brkm TBROK "INIT: Unable to create temporary directory"
> @@ -162,14 +162,14 @@
>
> tst_resm TINFO "Test #1: unzip command un-compresses a .zip file."
>
> - unzip $TMP/tst_unzip_file.zip >$LTPTMP/tst_unzip.out || RC=$?
> + unzip $TMP/tst_unzip_file.zip >$LTPTMP/tst_unzip.out 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_unzip.out \
> "Test #1: unzip command failed. Return value = $RC. Details:"
> return $RC
> else
> - diff -iwB $LTPTMP/tst_unzip.out $LTPTMP/tst_unzip.out.exp >
> $LTPTMP/tst_unzip.out.err || RC=$?
> + diff -iwB $LTPTMP/tst_unzip.out $LTPTMP/tst_unzip.out.exp >
> $LTPTMP/tst_unzip.out.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_unzip.err \
>
>
>
> >
> > Regards--
> > Subrata
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Ltp-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ltp-list
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list