On Thu, 2008-03-27 at 16:53 +0800, Li Zefan wrote:
> The 9th testcase of inotify02 failed due to event coalescence. We fix
> this by moving the IN_DELETE test in between of the 2 IN_MOVE_SELF
> events.
>
> Also add the test for event coalescence.
>
> Signed-off-by: Li Zefan <[EMAIL PROTECTED]>
Thanks for the Patches. Mike/Ricardo, do yo have any comments here ??
Regards--
Subrata
> ---
> README | 6 ++++--
> inotify02.c | 45 ++++++++++++++++++++++++++++-----------------
> 2 files changed, 32 insertions(+), 19 deletions(-)
>
> diff -Nurp
> ltp-full-20080229.orig/testcases/kernel/syscalls/inotify/inotify02.c
> ltp-full-20080229/testcases/kernel/syscalls/inotify/inotify02.c
> --- ltp-full-20080229.orig/testcases/kernel/syscalls/inotify/inotify02.c
> 2008-03-27 13:52:20.000000000 +0800
> +++ ltp-full-20080229/testcases/kernel/syscalls/inotify/inotify02.c
> 2008-03-27 16:44:35.000000000 +0800
> @@ -37,6 +37,9 @@
> * 01/06/2007 - Fix to compile inotify test case with kernel that does
> * not support it. Ricardo Salveti de Araujo <[EMAIL PROTECTED]>
> *
> + * 03/27/2008 - Fix the test failure due to event coalescence. Also add
> + * test for this event coalescence. Li Zefan <[EMAIL PROTECTED]>
> + *
> *
> ***************************************************************************/
>
> #include <stdio.h>
> @@ -70,7 +73,7 @@ int TST_TOTAL=9; /* Total num
> extern int Tst_count; /* Test Case counter for tst_* routines */
>
> #define BUF_SIZE 256
> -char fname1[BUF_SIZE], fname2[BUF_SIZE];
> +char fname1[BUF_SIZE], fname2[BUF_SIZE], fname3[BUF_SIZE];
> char buf[BUF_SIZE];
> int fd, fd_notify;
> int wd;
> @@ -173,19 +176,6 @@ int main(int ac, char **av){
> strcpy(event_set[Tst_count].name, FILE_NAME2);
> Tst_count++;
>
> -
> -
> - if (unlink(FILE_NAME2) == -1){
> - tst_brkm(TBROK, cleanup,
> - "unlink(%s) Failed, errno=%d : %s",
> - FILE_NAME2,
> - errno, strerror(errno));
> - }
> - event_set[Tst_count].mask = IN_DELETE;
> - strcpy(event_set[Tst_count].name, FILE_NAME2);
> - Tst_count++;
> -
> -
> if (getcwd(fname1, BUF_SIZE) == NULL){
> tst_brkm(TBROK, cleanup,
> "getcwd(%x, %d) Failed, errno=%d : %s",
> @@ -193,7 +183,7 @@ int main(int ac, char **av){
> errno, strerror(errno));
> }
>
> - snprintf(fname2, BUF_SIZE, "%s.rename", fname1);
> + snprintf(fname2, BUF_SIZE, "%s.rename1", fname1);
> if (rename(fname1, fname2) == -1){
> tst_brkm(TBROK, cleanup,
> "rename(%s, %s) Failed, errno=%d : %s",
> @@ -204,11 +194,32 @@ int main(int ac, char **av){
> strcpy(event_set[Tst_count].name, "");
> Tst_count++;
>
> + if (unlink(FILE_NAME2) == -1){
> + tst_brkm(TBROK, cleanup,
> + "unlink(%s) Failed, errno=%d : %s",
> + FILE_NAME2,
> + errno, strerror(errno));
> + }
> + event_set[Tst_count].mask = IN_DELETE;
> + strcpy(event_set[Tst_count].name, FILE_NAME2);
> + Tst_count++;
> +
> + /*
> + * test that duplicate events will be coalesced into
> + * a single event
> + */
> + snprintf(fname3, BUF_SIZE, "%s.rename2", fname1);
> + if (rename(fname2, fname3) == -1){
> + tst_brkm(TBROK, cleanup,
> + "rename(%s, %s) Failed, errno=%d : %s",
> + fname2, fname3,
> + errno, strerror(errno));
> + }
>
> - if (rename(fname2, fname1) == -1){
> + if (rename(fname3, fname1) == -1){
> tst_brkm(TBROK, cleanup,
> "rename(%s, %s) Failed, errno=%d : %s",
> - fname2, fname1,
> + fname3, fname1,
> errno, strerror(errno));
> }
> event_set[Tst_count].mask = IN_MOVE_SELF;
> diff -Nurp ltp-full-20080229.orig/testcases/kernel/syscalls/inotify/README
> ltp-full-20080229/testcases/kernel/syscalls/inotify/README
> --- ltp-full-20080229.orig/testcases/kernel/syscalls/inotify/README
> 2008-02-29 15:55:45.000000000 +0800
> +++ ltp-full-20080229/testcases/kernel/syscalls/inotify/README
> 2008-03-27 16:40:23.000000000 +0800
> @@ -30,7 +30,9 @@ test 2:
> close IN_CLOSE_WRITE
> rename file IN_MOVED_FROM
> IN_MOVED_TO
> - unlink file IN_DELETE
> rename yourself IN_MOVE_SELF
> + unlink file IN_DELETE
> + rename yourself again
> rename back IN_MOVE_SELF
> - check that all events have been received
> + check that all events have been received and the last two successive
> + IN_MOVE_SELF events will be coalesced into a single one.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list