[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [LTP] unlink08 failed



On Mon, Feb 19, 2001 at 06:26:32PM +0900, Fumio Nakayama wrote:
> I downloaded ltp-20010122.tar.gz and run runalltests.sh.
> But testcase "unlink08" does not work fine when running by root.
 
> The following is the code fragment of unlink08.c
> 268     if ( geteuid() == 0 ) {
> 269         postest++;
> 270     }
> 271
> 272     for (ind=0; Test_cases[ind].desc != NULL; ind++ ) {
> 273         if ( postest )
> 274             Test_cases[ind].exp_ret=0;  /* set as a pos test */
> 275         Test_cases[ind].setupfunc(0);
> 276     }

Ugh!  What ugly code, but I'm not going to improve on the looks.  The
problem here is the third test case, unlink(<directory>) doesn't change
to a positive test case when you are root.  Since the two that do change
are EACCES test cases, I add that to the if condition.

--- unlink08.c  2000/11/15 15:18:33     1.1
+++ unlink08.c  2001/02/19 15:31:00
@@ -270,7 +270,7 @@
     }
 
     for (ind=0; Test_cases[ind].desc != NULL; ind++ ) {
-       if ( postest )
+       if ( Test_cases[ind].exp_errno == EACCES && postest )
            Test_cases[ind].exp_ret=0;  /* set as a pos test */
        Test_cases[ind].setupfunc(0);
     }

As I said, it's not pretty.  I'm commiting this to CVS.
-- 
Nate Straz                                              nstraz@sgi.com
sgi, inc                                           http://www.sgi.com/
Linux Test Project                    http://oss.sgi.com/projects/ltp/