summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorHimanshu40 <himanshuwindows8.1@gmail.com>2018-11-27 22:40:30 +0530
committerJoel Sherrill <joel@rtems.org>2018-11-27 11:25:38 -0600
commit27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b (patch)
treef3616f4aef7e28aea1e7ad0d6b0f189802cd23c4 /testsuites
parentm68k/av5282: Add per-section compilation and linking support (GCI 2018) (diff)
downloadrtems-27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b.tar.bz2
psxtests: add POSIX API signature compliance tests for dirent.h file (GCI 2018)
Diffstat (limited to '')
-rw-r--r--testsuites/psxtests/Makefile.am13
-rw-r--r--testsuites/psxtests/psxhdrs/dirent/alphasort.c39
-rw-r--r--testsuites/psxtests/psxhdrs/dirent/closedir.c39
-rw-r--r--testsuites/psxtests/psxhdrs/dirent/dirfd.c39
-rw-r--r--testsuites/psxtests/psxhdrs/dirent/fdopendir.c49
-rw-r--r--testsuites/psxtests/psxhdrs/dirent/opendir.c44
-rw-r--r--testsuites/psxtests/psxhdrs/dirent/readdir.c45
-rw-r--r--testsuites/psxtests/psxhdrs/dirent/readdir_r.c42
-rw-r--r--testsuites/psxtests/psxhdrs/dirent/rewinddir.c43
-rw-r--r--testsuites/psxtests/psxhdrs/dirent/scandir.c38
-rw-r--r--testsuites/psxtests/psxhdrs/dirent/seekdir.c45
-rw-r--r--testsuites/psxtests/psxhdrs/dirent/telldir.c45
12 files changed, 480 insertions, 1 deletions
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 2a32436be4..bf1befd337 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 0000000000..55fcc544fb
--- /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 0000000000..6f1d68e2d8
--- /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 0000000000..b20b2df764
--- /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 0000000000..b3ec41f91a
--- /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 0000000000..7d6cc8341e
--- /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 0000000000..c21f28559e
--- /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 0000000000..e719f008e1
--- /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 0000000000..755ba33f48
--- /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 0000000000..92ebf7f68c
--- /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 0000000000..04c623318c
--- /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 0000000000..8598008194
--- /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;
+ }