getdents/getdents05.c: add ENOENT test for getdents(2)
PATCH 1/1 getdents/getdents05.c: add ENOENT test for getdents(2)
create a new case to test ENOENT error value for getdents(2)
--- runtest/ltplite | 1 + runtest/stress.part3 | 1 + runtest/syscalls | 2 + testcases/kernel/syscalls/getdents/getdents05.c | 133 ++++++++++++++++++++++++ 4 files changed, 137 insertions(+) create mode 100644 testcases/kernel/syscalls/getdents/getdents05.c
runtest/ltplite +1 -0
@@ -277,6 +277,7 @@ getdents01 getdents01 getdents02 getdents02 getdents03 getdents03 getdents04 getdents04 +getdents05 getdents05 getdomainname01 getdomainname01
runtest/stress.part3 +1 -0
@@ -216,6 +216,7 @@ getdents01 getdents01 getdents02 getdents02 getdents03 getdents03 getdents04 getdents04 +getdents05 getdents05 getdomainname01 getdomainname01
runtest/syscalls +2 -0
@@ -327,11 +327,13 @@ getdents01 getdents01 getdents02 getdents02 getdents03 getdents03 getdents04 getdents04 +getdents05 getdents05 getdents01_64 getdents01 -l getdents02_64 getdents02 -l getdents03_64 getdents03 -l getdents04_64 getdents04 -l +getdents05_64 getdents05 -l getdomainname01 getdomainname01
testcases/kernel/syscalls/getdents/getdents05.c new file +133 -0
133 lines not on this page · raw message
Signature · 14 lines
1.8.2.1 ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Could anyone help to review this?
Thanks,
Xiaoguang Wang
Quoted 182 lines · Xiaoguang Wang
create a new case to test ENOENT error value for getdents(2)
Signed-off-by Xiaoguang Wang <[email protected]>--- runtest/ltplite | 1 + runtest/stress.part3 | 1 + runtest/syscalls | 2 + testcases/kernel/syscalls/getdents/getdents05.c | 133 ++++++++++++++++++++++++ 4 files changed, 137 insertions(+) create mode 100644 testcases/kernel/syscalls/getdents/getdents05.cruntest/ltplite +1
-0@@ -277,6 +277,7 @@ getdents01 getdents01 getdents02 getdents02 getdents03 getdents03 getdents04 getdents04 +getdents05 getdents05 getdomainname01 getdomainname01runtest/stress.part3 +1
-0@@ -216,6 +216,7 @@ getdents01 getdents01 getdents02 getdents02 getdents03 getdents03 getdents04 getdents04 +getdents05 getdents05 getdomainname01 getdomainname01runtest/syscalls +2
-0@@ -327,11 +327,13 @@ getdents01 getdents01 getdents02 getdents02 getdents03 getdents03 getdents04 getdents04 +getdents05 getdents05 getdents01_64 getdents01 -l getdents02_64 getdents02 -l getdents03_64 getdents03 -l getdents04_64 getdents04 -l +getdents05_64 getdents05 -l getdomainname01 getdomainname01testcases/kernel/syscalls/getdents/getdents05.c new file +123
-0@@ -0,0 +1,133 @@ +/* +* Copyright (c) 2013 Fujitsu Ltd. +* Author: Xiaoguang Wang <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of version 2 of the GNU General Public License as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it would be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +/* +* Test Description: +* test ENOENT error value for getdents(2) +*/ + +#define _GNU_SOURCE +#include <stdio.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +#include "test.h" +#include "usctest.h" +#include "safe_macros.h" +#include "getdents.h" + +static void cleanup (void ); +static void setup (void ); + +#define DIR_MODE (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP| \ + S_IXGRP|S_IROTH|S_IXOTH) +#define TEST_DIR "test_dir" + +char *TCID ="getdents05" ; +int TST_TOTAL =1 ; + +static int exp_enos[] = {ENOENT ,0 }; + +static int longsyscall; + +static option_t options[] = { +/* -l long option. Tests getdents64 */ + {"l" , &longsyscall,NULL }, + {NULL ,NULL ,NULL } +}; + +static void help (void ) +{ +printf (" -l Test the getdents64 system call\n" ); +} + +int main (int ac,char **av) +{ +int lc; +char *msg; +int rval, fd; +struct linux_dirent64 dir64; +struct linux_dirent dir; + + msg =parse_opts (ac, av, options, &help); +if (msg !=NULL ) +tst_brkm (TBROK ,NULL ,"OPTION PARSING ERROR - %s" , msg); + +setup (); + +for (lc =0 ;TEST_LOOPING (lc); lc++) { + tst_count =0 ; + +SAFE_MKDIR (cleanup,TEST_DIR ,DIR_MODE ); + + fd =SAFE_OPEN (cleanup,TEST_DIR ,O_DIRECTORY ); +if (rmdir (TEST_DIR ) ==-1 ) { +tst_brkm (TBROK |TERRNO , cleanup, +"rmdir(%s) failed" ,TEST_DIR ); + } + +if (longsyscall) + rval =getdents64 (fd, &dir64,sizeof (dir64)); +else + rval =getdents (fd, &dir,sizeof (dir)); + +if (rval <0 ) { +TEST_ERROR_LOG (errno); + +switch (errno) { +case ENOENT : +tst_resm (TPASS ,"getdents failed as " +"expected with ENOENT" ); +break ; +case ENOSYS : +tst_resm (TCONF ,"syscall not implemented" ); +break ; +default : +tst_resm (TFAIL |TERRNO , +"getdents failed unexpectedly" ); +break ; + } + }else { +tst_resm (TFAIL ,"getdents call succeeded unexpectedly" ); + } + +SAFE_CLOSE (cleanup, fd); + } + +cleanup (); +tst_exit (); +} + +static void setup (void ) +{ +tst_sig (NOFORK ,DEF_HANDLER , cleanup); + +tst_tmpdir (); + +TEST_EXP_ENOS (exp_enos);
testcases/kernel/syscalls/getdents/getdents05.c line 133
Quoted 10 lines
testcases/kernel/syscalls/getdents/getdents05.c new file +10
-0+ +TEST_PAUSE ; +} + +static void cleanup (void ) +{ +TEST_CLEANUP ; + +tst_rmdir (); +}
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi!
Quoted 4 lines
create a new case to test ENOENT error value for getdents(2)
Signed-off-by Xiaoguang Wang <[email protected]>
The new test looks good but looking at the getdents testcases it would probably make a sense to merge the 02, 03, and 04 into one test and then add ENOENT to it like we do in most of the testcases...
Signature · 12 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list