syscalls/inotify01: Cleanup
PATCH 1/7 syscalls/inotify01: Cleanup
* Align the test messages for better readability
* Make use of SAFE_MACROS() even in cleanup since we are using newlib
* Get rid of TST_TOTAL, use test_cnt instead
--- testcases/kernel/syscalls/inotify/inotify01.c | 72 +++++++++++---------------- 1 file changed, 28 insertions(+), 44 deletions(-)
testcases/kernel/syscalls/inotify/inotify01.c +28 -44
@@ -43,8 +43,6 @@#if defined(HAVE_SYS_INOTIFY_H )#include <sys/inotify.h> -#define TST_TOTAL 7 -#define EVENT_MAX 1024/* size of the event structure, not counting name */ #define EVENT_SIZE (sizeof (struct inotify_event))
@@ -52,6 +50,7 @@#define EVENT_BUF_LEN (EVENT_MAX * (EVENT_SIZE + 16))#define BUF_SIZE 256 +static char fname[BUF_SIZE ];static char buf[BUF_SIZE ];static int fd, fd_notify;
@@ -63,59 +62,53 @@ static char event_buf[EVENT_BUF_LEN];void verify_inotify (void ) { -int tst_count =0 ; +int test_cnt =0 ;/* * generate sequence of events */ SAFE_CHMOD (fname,0755 ); - event_set[tst_count] =IN_ATTRIB ; - tst_count++; + event_set[test_cnt] =IN_ATTRIB ; + test_cnt++;if ((fd =open (fname,O_RDONLY )) ==-1 ) {tst_brk (TBROK |TERRNO ,"open(%s, O_RDWR|O_CREAT,0700) failed" , fname); } - event_set[tst_count] =IN_OPEN ; - tst_count++; + event_set[test_cnt] =IN_OPEN ; + test_cnt++;if (read (fd, buf,BUF_SIZE ) ==-1 ) {tst_brk (TBROK |TERRNO ,"read(%d, buf, %d) failed" , fd,BUF_SIZE ); } - event_set[tst_count] =IN_ACCESS ; - tst_count++; + event_set[test_cnt] =IN_ACCESS ; + test_cnt++;SAFE_CLOSE (fd); - event_set[tst_count] =IN_CLOSE_NOWRITE ; - tst_count++; + event_set[test_cnt] =IN_CLOSE_NOWRITE ; + test_cnt++;if ((fd =open (fname,O_RDWR |O_CREAT ,0700 )) ==-1 ) {tst_brk (TBROK ,"open(%s, O_RDWR|O_CREAT,0700) failed" , fname); } - event_set[tst_count] =IN_OPEN ; - tst_count++; + event_set[test_cnt] =IN_OPEN ; + test_cnt++;if (write (fd, buf,BUF_SIZE ) ==-1 ) {tst_brk (TBROK ,"write(%d, %s, 1) failed" , fd, fname); } - event_set[tst_count] =IN_MODIFY ; - tst_count++; + event_set[test_cnt] =IN_MODIFY ; + test_cnt++;SAFE_CLOSE (fd); - event_set[tst_count] =IN_CLOSE_WRITE ; - tst_count++; - -if (TST_TOTAL != tst_count) { -tst_brk (TBROK , -"TST_TOTAL and tst_count are not equal" ); - } - tst_count =0 ; + event_set[test_cnt] =IN_CLOSE_WRITE ; + test_cnt++;/* -* get list on events +* get list of events */ int len, i =0 , test_num =0 ;if ((len =read (fd_notify, event_buf,EVENT_BUF_LEN )) <0 ) {
@@ -131,28 +124,28 @@ void verify_inotify(void)while (i < len) {struct inotify_event *event; event = (struct inotify_event *)&event_buf[i]; -if (test_num >=TST_TOTAL ) { +if (test_num >= test_cnt) {tst_res (TFAIL , -"get unnecessary event: wd=%d mask=%x " +"get unnecessary event: wd=%d mask=%02x " "cookie=%u len=%u" , event->wd, event->mask, event->cookie, event->len); }else if (event_set[test_num] == event->mask) {if (event->cookie !=0 ) {tst_res (TFAIL , -"get event: wd=%d mask=%x " +"get event: wd=%d mask=%02x " "cookie=%u (expected 0) len=%u" , event->wd, event->mask, event->cookie, event->len); }else {tst_res (TPASS ,"get event: wd=%d " -"mask=%x cookie=%u len=%u" , +"mask=%02x cookie=%u len=%u" , event->wd, event->mask, event->cookie, event->len); } }else { - tst_res(TFAIL, "get event: wd=%d mask=%x " + tst_res(TFAIL, "get event: wd=%d mask=%02x " "(expected %x) cookie=%u len=%u", event->wd, event->mask, event_set[test_num],
@@ -161,8 +154,8 @@ void verify_inotify(void) test_num++; i +=EVENT_SIZE + event->len; } -for (; test_num <TST_TOTAL ; test_num++) { -tst_res (TFAIL ,"didn't get event: mask=%x" , +for (; test_num < test_cnt; test_num++) { +tst_res (TFAIL ,"didn't get event: mask=%02x" , event_set[test_num]); }
@@ -171,17 +164,9 @@ void verify_inotify(void)static void setup (void ) {sprintf (fname,"tfile_%d" ,getpid ()); -if ((fd =open (fname,O_RDWR |O_CREAT ,0700 )) ==-1 ) { -tst_brk (TBROK |TERRNO , -"open(%s, O_RDWR|O_CREAT,0700) failed" , fname); - } -if ((write (fd, fname,1 )) ==-1 ) { -tst_brk (TBROK |TERRNO ,"write(%d, %s, 1) failed" , - fd, fname); - } -/* close the file we have open */ -SAFE_CLOSE (fd); +SAFE_FILE_PRINTF (fname,"%s" , fname); +if ((fd_notify =myinotify_init ()) <0 ) {if (errno ==ENOSYS ) { tst_brk(TCONF,
@@ -206,11 +191,10 @@ static void cleanup(void)if (reap_wd &&myinotify_rm_watch (fd_notify, wd) <0 ) {tst_res (TWARN |TERRNO ,"inotify_rm_watch (%d, %d) failed" , fd_notify, wd); - } -if (fd_notify >0 &&close (fd_notify)) -tst_res (TWARN ,"close(%d) failed" , fd_notify); +if (fd_notify >0 ) +SAFE_CLOSE (fd_notify); }static struct tst_test test = {
Signature · 1 line
2.13.6
PATCH 2/7 syscalls/inotify02: Cleanup
* Align the test messages for better readability
* Make use of SAFE_MACROS() even in cleanup since we are using newlib
* Get rid of TST_TOTAL, use test_cnt instead
--- testcases/kernel/syscalls/inotify/inotify02.c | 91 ++++++++++++--------------- 1 file changed, 41 insertions(+), 50 deletions(-)
testcases/kernel/syscalls/inotify/inotify02.c +41 -50
@@ -45,8 +45,6 @@#if defined(HAVE_SYS_INOTIFY_H )#include <sys/inotify.h> -#define TST_TOTAL 9 -#ifndef IN_MOVE_SELF #define IN_MOVE_SELF 0x00000800#endif
@@ -77,40 +75,40 @@ void verify_inotify(void) {unsigned int stored_cookie =UINT_MAX ; -int tst_count =0 ; +int test_cnt =0 ;/* * generate sequence of events */ SAFE_CHMOD ("." ,0755 ); - event_set[tst_count].mask =IN_ISDIR |IN_ATTRIB ; -strcpy (event_set[tst_count].name,"" ); - tst_count++; + event_set[test_cnt].mask =IN_ISDIR |IN_ATTRIB ; +strcpy (event_set[test_cnt].name,"" ); + test_cnt++;if ((fd =creat (FILE_NAME1 ,0755 )) ==-1 ) {tst_brk (TBROK |TERRNO ,"creat(\"%s\", 755) failed" ,FILE_NAME1 ); } - event_set[tst_count].mask =IN_CREATE ; -strcpy (event_set[tst_count].name,FILE_NAME1 ); - tst_count++; - event_set[tst_count].mask =IN_OPEN ; -strcpy (event_set[tst_count].name,FILE_NAME1 ); - tst_count++; + event_set[test_cnt].mask =IN_CREATE ; +strcpy (event_set[test_cnt].name,FILE_NAME1 ); + test_cnt++; + event_set[test_cnt].mask =IN_OPEN ; +strcpy (event_set[test_cnt].name,FILE_NAME1 ); + test_cnt++;SAFE_CLOSE (fd); - event_set[tst_count].mask =IN_CLOSE_WRITE ; -strcpy (event_set[tst_count].name,FILE_NAME1 ); - tst_count++; + event_set[test_cnt].mask =IN_CLOSE_WRITE ; +strcpy (event_set[test_cnt].name,FILE_NAME1 ); + test_cnt++;SAFE_RENAME (FILE_NAME1 ,FILE_NAME2 ); - event_set[tst_count].mask =IN_MOVED_FROM ; -strcpy (event_set[tst_count].name,FILE_NAME1 ); - tst_count++; - event_set[tst_count].mask =IN_MOVED_TO ; -strcpy (event_set[tst_count].name,FILE_NAME2 ); - tst_count++; + event_set[test_cnt].mask =IN_MOVED_FROM ; +strcpy (event_set[test_cnt].name,FILE_NAME1 ); + test_cnt++; + event_set[test_cnt].mask =IN_MOVED_TO ; +strcpy (event_set[test_cnt].name,FILE_NAME2 ); + test_cnt++;if (getcwd (fname1,BUF_SIZE ) ==NULL ) { tst_brk(TBROK | TERRNO,
@@ -119,14 +117,14 @@ void verify_inotify(void)snprintf (fname2,BUF_SIZE ,"%s.rename1" , fname1);SAFE_RENAME (fname1, fname2); - event_set[tst_count].mask =IN_MOVE_SELF ; -strcpy (event_set[tst_count].name,"" ); - tst_count++; + event_set[test_cnt].mask =IN_MOVE_SELF ; +strcpy (event_set[test_cnt].name,"" ); + test_cnt++;SAFE_UNLINK (FILE_NAME2 ); - event_set[tst_count].mask =IN_DELETE ; -strcpy (event_set[tst_count].name,FILE_NAME2 ); - tst_count++; + event_set[test_cnt].mask =IN_DELETE ; +strcpy (event_set[test_cnt].name,FILE_NAME2 ); + test_cnt++;/* * test that duplicate events will be coalesced into
@@ -138,16 +136,9 @@ void verify_inotify(void)SAFE_RENAME (fname2, fname3);SAFE_RENAME (fname3, fname1); - event_set[tst_count].mask =IN_MOVE_SELF ; -strcpy (event_set[tst_count].name,"" ); - tst_count++; - -if (tst_count !=TST_TOTAL ) { -tst_brk (TBROK , -"tst_count and TST_TOTAL are not equal" ); - } - - tst_count =0 ; + event_set[test_cnt].mask =IN_MOVE_SELF ; +strcpy (event_set[test_cnt].name,"" ); + test_cnt++;int len, i =0 , test_num =0 ;if ((len =read (fd_notify, event_buf,EVENT_BUF_LEN )) ==-1 ) {
@@ -160,9 +151,9 @@ void verify_inotify(void)while (i < len) {struct inotify_event *event; event = (struct inotify_event *)&event_buf[i]; -if (test_num >=TST_TOTAL ) { +if (test_num >= test_cnt) {if (tst_kvercmp (2 ,6 ,25 ) <0 - && event_set[TST_TOTAL -1 ].mask == + && event_set[test_cnt -1 ].mask == event->mask)tst_res (TWARN , "This may be kernel bug. "
@@ -178,7 +169,7 @@ void verify_inotify(void) "1c17d18e3775485bf1e0ce79575eb637a94494a2.");tst_res (TFAIL ,"get unnecessary event: " -"wd=%d mask=%x cookie=%u len=%u" +"wd=%d mask=%08x cookie=%-5u len=%-2u" "name=\"%.*s\"" , event->wd, event->mask, event->cookie, event->len, event->len, event->name);
@@ -206,23 +197,23 @@ void verify_inotify(void) }if (!fail) {tst_res (TPASS , -"get event: wd=%d mask=%x " -"cookie=%u len=%u name=\"%.*s\"" , +"get event: wd=%d mask=%08x " +"cookie=%-5u len=%-2u name=\"%.*s\"" , event->wd, event->mask, event->cookie, event->len, event->len, event->name); }else {tst_res (TFAIL , -"get event: wd=%d mask=%x " -"cookie=%u (wrong) len=%u " +"get event: wd=%d mask=%08x " +"cookie=%-5u (wrong) len=%-2u " "name=\"%s\"" , event->wd, event->mask, event->cookie, event->len, event->name); } }else { - tst_res(TFAIL, "get event: wd=%d mask=%x " - "(expected %x) cookie=%u len=%u " + tst_res(TFAIL, "get event: wd=%d mask=%08x " + "(expected %x) cookie=%-5u len=%-2u " "name=\"%s\" (expected \"%s\") %d", event->wd, event->mask, event_set[test_num].mask,
@@ -235,8 +226,8 @@ void verify_inotify(void) i +=EVENT_SIZE + event->len; } -for (; test_num <TST_TOTAL ; test_num++) { -tst_res (TFAIL ,"didn't get event: mask=%x " , +for (; test_num < test_cnt; test_num++) { +tst_res (TFAIL ,"didn't get event: mask=%08x " , event_set[test_num].mask); } }
@@ -269,8 +260,8 @@ static void cleanup(void) } -if (fd_notify >0 &&close (fd_notify)) -tst_res (TWARN ,"close(%d) failed" , fd_notify); +if (fd_notify >0 ) +SAFE_CLOSE (fd_notify); }static struct tst_test test = {
Signature · 1 line
2.13.6
PATCH 3/7 syscalls/inotify03: Fix && cleanup.
In reply to Cyril Hrubis* We umount the device in the test hence we have to mount it there as well otherwise this will break the -i looping option
* Make use of SAFE_MACROS() even in cleanup since we are using newlib
* Get rid of TST_TOTAL, use test_cnt instead
--- testcases/kernel/syscalls/inotify/inotify03.c | 46 +++++++++++++-------------- 1 file changed, 22 insertions(+), 24 deletions(-)
testcases/kernel/syscalls/inotify/inotify03.c +22 -24
@@ -47,8 +47,6 @@#if defined(HAVE_SYS_INOTIFY_H )#include <sys/inotify.h> -#define TST_TOTAL 3 -#define EVENT_MAX 1024/* size of the event structure, not counting name */ #define EVENT_SIZE (sizeof(struct inotify_event))
@@ -74,21 +72,25 @@ void verify_inotify(void)int ret;int len, i, test_num; -int tst_count =0 ; - - event_set[tst_count] =IN_UNMOUNT ; - tst_count++; - event_set[tst_count] =IN_IGNORED ; - tst_count++; +int test_cnt =0 ; -/*check exit code from inotify_rm_watch */ - tst_count++; +SAFE_MOUNT (tst_device->dev, mntpoint, tst_device->fs_type,0 ,NULL ); + mount_flag =1 ; -if (TST_TOTAL != tst_count) { -tst_brk (TBROK , -"TST_TOTAL and tst_count are not equal" ); + wd =myinotify_add_watch (fd_notify, fname,IN_ALL_EVENTS ); +if (wd <0 ) { +tst_brk (TBROK |TERRNO , +"inotify_add_watch (%d, %s, IN_ALL_EVENTS) failed." , + fd_notify, fname); } - tst_count =0 ; + + event_set[test_cnt] =IN_UNMOUNT ; + test_cnt++; + event_set[test_cnt] =IN_IGNORED ; + test_cnt++; + +/*check exit code from inotify_rm_watch */ + test_cnt++;tst_res (TINFO ,"umount %s" , tst_device->dev);TEST (tst_umount (mntpoint));
@@ -111,7 +113,7 @@ void verify_inotify(void)while (i < len) {struct inotify_event *event; event = (struct inotify_event *)&event_buf[i]; -if (test_num >= (TST_TOTAL -1 )) { +if (test_num >= (test_cnt -1 )) { tst_res(TFAIL, "get unnecessary event: wd=%d mask=%x " "cookie=%u len=%u",
@@ -133,7 +135,7 @@ void verify_inotify(void) test_num++; i +=EVENT_SIZE + event->len; } -for (; test_num <TST_TOTAL -1 ; test_num++) { +for (; test_num < test_cnt -1 ; test_num++) {tst_res (TFAIL ,"don't get event: mask=%x " , event_set[test_num]);
@@ -170,7 +172,6 @@ static void setup(void)SAFE_CLOSE (fd); fd_notify =myinotify_init (); -if (fd_notify <0 ) {if (errno ==ENOSYS ) tst_brk(TCONF,
@@ -180,17 +181,14 @@ static void setup(void) "inotify_init failed"); } - wd =myinotify_add_watch (fd_notify, fname,IN_ALL_EVENTS ); -if (wd <0 ) -tst_brk (TBROK |TERRNO , -"inotify_add_watch (%d, %s, IN_ALL_EVENTS) failed." , - fd_notify, fname); +tst_umount (mntpoint); + mount_flag =0 ; }static void cleanup (void ) { -if (fd_notify >0 &&close (fd_notify) ==-1 ) -tst_res (TWARN |TERRNO ,"close(%d) failed" , fd_notify); +if (fd_notify >0 ) +SAFE_CLOSE (fd_notify);if (mount_flag) {TEST (tst_umount (mntpoint));
Signature · 1 line
2.13.6
PATCH 4/7 syscalls/inotify04: Fix cleanup
In reply to Cyril HrubisThe cleanup attempted to close() the inotify watch descriptors however these are _NOT_ file descriptors and are allocated from completely distinct space.
So in this case the inotify watch descriptors we got were 1 and 2 so we closed the stdout and stderr at the end of the test which still made the test pass without any error just by a chance.
--- testcases/kernel/syscalls/inotify/inotify04.c | 7 ------- 1 file changed, 7 deletions(-)
testcases/kernel/syscalls/inotify/inotify04.c +0 -7
@@ -81,7 +81,6 @@ static struct tst_kern_exv kvers[] = {static void cleanup (void ) { -if (reap_wd_dir &&myinotify_rm_watch (fd_notify, wd_dir) ==-1 ) tst_res(TWARN, "inotify_rm_watch(%d, %d) [1] failed", fd_notify,
@@ -94,12 +93,6 @@ static void cleanup(void)if (fd_notify >0 &&close (fd_notify))tst_res (TWARN ,"close(%d) [1] failed" , fd_notify); - -if (wd_dir >0 &&close (wd_dir)) -tst_res (TWARN ,"close(%d) [2] failed" , wd_dir); - -if (wd_file >0 &&close (wd_file)) -tst_res (TWARN ,"close(%d) [3] failed" , wd_file); }static void setup (void )
Signature · 1 line
2.13.6
PATCH 5/7 syscalls/inotify05: Cleanup
In reply to Cyril Hrubis* Make use of SAFE_MACROS() in cleanup
--- testcases/kernel/syscalls/inotify/inotify05.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/inotify/inotify05.c +2 -2
@@ -173,8 +173,8 @@ static void cleanup(void) } -if (fd_notify >0 &&close (fd_notify) ==-1 ) -tst_res (TWARN ,"close(%d) failed" , fd_notify); +if (fd_notify >0 ) +SAFE_CLOSE (fd_notify); }static struct tst_test test = {
Signature · 1 line
2.13.6
PATCH 6/7 syscalls/inotify06: Cleanup
In reply to Cyril Hrubis* Remove empty cleanup
* Make use of SAFE_MACROS()
--- testcases/kernel/syscalls/inotify/inotify06.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
testcases/kernel/syscalls/inotify/inotify06.c +2 -7
@@ -55,10 +55,6 @@char names[FILES ][PATH_MAX ]; -static void cleanup (void ) -{ -} -static void setup (void ) {int i;
@@ -105,15 +101,14 @@ static void verify_inotify(void)tst_res (TPASS ,"kernel survived inotify beating" );/* Kill the child creating / deleting files and wait for it */ -kill (pid,SIGKILL ); -wait (NULL ); +SAFE_KILL (pid,SIGKILL ); +SAFE_WAIT (NULL ); }static struct tst_test test = { .needs_tmpdir =1 , .forks_child =1 , .setup = setup, - .cleanup = cleanup, .test_all = verify_inotify, };
Signature · 1 line
2.13.6
PATCH 7/7 syscalls/inotify04: Fix & Cleanups.
In reply to Cyril Hrubis* Move file/directory creation from setup to
the test fuction, we remove these in the test
fucntion hence we have to create them on each
iteration as well for the -i option
* Get rid of TST_TOTAL, use test_cnt instead
as a side effect this fixes the -i option
* Make use of SAFE_MACROS() in cleanup
--- testcases/kernel/syscalls/inotify/inotify04.c | 80 ++++++++++++--------------- 1 file changed, 36 insertions(+), 44 deletions(-)
testcases/kernel/syscalls/inotify/inotify04.c +36 -44
@@ -40,7 +40,7 @@#include "config.h" #if defined(HAVE_SYS_INOTIFY_H ) -#include <sys/inotify.h> +# include <sys/inotify.h> #endif #include <errno.h> #include <string.h>
@@ -49,8 +49,6 @@#if defined(HAVE_SYS_INOTIFY_H ) -int TST_TOTAL =4 ; -#define EVENT_MAX 1024/* size of the event structure, not counting name */ #define EVENT_SIZE (sizeof(struct inotify_event))
@@ -91,8 +89,8 @@ static void cleanup(void)"inotify_rm_watch(%d, %d) [2] failed" , fd_notify, wd_file); -if (fd_notify >0 &&close (fd_notify)) -tst_res (TWARN ,"close(%d) [1] failed" , fd_notify); +if (fd_notify >0 ) +SAFE_CLOSE (fd_notify); }static void setup (void )
@@ -107,9 +105,14 @@ static void setup(void) "inotify_init failed"); } } +} -SAFE_MKDIR (TEST_DIR ,00700 ); +void verify_inotify (void ) +{ +int i =0 , test_num =0 , len; +int test_cnt =0 ; +SAFE_MKDIR (TEST_DIR ,00700 );close (SAFE_CREAT (TEST_FILE ,00600 )); wd_dir =myinotify_add_watch (fd_notify,TEST_DIR ,IN_ALL_EVENTS );
@@ -126,23 +129,20 @@ static void setup(void)"inotify_add_watch(%d, \"%s\", IN_ALL_EVENTS) [2] failed" , fd_notify, TEST_FILE); reap_wd_file =1 ; -} -void verify_inotify (void ) -{ -int i =0 , test_num =0 , len; +SAFE_RMDIR (TEST_DIR ); + reap_wd_dir =0 ; -int tst_count =0 ; + event_set[test_cnt].mask =IN_DELETE_SELF ; +strcpy (event_set[test_cnt].name,"" ); + test_cnt++; + event_set[test_cnt].mask =IN_IGNORED ; +strcpy (event_set[test_cnt].name,"" ); + test_cnt++; -rmdir (TEST_DIR ); - event_set[tst_count].mask =IN_DELETE_SELF ; -strcpy (event_set[tst_count].name,"" ); - tst_count++; - event_set[tst_count].mask =IN_IGNORED ; -strcpy (event_set[tst_count].name,"" ); - tst_count++; +SAFE_UNLINK (TEST_FILE ); + reap_wd_file =0 ; -unlink (TEST_FILE );/* * When a file is unlinked, the link count is reduced by 1, and when it * hits 0 the file is removed.
@@ -151,37 +151,28 @@ void verify_inotify(void)* understand how Unix works. */ if (tst_kvercmp2 (2 ,6 ,25 , kvers) >=0 ) { - event_set[tst_count].mask =IN_ATTRIB ; -strcpy (event_set[tst_count].name,"" ); - tst_count++; -TST_TOTAL ++; + event_set[test_cnt].mask =IN_ATTRIB ; +strcpy (event_set[test_cnt].name,"" ); + test_cnt++; } - event_set[tst_count].mask =IN_DELETE_SELF ; -strcpy (event_set[tst_count].name,TEST_FILE ); - tst_count++; - event_set[tst_count].mask =IN_IGNORED ; -strcpy (event_set[tst_count].name,"" ); - tst_count++; - -if (tst_count !=TST_TOTAL ) -tst_brk (TBROK , -"tst_count and TST_TOTAL are not equal" ); - tst_count =0 ; + event_set[test_cnt].mask =IN_DELETE_SELF ; +strcpy (event_set[test_cnt].name,TEST_FILE ); + test_cnt++; + event_set[test_cnt].mask =IN_IGNORED ; +strcpy (event_set[test_cnt].name,"" ); + test_cnt++; len =read (fd_notify, event_buf,EVENT_BUF_LEN );if (len ==-1 )tst_brk (TBROK |TERRNO ,"read failed" ); - reap_wd_dir =0 ; - reap_wd_file =0 ; -while (i < len) {struct inotify_event *event; event = (struct inotify_event *)&event_buf[i]; -if (test_num >=TST_TOTAL ) { +if (test_num >= test_cnt) {if (tst_kvercmp (2 ,6 ,25 ) <0 - && event_set[TST_TOTAL -1 ].mask == event->mask) + && event_set[test_cnt -1 ].mask == event->mask)tst_res (TWARN ,"This may be kernel bug. " "Before kernel 2.6.25, a kernel bug "
@@ -196,7 +187,7 @@ void verify_inotify(void) "1c17d18e3775485bf1e0ce79575eb637a94494a2.");tst_res (TFAIL ,"got unnecessary event: " -"wd=%d mask=%x cookie=%u len=%u " +"wd=%d mask=%04x cookie=%u len=%u " "name=\"%.*s\"" , event->wd, event->mask, event->cookie, event->len, event->len, event->name);
@@ -206,13 +197,13 @@ void verify_inotify(void) (event_set[test_num].name, event->name, event->len))) { tst_res(TPASS, - "got event: wd=%d mask=%x " + "got event: wd=%d mask=%04x " "cookie=%u len=%u name=\"%.*s\"", event->wd, event->mask, event->cookie, event->len, event->len, event->name); } else { - tst_res(TFAIL, "got event: wd=%d mask=%x " + tst_res(TFAIL, "got event: wd=%d mask=%04x " "(expected %x) cookie=%u len=%u " "name=\"%.*s\" (expected \"%s\") %d", event->wd, event->mask,
@@ -226,10 +217,11 @@ void verify_inotify(void) i +=EVENT_SIZE + event->len; } -for (; test_num <TST_TOTAL ; test_num++) { -tst_res (TFAIL ,"didn't get event: mask=%x " , +for (; test_num < test_cnt; test_num++) { +tst_res (TFAIL ,"didn't get event: mask=%04x " , event_set[test_num].mask); } + }static struct tst_test test = {
Signature · 1 line
2.13.6