All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP]  [PATCH] Fix failure of the utimes01 test
@ 2009-07-09  7:35 Wang Yong
  2009-07-10 10:46 ` Subrata Modak
  0 siblings, 1 reply; 10+ messages in thread
From: Wang Yong @ 2009-07-09  7:35 UTC (permalink / raw)
  To: ltp-list

Whenever system called utimes, the error message returned was EINVAL,
because the member variable of struct timeval was not initialized,
so initialize it.

Signed-off-by: WangYong <wangyong2009@cn.fujitsu.com>

diff -Nurp ltp-full-20090630/testcases/kernel/syscalls/utimes/utimes01.c
ltp-full-20090630.new/testcases/kernel/syscalls/utimes/utimes01.c
--- ltp.orig/testcases/kernel/syscalls/utimes/utimes01.c 2009-07-01
17:20:12.000000000 +0800
+++ ltp/testcases/kernel/syscalls/utimes/utimes01.c  2009-07-08
17:20:38.000000000 +0800
@@ -248,6 +248,7 @@ static int do_test(struct test_case *tc)
          /*
           * Execute system call
           */
+        memset(tv, 0, 2 * sizeof(struct timeval));
          tv[0].tv_sec = tc->a_sec;
          tv[1].tv_sec = tc->m_sec;
          TEST(len = strlen(fpath));



------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] [PATCH] Fix failure of the utimes01 test
  2009-07-09  7:35 [LTP] [PATCH] Fix failure of the utimes01 test Wang Yong
@ 2009-07-10 10:46 ` Subrata Modak
  2009-07-16  1:03   ` Wang Yong
  0 siblings, 1 reply; 10+ messages in thread
From: Subrata Modak @ 2009-07-10 10:46 UTC (permalink / raw)
  To: Wang Yong; +Cc: ltp-list

On Thu, 2009-07-09 at 15:35 +0800, Wang Yong wrote: 
> Whenever system called utimes, the error message returned was EINVAL,
> because the member variable of struct timeval was not initialized,
> so initialize it.
> 
> Signed-off-by: WangYong <wangyong2009@cn.fujitsu.com>
> 
> diff -Nurp ltp-full-20090630/testcases/kernel/syscalls/utimes/utimes01.c
> ltp-full-20090630.new/testcases/kernel/syscalls/utimes/utimes01.c
> --- ltp.orig/testcases/kernel/syscalls/utimes/utimes01.c 2009-07-01
> 17:20:12.000000000 +0800
> +++ ltp/testcases/kernel/syscalls/utimes/utimes01.c  2009-07-08
> 17:20:38.000000000 +0800
> @@ -248,6 +248,7 @@ static int do_test(struct test_case *tc)
>           /*
>            * Execute system call
>            */
> +        memset(tv, 0, 2 * sizeof(struct timeval));

Initializing this is good. But i do not find any visible difference in
running this test pre and post patching either on 2.6.29 or 2.6.18
kernels. The following output is generated each time:

# ./testcases/bin/utimes01 
utimes01    0  INFO  :  (case00) START
open failed.
utimes01    0  INFO  :  (case00) END => NG
utimes01    0  INFO  :  (case01) START
open failed.
utimes01    0  INFO  :  (case01) END => NG
utimes01    0  INFO  :  (case02) START
open failed.
utimes01    0  INFO  :  (case02) END => NG
utimes01    0  INFO  :  (case03) START
open failed.
utimes01    0  INFO  :  (case03) END => NG
utimes01    0  INFO  :  (case04) START
open failed.
utimes01    0  INFO  :  (case04) END => NG
utimes01    1  FAIL  :  utimes01 failed - errno = 2 : No such file or
directory
utimes01    0  INFO  :  NG

# echo $?
1

Regards--
Subrata

> tv[0].tv_sec = tc->a_sec;
>           tv[1].tv_sec = tc->m_sec;
>           TEST(len = strlen(fpath));
> 
> 
> 
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge  
> This is your chance to win up to $100,000 in prizes! For a limited time, 
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize  
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] [PATCH] Fix failure of the utimes01 test
  2009-07-10 10:46 ` Subrata Modak
@ 2009-07-16  1:03   ` Wang Yong
  2009-07-19  4:53     ` Garrett Cooper
  0 siblings, 1 reply; 10+ messages in thread
From: Wang Yong @ 2009-07-16  1:03 UTC (permalink / raw)
  To: subrata; +Cc: ltp-list

Hi, Subrata Modak

Subrata Modak wrote as:
> On Thu, 2009-07-09 at 15:35 +0800, Wang Yong wrote: 
>   
>> Whenever system called utimes, the error message returned was EINVAL,
>> because the member variable of struct timeval was not initialized,
>> so initialize it.
>>
>> Signed-off-by: WangYong <wangyong2009@cn.fujitsu.com>
>>
>> diff -Nurp ltp-full-20090630/testcases/kernel/syscalls/utimes/utimes01.c
>> ltp-full-20090630.new/testcases/kernel/syscalls/utimes/utimes01.c
>> --- ltp.orig/testcases/kernel/syscalls/utimes/utimes01.c 2009-07-01
>> 17:20:12.000000000 +0800
>> +++ ltp/testcases/kernel/syscalls/utimes/utimes01.c  2009-07-08
>> 17:20:38.000000000 +0800
>> @@ -248,6 +248,7 @@ static int do_test(struct test_case *tc)
>>           /*
>>            * Execute system call
>>            */
>> +        memset(tv, 0, 2 * sizeof(struct timeval));
>>     
>
> Initializing this is good. But i do not find any visible difference in
> running this test pre and post patching either on 2.6.29 or 2.6.18
> kernels. The following output is generated each time:
>
> # ./testcases/bin/utimes01 
> utimes01    0  INFO  :  (case00) START
> open failed.
> utimes01    0  INFO  :  (case00) END => NG
> utimes01    0  INFO  :  (case01) START
> open failed.
> utimes01    0  INFO  :  (case01) END => NG
> utimes01    0  INFO  :  (case02) START
> open failed.
> utimes01    0  INFO  :  (case02) END => NG
> utimes01    0  INFO  :  (case03) START
> open failed.
> utimes01    0  INFO  :  (case03) END => NG
> utimes01    0  INFO  :  (case04) START
> open failed.
> utimes01    0  INFO  :  (case04) END => NG
> utimes01    1  FAIL  :  utimes01 failed - errno = 2 : No such file or
> directory
> utimes01    0  INFO  :  NG
>
> # echo $?
> 1
>   
I have fixed this problem. 


[PATCH] Fix failure of the utimes01 test

Whenever system called utimes, the error message returned was EINVAL,
because the member variable of struct timeval was not initialized,
so initialize it.
This patch also fixed the path which we pass to setup_file(). If
progdir is not a absolute pathname of the working directory, the file
open will fail.
 
Signed-off-by: WangYong <wangyong2009@cn.fujitsu.com>

--- a/testcases/kernel/syscalls/utimes/utimes01.c	2009-07-15 10:22:41.000000000 +0800
+++ b/testcases/kernel/syscalls/utimes/utimes01.c	2009-07-16 08:55:13.000000000 +0800
@@ -138,7 +138,6 @@ void setup() {
  */
 static int opt_debug;
 static char *progname;
-static char *progdir;
 
 enum test_type {
 		NORMAL,
@@ -232,7 +231,7 @@ static int do_test(struct test_case *tc)
         struct stat st;
         uid_t old_uid;
 
-        TEST(rc = setup_file(progdir, "test.file", fpath));
+        TEST(rc = setup_file(TESTDIR, "test.file", fpath));
         if (rc < 0)
                 return 1;
 
@@ -248,6 +247,7 @@ static int do_test(struct test_case *tc)
         /*
          * Execute system call
          */
+        memset(tv, 0, sizeof(tv));
         tv[0].tv_sec = tc->a_sec;
         tv[1].tv_sec = tc->m_sec;
         TEST(len = strlen(fpath));
@@ -338,9 +338,6 @@ int main(int ac, char **av) {
 	progname = strchr(av[0], '/');
         progname = progname ? progname + 1 : av[0];	
 	
-	progdir = strdup(av[0]);
-        progdir = dirname(progdir);
-	
         /* parse standard options */
         if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
              tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);






------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] [PATCH] Fix failure of the utimes01 test
  2009-07-16  1:03   ` Wang Yong
@ 2009-07-19  4:53     ` Garrett Cooper
  2009-07-19  4:54       ` Garrett Cooper
  0 siblings, 1 reply; 10+ messages in thread
From: Garrett Cooper @ 2009-07-19  4:53 UTC (permalink / raw)
  To: Wang Yong; +Cc: ltp-list

On Wed, Jul 15, 2009 at 6:03 PM, Wang Yong<wangyong2009@cn.fujitsu.com> wrote:
> Hi, Subrata Modak
>
> Subrata Modak wrote as:
>> On Thu, 2009-07-09 at 15:35 +0800, Wang Yong wrote:
>>
>>> Whenever system called utimes, the error message returned was EINVAL,
>>> because the member variable of struct timeval was not initialized,
>>> so initialize it.
>>>
>>> Signed-off-by: WangYong <wangyong2009@cn.fujitsu.com>
>>>
>>> diff -Nurp ltp-full-20090630/testcases/kernel/syscalls/utimes/utimes01.c
>>> ltp-full-20090630.new/testcases/kernel/syscalls/utimes/utimes01.c
>>> --- ltp.orig/testcases/kernel/syscalls/utimes/utimes01.c 2009-07-01
>>> 17:20:12.000000000 +0800
>>> +++ ltp/testcases/kernel/syscalls/utimes/utimes01.c  2009-07-08
>>> 17:20:38.000000000 +0800
>>> @@ -248,6 +248,7 @@ static int do_test(struct test_case *tc)
>>>           /*
>>>            * Execute system call
>>>            */
>>> +        memset(tv, 0, 2 * sizeof(struct timeval));
>>>
>>
>> Initializing this is good. But i do not find any visible difference in
>> running this test pre and post patching either on 2.6.29 or 2.6.18
>> kernels. The following output is generated each time:
>>
>> # ./testcases/bin/utimes01
>> utimes01    0  INFO  :  (case00) START
>> open failed.
>> utimes01    0  INFO  :  (case00) END => NG
>> utimes01    0  INFO  :  (case01) START
>> open failed.
>> utimes01    0  INFO  :  (case01) END => NG
>> utimes01    0  INFO  :  (case02) START
>> open failed.
>> utimes01    0  INFO  :  (case02) END => NG
>> utimes01    0  INFO  :  (case03) START
>> open failed.
>> utimes01    0  INFO  :  (case03) END => NG
>> utimes01    0  INFO  :  (case04) START
>> open failed.
>> utimes01    0  INFO  :  (case04) END => NG
>> utimes01    1  FAIL  :  utimes01 failed - errno = 2 : No such file or
>> directory
>> utimes01    0  INFO  :  NG
>>
>> # echo $?
>> 1
>>
> I have fixed this problem.
>
>
> [PATCH] Fix failure of the utimes01 test
>
> Whenever system called utimes, the error message returned was EINVAL,
> because the member variable of struct timeval was not initialized,
> so initialize it.
> This patch also fixed the path which we pass to setup_file(). If
> progdir is not a absolute pathname of the working directory, the file
> open will fail.
>
> Signed-off-by: WangYong <wangyong2009@cn.fujitsu.com>
>
> --- a/testcases/kernel/syscalls/utimes/utimes01.c       2009-07-15 10:22:41.000000000 +0800
> +++ b/testcases/kernel/syscalls/utimes/utimes01.c       2009-07-16 08:55:13.000000000 +0800
> @@ -138,7 +138,6 @@ void setup() {
>  */
>  static int opt_debug;
>  static char *progname;
> -static char *progdir;
>
>  enum test_type {
>                NORMAL,
> @@ -232,7 +231,7 @@ static int do_test(struct test_case *tc)
>         struct stat st;
>         uid_t old_uid;
>
> -        TEST(rc = setup_file(progdir, "test.file", fpath));
> +        TEST(rc = setup_file(TESTDIR, "test.file", fpath));
>         if (rc < 0)
>                 return 1;
>
> @@ -248,6 +247,7 @@ static int do_test(struct test_case *tc)
>         /*
>          * Execute system call
>          */
> +        memset(tv, 0, sizeof(tv));
>         tv[0].tv_sec = tc->a_sec;
>         tv[1].tv_sec = tc->m_sec;
>         TEST(len = strlen(fpath));
> @@ -338,9 +338,6 @@ int main(int ac, char **av) {
>        progname = strchr(av[0], '/');
>         progname = progname ? progname + 1 : av[0];
>
> -       progdir = strdup(av[0]);
> -        progdir = dirname(progdir);
> -
>         /* parse standard options */
>         if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
>              tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);

That patch works so I'm going to commit it to CVS:

gcooper@orangebox /scratch/ltp-nova2/ltp-nova $
testcases/kernel/syscalls/utimes/utimes01
utimes01    0  INFO  :  (case00) START
utimes01    0  INFO  :  E:0,1000 <=> R:0,1000
EXPECT: return value(ret)=(N >= 0) errno=0 (Success)
RESULT: return value(ret)=       0 errno=0 (Success)
utimes01    0  INFO  :  (case00) END => OK
utimes01    0  INFO  :  (case01) START
utimes01    0  INFO  :  E:1000,0 <=> R:1000,0
EXPECT: return value(ret)=(N >= 0) errno=0 (Success)
RESULT: return value(ret)=       0 errno=0 (Success)
utimes01    0  INFO  :  (case01) END => OK
utimes01    0  INFO  :  (case02) START
seteuid failed.
utimes01    0  INFO  :  (case02) END => OK
utimes01    0  INFO  :  (case03) START
EXPECT: return value(ret)=-1 errno=2 (No such file or directory)
RESULT: return value(ret)=-1 errno=2 (No such file or directory)
utimes01    0  INFO  :  (case03) END => OK
utimes01    0  INFO  :  (case04) START
EXPECT: return value(ret)=-1 errno=14 (Bad address)
RESULT: return value(ret)=-1 errno=14 (Bad address)
utimes01    0  INFO  :  (case04) END => OK
utimes01    1  PASS  :  utimes call succeeded

Thanks!
-Garrett

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] [PATCH] Fix failure of the utimes01 test
  2009-07-19  4:53     ` Garrett Cooper
@ 2009-07-19  4:54       ` Garrett Cooper
  0 siblings, 0 replies; 10+ messages in thread
From: Garrett Cooper @ 2009-07-19  4:54 UTC (permalink / raw)
  To: Wang Yong; +Cc: ltp-list

On Sat, Jul 18, 2009 at 9:53 PM, Garrett Cooper<yanegomi@gmail.com> wrote:
> On Wed, Jul 15, 2009 at 6:03 PM, Wang Yong<wangyong2009@cn.fujitsu.com> wrote:
>> Hi, Subrata Modak
>>
>> Subrata Modak wrote as:
>>> On Thu, 2009-07-09 at 15:35 +0800, Wang Yong wrote:
>>>
>>>> Whenever system called utimes, the error message returned was EINVAL,
>>>> because the member variable of struct timeval was not initialized,
>>>> so initialize it.
>>>>
>>>> Signed-off-by: WangYong <wangyong2009@cn.fujitsu.com>
>>>>
>>>> diff -Nurp ltp-full-20090630/testcases/kernel/syscalls/utimes/utimes01.c
>>>> ltp-full-20090630.new/testcases/kernel/syscalls/utimes/utimes01.c
>>>> --- ltp.orig/testcases/kernel/syscalls/utimes/utimes01.c 2009-07-01
>>>> 17:20:12.000000000 +0800
>>>> +++ ltp/testcases/kernel/syscalls/utimes/utimes01.c  2009-07-08
>>>> 17:20:38.000000000 +0800
>>>> @@ -248,6 +248,7 @@ static int do_test(struct test_case *tc)
>>>>           /*
>>>>            * Execute system call
>>>>            */
>>>> +        memset(tv, 0, 2 * sizeof(struct timeval));
>>>>
>>>
>>> Initializing this is good. But i do not find any visible difference in
>>> running this test pre and post patching either on 2.6.29 or 2.6.18
>>> kernels. The following output is generated each time:
>>>
>>> # ./testcases/bin/utimes01
>>> utimes01    0  INFO  :  (case00) START
>>> open failed.
>>> utimes01    0  INFO  :  (case00) END => NG
>>> utimes01    0  INFO  :  (case01) START
>>> open failed.
>>> utimes01    0  INFO  :  (case01) END => NG
>>> utimes01    0  INFO  :  (case02) START
>>> open failed.
>>> utimes01    0  INFO  :  (case02) END => NG
>>> utimes01    0  INFO  :  (case03) START
>>> open failed.
>>> utimes01    0  INFO  :  (case03) END => NG
>>> utimes01    0  INFO  :  (case04) START
>>> open failed.
>>> utimes01    0  INFO  :  (case04) END => NG
>>> utimes01    1  FAIL  :  utimes01 failed - errno = 2 : No such file or
>>> directory
>>> utimes01    0  INFO  :  NG
>>>
>>> # echo $?
>>> 1
>>>
>> I have fixed this problem.
>>
>>
>> [PATCH] Fix failure of the utimes01 test
>>
>> Whenever system called utimes, the error message returned was EINVAL,
>> because the member variable of struct timeval was not initialized,
>> so initialize it.
>> This patch also fixed the path which we pass to setup_file(). If
>> progdir is not a absolute pathname of the working directory, the file
>> open will fail.
>>
>> Signed-off-by: WangYong <wangyong2009@cn.fujitsu.com>
>>
>> --- a/testcases/kernel/syscalls/utimes/utimes01.c       2009-07-15 10:22:41.000000000 +0800
>> +++ b/testcases/kernel/syscalls/utimes/utimes01.c       2009-07-16 08:55:13.000000000 +0800
>> @@ -138,7 +138,6 @@ void setup() {
>>  */
>>  static int opt_debug;
>>  static char *progname;
>> -static char *progdir;
>>
>>  enum test_type {
>>                NORMAL,
>> @@ -232,7 +231,7 @@ static int do_test(struct test_case *tc)
>>         struct stat st;
>>         uid_t old_uid;
>>
>> -        TEST(rc = setup_file(progdir, "test.file", fpath));
>> +        TEST(rc = setup_file(TESTDIR, "test.file", fpath));
>>         if (rc < 0)
>>                 return 1;
>>
>> @@ -248,6 +247,7 @@ static int do_test(struct test_case *tc)
>>         /*
>>          * Execute system call
>>          */
>> +        memset(tv, 0, sizeof(tv));
>>         tv[0].tv_sec = tc->a_sec;
>>         tv[1].tv_sec = tc->m_sec;
>>         TEST(len = strlen(fpath));
>> @@ -338,9 +338,6 @@ int main(int ac, char **av) {
>>        progname = strchr(av[0], '/');
>>         progname = progname ? progname + 1 : av[0];
>>
>> -       progdir = strdup(av[0]);
>> -        progdir = dirname(progdir);
>> -
>>         /* parse standard options */
>>         if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
>>              tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
>
> That patch works so I'm going to commit it to CVS:
>
> gcooper@orangebox /scratch/ltp-nova2/ltp-nova $
> testcases/kernel/syscalls/utimes/utimes01
> utimes01    0  INFO  :  (case00) START
> utimes01    0  INFO  :  E:0,1000 <=> R:0,1000
> EXPECT: return value(ret)=(N >= 0) errno=0 (Success)
> RESULT: return value(ret)=       0 errno=0 (Success)
> utimes01    0  INFO  :  (case00) END => OK
> utimes01    0  INFO  :  (case01) START
> utimes01    0  INFO  :  E:1000,0 <=> R:1000,0
> EXPECT: return value(ret)=(N >= 0) errno=0 (Success)
> RESULT: return value(ret)=       0 errno=0 (Success)
> utimes01    0  INFO  :  (case01) END => OK
> utimes01    0  INFO  :  (case02) START
> seteuid failed.
> utimes01    0  INFO  :  (case02) END => OK
> utimes01    0  INFO  :  (case03) START
> EXPECT: return value(ret)=-1 errno=2 (No such file or directory)
> RESULT: return value(ret)=-1 errno=2 (No such file or directory)
> utimes01    0  INFO  :  (case03) END => OK
> utimes01    0  INFO  :  (case04) START
> EXPECT: return value(ret)=-1 errno=14 (Bad address)
> RESULT: return value(ret)=-1 errno=14 (Bad address)
> utimes01    0  INFO  :  (case04) END => OK
> utimes01    1  PASS  :  utimes call succeeded
>
> Thanks!
> -Garrett

Nm -- someone else did with the correct memset size ;)...
Thanks,
-Garrett

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] [PATCH] Fix failure of the utimes01 test
  2009-07-21  4:24 ` Garrett Cooper
@ 2009-07-21  6:16   ` Wang Yong
  0 siblings, 0 replies; 10+ messages in thread
From: Wang Yong @ 2009-07-21  6:16 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: LTP



Garrett Cooper wrote as:
> On Mon, Jul 20, 2009 at 7:55 PM, Wang Yong<wangyong2009@cn.fujitsu.com> wrote:
>   
>> This patch also fixed the path which we pass to setup_file(). If
>> progdir is not a absolute pathname of the working directory, the file
>> open will fail.
>>
>> This patch fixed the problem.
>>
>> Signed-off-by: WangYong <wangyong2009@cn.fujitsu.com>
>>
>> diff -Nurp a/testcases/kernel/syscalls/utimes/utimes01.c b/testcases/kernel/syscalls/utimes/utimes01.c
>> --- a/testcases/kernel/syscalls/utimes/utimes01.c       2009-07-21 08:51:05.000000000 +0800
>> +++ b/testcases/kernel/syscalls/utimes/utimes01.c       2009-07-21 08:55:01.000000000 +0800
>> @@ -138,7 +138,6 @@ void setup() {
>>  */
>>  static int opt_debug;
>>  static char *progname;
>> -static char *progdir;
>>
>>  enum test_type {
>>                NORMAL,
>> @@ -232,7 +231,7 @@ static int do_test(struct test_case *tc)
>>         struct stat st;
>>         uid_t old_uid;
>>
>> -        TEST(rc = setup_file(progdir, "test.file", fpath));
>> +        TEST(rc = setup_file(TESTDIR, "test.file", fpath));
>>         if (rc < 0)
>>                 return 1;
>>
>> @@ -339,8 +338,6 @@ int main(int ac, char **av) {
>>        progname = strchr(av[0], '/');
>>         progname = progname ? progname + 1 : av[0];
>>
>> -       progdir = strdup(av[0]);
>> -        progdir = dirname(progdir);
>>
>>         /* parse standard options */
>>         if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
>>     
>
> Wang,
>     Would you please verify this diff in your environment too? It does
> what your diff did, in addition to fixes a harmless warning with
> -Wnonnull:
>
> 1. Fix the utimes testcase so that it passes with the appropriate
> non-hardcoded directory, as provided by Wang Yong
> <wangyong2009@cn.fujitsu.com>
> 2. Fix a compiler warning by using an intermediary const char*
> variable, as casting alone was still causing compiler warnings in gcc
> 4.3.2.
>   
Hi,

I have verified this diff in my environment. Your patch is ok.  
Thank you for having fixed the warning.

> Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
>
> Index: testcases/kernel/syscalls/utimes/utimes01.c
> ===================================================================
> RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/utimes/utimes01.c,v
> retrieving revision 1.2
> diff -u -r1.2 utimes01.c
> --- testcases/kernel/syscalls/utimes/utimes01.c 10 Jul 2009 10:14:59 -0000     1
> .2
> +++ testcases/kernel/syscalls/utimes/utimes01.c 21 Jul 2009 04:20:44 -0000
> @@ -138,7 +138,6 @@
>   */
>  static int opt_debug;
>  static char *progname;
> -static char *progdir;
>
>  enum test_type {
>                 NORMAL,
> @@ -232,7 +231,7 @@
>          struct stat st;
>          uid_t old_uid;
>
> -        TEST(rc = setup_file(progdir, "test.file", fpath));
> +        TEST(rc = setup_file(TESTDIR, "test.file", fpath));
>          if (rc < 0)
>                  return 1;
>
> @@ -257,9 +256,19 @@
>                  fpath[len - 1] = '\0';
>          }
>          errno = 0;
> -        if (tc->ttype == NO_FNAME)
> -                TEST(sys_ret = utimes(NULL, tv));
> -        else
> +        if (tc->ttype == NO_FNAME) {
> +                /**
> +                 * Note (garrcoop):
> +                 *
> +                 * If you do NULL directly, then gcc [4.3] will complain when
> +                 * one specifies -Wnonnull in CPPFLAGS. This is a negative
> +                 * test, but let's not allow the compiler to complain about
> +                 * something trivial like this.
> +                 **/
> +                const char *dummy = NULL;
> +                TEST(sys_ret = utimes(dummy, tv));
> +        }
> +       else
>                  TEST(sys_ret = utimes(fpath, tv));
>          sys_errno = errno;
>          if (tc->ttype == FILE_NOT_EXIST)
> @@ -339,9 +348,6 @@
>         progname = strchr(av[0], '/');
>          progname = progname ? progname + 1 : av[0];
>
> -       progdir = strdup(av[0]);
> -        progdir = dirname(progdir);
> -
>          /* parse standard options */
>          if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL)
> {
>               tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
>
>
>
>   

-- 
Wang Yong
Development Dept.I
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
8/F.,Civil Defense Building, No. 189 Guangzhou Rd,
Nanjing, 210029, China
TEL: +86+25-86630566-837
COINS: 79955-837
FAX: +86+25-83317685
MAIL: wangyong2009@cn.fujitsu.com



------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] [PATCH] Fix failure of the utimes01 test
  2009-07-21  2:55 Wang Yong
@ 2009-07-21  4:24 ` Garrett Cooper
  2009-07-21  6:16   ` Wang Yong
  0 siblings, 1 reply; 10+ messages in thread
From: Garrett Cooper @ 2009-07-21  4:24 UTC (permalink / raw)
  To: Wang Yong; +Cc: LTP

On Mon, Jul 20, 2009 at 7:55 PM, Wang Yong<wangyong2009@cn.fujitsu.com> wrote:
> This patch also fixed the path which we pass to setup_file(). If
> progdir is not a absolute pathname of the working directory, the file
> open will fail.
>
> This patch fixed the problem.
>
> Signed-off-by: WangYong <wangyong2009@cn.fujitsu.com>
>
> diff -Nurp a/testcases/kernel/syscalls/utimes/utimes01.c b/testcases/kernel/syscalls/utimes/utimes01.c
> --- a/testcases/kernel/syscalls/utimes/utimes01.c       2009-07-21 08:51:05.000000000 +0800
> +++ b/testcases/kernel/syscalls/utimes/utimes01.c       2009-07-21 08:55:01.000000000 +0800
> @@ -138,7 +138,6 @@ void setup() {
>  */
>  static int opt_debug;
>  static char *progname;
> -static char *progdir;
>
>  enum test_type {
>                NORMAL,
> @@ -232,7 +231,7 @@ static int do_test(struct test_case *tc)
>         struct stat st;
>         uid_t old_uid;
>
> -        TEST(rc = setup_file(progdir, "test.file", fpath));
> +        TEST(rc = setup_file(TESTDIR, "test.file", fpath));
>         if (rc < 0)
>                 return 1;
>
> @@ -339,8 +338,6 @@ int main(int ac, char **av) {
>        progname = strchr(av[0], '/');
>         progname = progname ? progname + 1 : av[0];
>
> -       progdir = strdup(av[0]);
> -        progdir = dirname(progdir);
>
>         /* parse standard options */
>         if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){

Wang,
    Would you please verify this diff in your environment too? It does
what your diff did, in addition to fixes a harmless warning with
-Wnonnull:

1. Fix the utimes testcase so that it passes with the appropriate
non-hardcoded directory, as provided by Wang Yong
<wangyong2009@cn.fujitsu.com>
2. Fix a compiler warning by using an intermediary const char*
variable, as casting alone was still causing compiler warnings in gcc
4.3.2.

Signed-off-by: Garrett Cooper <yanegomi@gmail.com>

Index: testcases/kernel/syscalls/utimes/utimes01.c
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/utimes/utimes01.c,v
retrieving revision 1.2
diff -u -r1.2 utimes01.c
--- testcases/kernel/syscalls/utimes/utimes01.c 10 Jul 2009 10:14:59 -0000     1
.2
+++ testcases/kernel/syscalls/utimes/utimes01.c 21 Jul 2009 04:20:44 -0000
@@ -138,7 +138,6 @@
  */
 static int opt_debug;
 static char *progname;
-static char *progdir;

 enum test_type {
                NORMAL,
@@ -232,7 +231,7 @@
         struct stat st;
         uid_t old_uid;

-        TEST(rc = setup_file(progdir, "test.file", fpath));
+        TEST(rc = setup_file(TESTDIR, "test.file", fpath));
         if (rc < 0)
                 return 1;

@@ -257,9 +256,19 @@
                 fpath[len - 1] = '\0';
         }
         errno = 0;
-        if (tc->ttype == NO_FNAME)
-                TEST(sys_ret = utimes(NULL, tv));
-        else
+        if (tc->ttype == NO_FNAME) {
+                /**
+                 * Note (garrcoop):
+                 *
+                 * If you do NULL directly, then gcc [4.3] will complain when
+                 * one specifies -Wnonnull in CPPFLAGS. This is a negative
+                 * test, but let's not allow the compiler to complain about
+                 * something trivial like this.
+                 **/
+                const char *dummy = NULL;
+                TEST(sys_ret = utimes(dummy, tv));
+        }
+       else
                 TEST(sys_ret = utimes(fpath, tv));
         sys_errno = errno;
         if (tc->ttype == FILE_NOT_EXIST)
@@ -339,9 +348,6 @@
        progname = strchr(av[0], '/');
         progname = progname ? progname + 1 : av[0];

-       progdir = strdup(av[0]);
-        progdir = dirname(progdir);
-
         /* parse standard options */
         if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL)
{
              tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [LTP]  [PATCH] Fix failure of the utimes01 test
@ 2009-07-21  2:55 Wang Yong
  2009-07-21  4:24 ` Garrett Cooper
  0 siblings, 1 reply; 10+ messages in thread
From: Wang Yong @ 2009-07-21  2:55 UTC (permalink / raw)
  To: LTP

This patch also fixed the path which we pass to setup_file(). If
progdir is not a absolute pathname of the working directory, the file
open will fail.

This patch fixed the problem.

Signed-off-by: WangYong <wangyong2009@cn.fujitsu.com>

diff -Nurp a/testcases/kernel/syscalls/utimes/utimes01.c b/testcases/kernel/syscalls/utimes/utimes01.c
--- a/testcases/kernel/syscalls/utimes/utimes01.c	2009-07-21 08:51:05.000000000 +0800
+++ b/testcases/kernel/syscalls/utimes/utimes01.c	2009-07-21 08:55:01.000000000 +0800
@@ -138,7 +138,6 @@ void setup() {
  */
 static int opt_debug;
 static char *progname;
-static char *progdir;
 
 enum test_type {
 		NORMAL,
@@ -232,7 +231,7 @@ static int do_test(struct test_case *tc)
         struct stat st;
         uid_t old_uid;
 
-        TEST(rc = setup_file(progdir, "test.file", fpath));
+        TEST(rc = setup_file(TESTDIR, "test.file", fpath));
         if (rc < 0)
                 return 1;
 
@@ -339,8 +338,6 @@ int main(int ac, char **av) {
 	progname = strchr(av[0], '/');
         progname = progname ? progname + 1 : av[0];	
 	
-	progdir = strdup(av[0]);
-        progdir = dirname(progdir);
 	
         /* parse standard options */
         if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){




------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [LTP]   [PATCH] Fix failure of the utimes01 test
@ 2009-07-21  2:25 Wang Yong
  0 siblings, 0 replies; 10+ messages in thread
From: Wang Yong @ 2009-07-21  2:25 UTC (permalink / raw)
  To: LTP

This patch also fixed the path which we pass to setup_file(). If
progdir is not a absolute pathname of the working directory, the file
open will fail.

Signed-off-by: WangYong <wangyong2009@cn.fujitsu.com>

--- a/testcases/kernel/syscalls/utimes/utimes01.c	2009-07-21 08:51:05.000000000 +0800
+++ b/testcases/kernel/syscalls/utimes/utimes01.c	2009-07-21 08:55:01.000000000 +0800
@@ -138,7 +138,6 @@ void setup() {
  */
 static int opt_debug;
 static char *progname;
-static char *progdir;
 
 enum test_type {
 		NORMAL,
@@ -232,7 +231,7 @@ static int do_test(struct test_case *tc)
         struct stat st;
         uid_t old_uid;
 
-        TEST(rc = setup_file(progdir, "test.file", fpath));
+        TEST(rc = setup_file(TESTDIR, "test.file", fpath));
         if (rc < 0)
                 return 1;
 
@@ -339,8 +338,6 @@ int main(int ac, char **av) {
 	progname = strchr(av[0], '/');
         progname = progname ? progname + 1 : av[0];	
 	
-	progdir = strdup(av[0]);
-        progdir = dirname(progdir);
 	
         /* parse standard options */
         if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){




------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] [PATCH] Fix failure of the utimes01 test
@ 2009-07-20  7:41 naresh kamboju
  0 siblings, 0 replies; 10+ messages in thread
From: naresh kamboju @ 2009-07-20  7:41 UTC (permalink / raw)
  To: WangYong; +Cc: ltp-list

>On Sat, Jul 18, 2009 at 9:53 PM, Garrett Cooper<yaneg...@gmail.com> >wrote:
>> On Wed, Jul 15, 2009 at 6:03 PM, Wang Yong<wangyong2...@cn.fujitsu.com> wrote:
>>> Hi, Subrata Modak
>>>
>>> Subrata Modak wrote as:
>>>>> Signed-off-by: WangYong <wangyong2...@cn.fujitsu.com>
>>>>>
>>>>> diff -Nurp ltp-full-20090630/testcases/kernel/syscalls/utimes/utimes01.c
>>>>> ltp-full-20090630.new/testcases/kernel/syscalls/utimes/utimes01.c
>>>>> --- ltp.orig/testcases/kernel/syscalls/utimes/utimes01.c 2009-07-01
>>>>> 17:20:12.000000000 +0800
>>>>> +++ ltp/testcases/kernel/syscalls/utimes/utimes01.c  2009-07-08
>>>>> 17:20:38.000000000 +0800
>>>>> @@ -248,6 +248,7 @@ static int do_test(struct test_case *tc)
>>>>>           /*
>>>>>            * Execute system call
>>>>>            */
>>>>> +        memset(tv, 0, 2 * sizeof(struct timeval));
>>>>>
>>>>
>>>> open failed.
>>>> utimes01    0  INFO  :  (case04) END => NG
>>>> utimes01    1  FAIL  :  utimes01 failed - errno = 2 : No such file or
>>>> directory
>>>> utimes01    0  INFO  :  NG
>>>>
>>>> # echo $?
>>>> 1
>>>>
>>> I have fixed this problem.
>>>
>>>
>>> [PATCH] Fix failure of the utimes01 test
>>>
>>> Whenever system called utimes, the error message returned was EINVAL,
>>> because the member variable of struct timeval was not initialized,
>>> so initialize it.
>>> This patch also fixed the path which we pass to setup_file(). If
>>> progdir is not a absolute pathname of the working directory, the file
>>> open will fail.
>>>
>>> Signed-off-by: WangYong <wangyong2...@cn.fujitsu.com>
>>>
>>> --- a/testcases/kernel/syscalls/utimes/utimes01.c       2009-07-15
>>> 10:22:41.000000000 +0800
>>> +++ b/testcases/kernel/syscalls/utimes/utimes01.c       2009-07-16
>>> 08:55:13.000000000 +0800
>>> @@ -138,7 +138,6 @@ void setup() {
>>>  */
>>>  static int opt_debug;
>>>  static char *progname;
>>> -static char *progdir;
>>>
>>>  enum test_type {
>>>                NORMAL,
>>> @@ -232,7 +231,7 @@ static int do_test(struct test_case *tc)
>>>         struct stat st;
>>>         uid_t old_uid;
>>>
>>> -        TEST(rc = setup_file(progdir, "test.file", fpath));
>>> +        TEST(rc = setup_file(TESTDIR, "test.file", fpath));
>>>         if (rc < 0)
>>>                 return 1;
>>>
>>> @@ -248,6 +247,7 @@ static int do_test(struct test_case *tc)
>>>         /*
>>>          * Execute system call
>>>          */
>>> +        memset(tv, 0, sizeof(tv));
>>>         tv[0].tv_sec = tc->a_sec;
>>>         tv[1].tv_sec = tc->m_sec;
>>>         TEST(len = strlen(fpath));
>>> @@ -338,9 +338,6 @@ int main(int ac, char **av) {
>>>        progname = strchr(av[0], '/');
>>>         progname = progname ? progname + 1 : av[0];
>>>
>>> -       progdir = strdup(av[0]);
>>> -        progdir = dirname(progdir);
>>> -
>>>         /* parse standard options */
>>>         if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char
>>> *)NULL){
>>>              tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
>>
>> That patch works so I'm going to commit it to CVS:
>>
>> gcoo...@orangebox /scratch/ltp-nova2/ltp-nova $
>> testcases/kernel/syscalls/utimes/utimes01
>> utimes01    0  INFO  :  (case04) END => OK
>> utimes01    1  PASS  :  utimes call succeeded
>>
>> Thanks!
>> -Garrett

>Nm -- someone else did with the correct memset size ;)...

Hi WangYong,
Your first patch submitted on 09 Jul 2009 is commited.
Second patch is not Commited because of conflict with patch.
Please take the latest source and prepare new patch regarding the
TESTDIR and resubmit it as per your mail on 15 Jul 2009.


Refrence:
http://ltp.cvs.sourceforge.net/viewvc/ltp/ltp/testcases/kernel/syscalls/utimes/utimes01.c?r1=1.2&view=log

http://www.mail-archive.com/ltp-list@lists.sourceforge.net/msg07429.html

Best regards,
Naresh Kamboju

>Thanks,
>-Garrett

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-07-21  6:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-09  7:35 [LTP] [PATCH] Fix failure of the utimes01 test Wang Yong
2009-07-10 10:46 ` Subrata Modak
2009-07-16  1:03   ` Wang Yong
2009-07-19  4:53     ` Garrett Cooper
2009-07-19  4:54       ` Garrett Cooper
2009-07-20  7:41 naresh kamboju
2009-07-21  2:25 Wang Yong
2009-07-21  2:55 Wang Yong
2009-07-21  4:24 ` Garrett Cooper
2009-07-21  6:16   ` Wang Yong

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.