Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/getdents01: Add close() and open() at the end of run()
@ 2021-04-23  9:59 Zhao Gongyi
  2021-04-23 13:43 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Zhao Gongyi @ 2021-04-23  9:59 UTC (permalink / raw)
  To: ltp

When the test run with the option of '-i', we need call close
and open at the end of run(), otherwist the test will fail,as follows:

$ getdents01 -i 2

tst_buffers.c:55: TINFO: Test is using guarded buffers
tst_test.c:1291: TINFO: Timeout per run is 0h 05m 00s
getdents.h:148: TINFO: Testing the SYS_getdents syscall
getdents01.c:109: TINFO: Found '.'
getdents01.c:109: TINFO: Found '..'
getdents01.c:109: TINFO: Found 'symlink'
getdents01.c:109: TINFO: Found 'file'
getdents01.c:109: TINFO: Found 'dir'
getdents01.c:149: TPASS: All entries found
getdents01.c:97: TFAIL: getdents failed - returned end of directory
tst_test.c:1291: TINFO: Timeout per run is 0h 05m 00s
getdents.h:151: TINFO: Testing the SYS_getdents64 syscall
getdents01.c:109: TINFO: Found '.'
getdents01.c:109: TINFO: Found '..'
getdents01.c:109: TINFO: Found 'dir'
getdents01.c:109: TINFO: Found 'symlink'
getdents01.c:109: TINFO: Found 'file'
getdents01.c:149: TPASS: All entries found
getdents01.c:97: TFAIL: getdents failed - returned end of directory
tst_test.c:1291: TINFO: Timeout per run is 0h 05m 00s
getdents.h:157: TCONF: libc getdents() is not implemented
tst_test.c:1291: TINFO: Timeout per run is 0h 05m 00s
getdents.h:162: TINFO: Testing libc getdents64()
getdents01.c:109: TINFO: Found '.'
getdents01.c:109: TINFO: Found '..'
getdents01.c:109: TINFO: Found 'dir'
getdents01.c:109: TINFO: Found 'symlink'
getdents01.c:109: TINFO: Found 'file'
getdents01.c:149: TPASS: All entries found
getdents01.c:97: TFAIL: getdents failed - returned end of directory

Summary:
passed   3
failed   3
broken   0
skipped  1
warnings 0

Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
 testcases/kernel/syscalls/getdents/getdents01.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testcases/kernel/syscalls/getdents/getdents01.c b/testcases/kernel/syscalls/getdents/getdents01.c
index ef8f4e864..7982691a6 100644
--- a/testcases/kernel/syscalls/getdents/getdents01.c
+++ b/testcases/kernel/syscalls/getdents/getdents01.c
@@ -92,6 +92,9 @@ static void run(void)
 	} while (rval > 0);

 	check_flags();
+
+	SAFE_CLOSE(fd);
+	fd = SAFE_OPEN(".", O_RDONLY|O_DIRECTORY);
 }

 static void reset_flags(void)
--
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [LTP] [PATCH] syscalls/getdents01: Add close() and open() at the end of run()
@ 2021-04-25  3:28 zhaogongyi
  0 siblings, 0 replies; 3+ messages in thread
From: zhaogongyi @ 2021-04-25  3:28 UTC (permalink / raw)
  To: ltp

Hi Cyril,

I have re-submitted the patch according you review, please see: https://patchwork.ozlabs.org/project/ltp/patch/20210425012240.6328-1-zhaogongyi@huawei.com/

Thanks so much!

Best Regards,
Gongyi

> 
> Hi!
> >  testcases/kernel/syscalls/getdents/getdents01.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/testcases/kernel/syscalls/getdents/getdents01.c
> > b/testcases/kernel/syscalls/getdents/getdents01.c
> > index ef8f4e864..7982691a6 100644
> > --- a/testcases/kernel/syscalls/getdents/getdents01.c
> > +++ b/testcases/kernel/syscalls/getdents/getdents01.c
> > @@ -92,6 +92,9 @@ static void run(void)
> >  	} while (rval > 0);
> >
> >  	check_flags();
> > +
> > +	SAFE_CLOSE(fd);
> > +	fd = SAFE_OPEN(".", O_RDONLY|O_DIRECTORY);
> >  }
> 
> Good catch but I guess that it would be a bit cleaner if we opened the fd at
> the start of the run() and closed it at the end instead of opening it in setup()
> and reopening it for each iteration.
> 
> --
> Cyril Hrubis
> chrubis@suse.cz

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

end of thread, other threads:[~2021-04-25  3:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-23  9:59 [LTP] [PATCH] syscalls/getdents01: Add close() and open() at the end of run() Zhao Gongyi
2021-04-23 13:43 ` Cyril Hrubis
  -- strict thread matches above, loose matches on Subject: below --
2021-04-25  3:28 zhaogongyi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox