[rtems commit] psxtests: add POSIX API signature compliance tests for dirent.h file (GCI 2018)
Joel Sherrill
joel at rtems.org
Tue Nov 27 17:28:45 UTC 2018
Module: rtems
Branch: master
Commit: 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b
Changeset: http://git.rtems.org/rtems/commit/?id=27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b
Author: Himanshu40 <himanshuwindows8.1 at gmail.com>
Date: Tue Nov 27 22:58:30 2018 +0530
psxtests: add POSIX API signature compliance tests for dirent.h file (GCI 2018)
---
testsuites/psxtests/Makefile.am | 13 ++++++-
testsuites/psxtests/psxhdrs/dirent/alphasort.c | 39 ++++++++++++++++++++
testsuites/psxtests/psxhdrs/dirent/closedir.c | 39 ++++++++++++++++++++
testsuites/psxtests/psxhdrs/dirent/dirfd.c | 39 ++++++++++++++++++++
testsuites/psxtests/psxhdrs/dirent/fdopendir.c | 49 ++++++++++++++++++++++++++
testsuites/psxtests/psxhdrs/dirent/opendir.c | 44 +++++++++++++++++++++++
testsuites/psxtests/psxhdrs/dirent/readdir.c | 45 +++++++++++++++++++++++
testsuites/psxtests/psxhdrs/dirent/readdir_r.c | 42 ++++++++++++++++++++++
testsuites/psxtests/psxhdrs/dirent/rewinddir.c | 43 ++++++++++++++++++++++
testsuites/psxtests/psxhdrs/dirent/scandir.c | 38 ++++++++++++++++++++
testsuites/psxtests/psxhdrs/dirent/seekdir.c | 45 +++++++++++++++++++++++
testsuites/psxtests/psxhdrs/dirent/telldir.c | 45 +++++++++++++++++++++++
12 files changed, 480 insertions(+), 1 deletion(-)
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 2a32436..bf1befd 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -1082,7 +1082,18 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \
psxhdrs/sys/socket/send.c psxhdrs/sys/socket/sendmsg.c \
psxhdrs/sys/socket/sendto.c psxhdrs/sys/socket/setsockopt.c \
psxhdrs/sys/socket/shutdown.c psxhdrs/sys/socket/socket.c \
- psxhdrs/sys/socket/socketpair.c
+ psxhdrs/sys/socket/socketpair.c \
+ psxhdrs/dirent/alphasort.c \
+ psxhdrs/dirent/closedir.c \
+ psxhdrs/dirent/dirfd.c \
+ psxhdrs/dirent/fdopendir.c \
+ psxhdrs/dirent/opendir.c \
+ psxhdrs/dirent/readdir.c \
+ psxhdrs/dirent/readdir_r.c \
+ psxhdrs/dirent/rewinddir.c \
+ psxhdrs/dirent/scandir.c \
+ psxhdrs/dirent/seekdir.c \
+ psxhdrs/dirent/telldir.c
endif
rtems_tests_PROGRAMS = $(psx_tests)
diff --git a/testsuites/psxtests/psxhdrs/dirent/alphasort.c b/testsuites/psxtests/psxhdrs/dirent/alphasort.c
new file mode 100644
index 0000000..55fcc54
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/dirent/alphasort.c
@@ -0,0 +1,39 @@
+/**
+ * @file
+ * @brief alphasort() API Conformance Test
+ */
+
+ /*
+ * COPYRIGHT (c) 2018.
+ * Himanshu Sekhar Nayak
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <dirent.h>
+
+ int test( void );
+
+ int test( void )
+ {
+ const struct dirent **d1 = NULL;
+ const struct dirent **d2 = NULL;
+ int result;
+
+ result = alphasort( d1, d2 );
+
+ return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/dirent/closedir.c b/testsuites/psxtests/psxhdrs/dirent/closedir.c
new file mode 100644
index 0000000..6f1d68e
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/dirent/closedir.c
@@ -0,0 +1,39 @@
+/**
+ * @file
+ * @brief closedir() API Conformance Test
+ */
+
+ /*
+ * COPYRIGHT (c) 2018.
+ * Himanshu Sekhar Nayak
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <dirent.h>
+
+ int test( void );
+
+ int test( void )
+ {
+ DIR *dir;
+ int result;
+
+ dir = opendir( "/" );
+ result = closedir( dir );
+
+ return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/dirent/dirfd.c b/testsuites/psxtests/psxhdrs/dirent/dirfd.c
new file mode 100644
index 0000000..b20b2df
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/dirent/dirfd.c
@@ -0,0 +1,39 @@
+/**
+ * @file
+ * @brief dirfd() API Conformance Test
+ */
+
+ /*
+ * COPYRIGHT (c) 2018.
+ * Himanshu Sekhar Nayak
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <dirent.h>
+
+ int test( void );
+
+ int test( void )
+ {
+ DIR *dirp;
+ int result;
+
+ dirp = opendir( "/" );
+ result = dirfd( dirp );
+
+ return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/dirent/fdopendir.c b/testsuites/psxtests/psxhdrs/dirent/fdopendir.c
new file mode 100644
index 0000000..b3ec41f
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/dirent/fdopendir.c
@@ -0,0 +1,49 @@
+/**
+ * @file
+ * @brief fdopendir() API Conformance Test
+ */
+
+ /*
+ * COPYRIGHT (c) 2018.
+ * Himanshu Sekhar Nayak
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <dirent.h>
+ #include <fcntl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+
+ int test( void );
+
+ int pass = 1;
+
+ int test( void )
+ {
+ int fd;
+ DIR *result;
+
+ if( pass == 1 )
+ {
+ fd = open( "./", O_RDONLY );
+ result = fdopendir( fd );
+ (void) result;
+ pass = 0;
+ }
+
+ return pass;
+ }
diff --git a/testsuites/psxtests/psxhdrs/dirent/opendir.c b/testsuites/psxtests/psxhdrs/dirent/opendir.c
new file mode 100644
index 0000000..7d6cc83
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/dirent/opendir.c
@@ -0,0 +1,44 @@
+/**
+ * @file
+ * @brief opendir() API Conformance Test
+ */
+
+ /*
+ * COPYRIGHT (c) 2018.
+ * Himanshu Sekhar Nayak
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <dirent.h>
+
+ int test( void );
+
+ int result = 1;
+
+ int test( void )
+ {
+ DIR *dir;
+
+ if( result == 1 )
+ {
+ dir = opendir( "/" );
+ (void) dir;
+ result = 0;
+ }
+
+ return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/dirent/readdir.c b/testsuites/psxtests/psxhdrs/dirent/readdir.c
new file mode 100644
index 0000000..c21f285
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/dirent/readdir.c
@@ -0,0 +1,45 @@
+/**
+ * @file
+ * @brief readdir() API Conformance Test
+ */
+
+ /*
+ * COPYRIGHT (c) 2018.
+ * Himanshu Sekhar Nayak
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <dirent.h>
+
+ int test( void );
+ int pass = 1;
+
+ int test( void )
+ {
+ DIR *dirp;
+ struct dirent *result;
+
+ if( pass == 1 )
+ {
+ dirp = opendir( "/" );
+ result = readdir( dirp );
+ (void) result;
+ pass = 0;
+ }
+
+ return pass;
+ }
diff --git a/testsuites/psxtests/psxhdrs/dirent/readdir_r.c b/testsuites/psxtests/psxhdrs/dirent/readdir_r.c
new file mode 100644
index 0000000..e719f00
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/dirent/readdir_r.c
@@ -0,0 +1,42 @@
+/**
+ * @file
+ * @brief readdir_r() API Conformance Test
+ */
+
+ /*
+ * COPYRIGHT (c) 2018.
+ * Himanshu Sekhar Nayak
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <dirent.h>
+
+ int test( void );
+
+ int test( void )
+ {
+ DIR *dirp;
+ struct dirent *entry = NULL;
+ struct dirent *result = NULL;
+ int pass;
+
+ dirp = opendir( "/" );
+ entry = readdir(dirp);
+ pass = readdir_r( dirp, entry, &result);
+
+ return pass;
+ }
diff --git a/testsuites/psxtests/psxhdrs/dirent/rewinddir.c b/testsuites/psxtests/psxhdrs/dirent/rewinddir.c
new file mode 100644
index 0000000..755ba33
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/dirent/rewinddir.c
@@ -0,0 +1,43 @@
+/**
+ * @file
+ * @brief rewinddir() API Conformance Test
+ */
+
+ /*
+ * COPYRIGHT (c) 2018.
+ * Himanshu Sekhar Nayak
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <dirent.h>
+
+ int test( void );
+ int result = 1;
+
+ int test( void )
+ {
+ DIR *dirp;
+
+ if( result == 1 )
+ {
+ dirp = opendir( "/" );
+ rewinddir( dirp );
+ result = 0;
+ }
+
+ return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/dirent/scandir.c b/testsuites/psxtests/psxhdrs/dirent/scandir.c
new file mode 100644
index 0000000..92ebf7f
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/dirent/scandir.c
@@ -0,0 +1,38 @@
+/**
+ * @file
+ * @brief scandir() API Conformance Test
+ */
+
+ /*
+ * COPYRIGHT (c) 2018.
+ * Himanshu Sekhar Nayak
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <dirent.h>
+
+ int test( void );
+
+ int test( void )
+ {
+ struct dirent **namelist;
+ int result;
+
+ result = scandir( ".", &namelist, NULL, alphasort );
+
+ return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/dirent/seekdir.c b/testsuites/psxtests/psxhdrs/dirent/seekdir.c
new file mode 100644
index 0000000..04c6233
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/dirent/seekdir.c
@@ -0,0 +1,45 @@
+/**
+ * @file
+ * @brief seekdir() API Conformance Test
+ */
+
+ /*
+ * COPYRIGHT (c) 2018.
+ * Himanshu Sekhar Nayak
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <dirent.h>
+
+ int test( void );
+ int result = 1;
+
+ int test( void )
+ {
+ DIR *dirp;
+ long loc;
+
+ if( result == 1 )
+ {
+ dirp = opendir( "/" );
+ loc = telldir( dirp );
+ seekdir( dirp, loc );
+ result = 0;
+ }
+
+ return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/dirent/telldir.c b/testsuites/psxtests/psxhdrs/dirent/telldir.c
new file mode 100644
index 0000000..8598008
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/dirent/telldir.c
@@ -0,0 +1,45 @@
+/**
+ * @file
+ * @brief telldir() API Conformance Test
+ */
+
+ /*
+ * COPYRIGHT (c) 2018.
+ * Himanshu Sekhar Nayak
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <dirent.h>
+
+ int test( void );
+ int result = 1;
+
+ int test( void )
+ {
+ DIR *dirp;
+ long loc;
+
+ if( result == 1 )
+ {
+ dirp = opendir( "/" );
+ loc = telldir( dirp );
+ (void) loc;
+ result = 0;
+ }
+
+ return result;
+ }
More information about the vc
mailing list