On Wed, Mar 04, 2009 at 10:28:21AM +0100, Francesco RUNDO wrote:
>
>>>
>>> Ok, just to better describe my opinion (I hope without misunderstanding  
>>> ;-)
>>> In the while loop we're analyzing, you rightly process the notified  
>>> events with different checks.Ok, it is right.
>>>
>>> My suggest is to avoid to use "also" the check (with TFAIL) related to  
>>> TST_COUNT as it will be of course executed.
>>>
>>> In fact, the events to be notified are 9 (the value of TST_COUNT) but if  
>>> we start with tst_count=0, at the end (tst_count=9) you got a  
>>> "tst_resm(TFAIL, "get unnecessary event:......." even though "all the  
>>> notified events" have been rightly processed. I'm not sure about that.
>>
>>
>> No, you don't. At the end, tst_count (or test_num) will be 9, but you will 
>>  already have run out of the buffer, so the "unnecessary event..." will 
>> not  be reported. See: 
>
>
may be you use old kernel, it had bug, read follow links:
http://sourceforge.net/mailarchive/forum.php?thread_name=1137da9d0808260129s64327d9bva1ecc47122a0d064%40mail.gmail.com&forum_name=ltp-list
https://bugzilla.redhat.com/show_bug.cgi?id=453990
> I'm not sure about your code analysis.
> It is right that at the end of events-process phase, the tst_count is 9 but 
> starting from tst_count=0 (the code runs first while cycle with 
> tst_count=0), the total number of cycles are 10 and not 9 as you said.
> In that case, you are still within the while loop so that you got the 
> failure related to unnecessary event.
>
> I post the following log(s)-inotify02-issue.tar.gz- as you've requested me, 
> running the inotify02 test
>
> Log(s) got running ORIGINAL inotify02 (source code inotify02.c as released 
> in LTP-20090131.tgz with only fix about #define HAVE_SYS_INOTIFY_H):
>
> inotify02-origin.log
> inotify02-origin.strace.log
>
> From the above log(s) you can see that the total number of cycles are 10. 
> Clearly, in that case, we exit with unnecessary event error.
>
> Log(s) got running PATCHED inotify02 (source code inotify02.c as released 
> in LTP-20090131.tgz with fix about #define HAVE_SYS_INOTIFY_H and while 
> loop, as you know):
>
> inotify02-patched.log
> inotify02-patched.strace.log
>
> Now, the test runs only 9 checks (which are the defined and expected 
> notified events) without error. This log confirms the ouput log you sent 
> me.
>
> What I really don't understand is how you were able to get the same log I 
> got (with my patch applied) without the patch on the inotify02.c file.
>
> Regards
> FR
>
>>
>>
>> ji...@debian:/usr/src/ltp-git/testcases/kernel/syscalls/inotify$  
>> ./inotify02
>> inotify02    1  PASS  :  get event: wd=1 mask=40000004 cookie=0 len=0  
>> name=""
>> inotify02    2  PASS  :  get event: wd=1 mask=100 cookie=0 len=16  
>> name="test_file1"
>> inotify02    3  PASS  :  get event: wd=1 mask=20 cookie=0 len=16  
>> name="test_file1"
>> inotify02    4  PASS  :  get event: wd=1 mask=8 cookie=0 len=16  
>> name="test_file1"
>> inotify02    5  PASS  :  get event: wd=1 mask=40 cookie=81986 len=16  
>> name="test_file1"
>> inotify02    6  PASS  :  get event: wd=1 mask=80 cookie=81986 len=16  
>> name="test_file2"
>> inotify02    7  PASS  :  get event: wd=1 mask=800 cookie=0 len=0 name=""
>> inotify02    8  PASS  :  get event: wd=1 mask=200 cookie=0 len=16  
>> name="test_file2"
>> inotify02    9  PASS  :  get event: wd=1 mask=800 cookie=0 len=0 name=""
>> ji...@debian:/usr/src/ltp-git/testcases/kernel/syscalls/inotify$ echo $?
>> 0
>>
>> If you're actually getting enythig else, please post the actual output of  
>> inotify02 and the (standard & error) output of "strace -e read=3 
>> inotify02"
>>
>> Regards
>>     Jiri Palecek
>>
>>>>>>>> plain text document attachment  
>>>>>>>> (ltp-full-20090131-fix-inotify02.patch)
>>>>>>>> This patch avoid to run the istructions within the while loop if  no 
>>>>>>>>   more events have been collected.
>>>>>>>> Signed-off-by: Francesco Rundo <[email protected]>
>>>>>>>> ---    
>>>>>>>> ltp-full-20090131/testcases/kernel/syscalls/inotify/inotify02.c.origin 
>>>>>>>>      2009-03-02  09:16:53.110000000 +0100
>>>>>>>> +++    
>>>>>>>> ltp-full-20090131/testcases/kernel/syscalls/inotify/inotify02.c      
>>>>>>>> 2009-03-02  09:37:04.470002000 +0100
>>>>>>>> @@ -54,7 +54,7 @@
>>>>>>>>  #include "test.h"
>>>>>>>>  #include "usctest.h"
>>>>>>>>
>>>>>>>> -#if defined(__NR_inotify_init) && defined(HAVE_SYS_INOTIFY)
>>>>>>>> +#if defined(__NR_inotify_init) && defined(HAVE_SYS_INOTIFY_H)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Jiri Palecek <[email protected]> already made these changes last  
>>>>>>> month,   Mon Feb 23 07:18:46 2009 UTC.
>>>>>>>
>>>>>>>>  #include <sys/inotify.h>
>>>>>>>>
>>>>>>>>  #ifndef IN_MOVE_SELF
>>>>>>>>
>>>>>>>
>>>>>>> You probably need only the following:
>>>>>>>
>>>>>>> Signed-Off-By: Francesco RUNDO <[email protected]>,
>>>>>>> Signed-Off-By: Subrata Modak <[email protected]>,
>>>>>>> -- ---    
>>>>>>> ltp-full-20090228/testcases/kernel/syscalls/inotify/inotify02.c.orig  
>>>>>>>     2009-03-03  14:40:23.000000000 +0530
>>>>>>> +++    
>>>>>>> ltp-full-20090228/testcases/kernel/syscalls/inotify/inotify02.c      
>>>>>>> 2009-03-03  14:36:37.000000000 +0530
>>>>>>> @@ -246,25 +246,17 @@ int main(int ac, char **av){
>>>>>>>         }
>>>>>>> -        while (i < len) {
>>>>>>> +        while ((i < len)&&(test_num < TST_TOTAL)) {
>>>>>>>              struct inotify_event *event;
>>>>>>>              event = (struct inotify_event *) &event_buf[i];
>>>>>>> -            if (test_num >= TST_TOTAL){
>>>>>>> -                tst_resm(TFAIL, "get unnecessary event: "
>>>>>>> -                    "wd=%d mask=%x cookie=%u len=%u"
>>>>>>> -                    "name=\"%s\"",event->wd, event->mask,
>>>>>>> -                    event->cookie, event->len,
>>>>>>> -                            event->name);
>>>>>>> -
>>>>>>> -            } else     if ((event_set[test_num].mask ==  
>>>>>>> event->mask)  &&
>>>>>>> -                    (! strncmp( event_set[test_num].name,
>>>>>>> -                        event->name, event->len))) {
>>>>>>> +            if ((event_set[test_num].mask == event->mask) &&
>>>>>>> +                (! strncmp( event_set[test_num].name,
>>>>>>> +                            event->name, event->len))) {
>>>>>>>                  tst_resm(TPASS, "get event: wd=%d mask=%x"
>>>>>>> -                        " cookie=%u len=%u name=\"%s\"",
>>>>>>> -                        event->wd, event->mask,
>>>>>>> -                        event->cookie, event->len,
>>>>>>> -                        event->name);
>>>>>>> -
>>>>>>> +                         " cookie=%u len=%u name=\"%s\"",
>>>>>>> +                         event->wd, event->mask,
>>>>>>> +                         event->cookie, event->len,
>>>>>>> +                         event->name);
>>>>>>>              } else {
>>>>>>>                  tst_resm(TFAIL, "get event: wd=%d mask=%x "
>>>>>>>                      "(expected %x) cookie=%u len=%u "
>>>>>>>
>>>>>>> @@ -375,7 +368,7 @@
>>>>>>>
>>>>>>>>      tst_resm(TCONF, "Inotify syscall can be found at kernel  2.6.13 
>>>>>>>>  or  higher.");
>>>>>>>>      return 0;
>>>>>>>>  #endif
>>>>>>>> -#ifndef HAVE_SYS_INOTIFY
>>>>>>>> +#ifndef HAVE_SYS_INOTIFY_H
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Same here. Changes are already in CVS.
>>>>>>>
>>>>>>> Regards--
>>>>>>> Subrata
>>>>>>>
>>>>>>>>      tst_resm(TBROK, "can't find header sys/inotify.h");
>>>>>>>>      return 1;
>>>>>>>>  #endif
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>>




------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to