Hi guys,

Here is the patch for dlfcn.h file

Thanks
Himanshu
From e7e742d037ceb1d67dfc6b4738df5f6932aa8156 Mon Sep 17 00:00:00 2001
From: Himanshu40 <himanshuwindows...@gmail.com>
Date: Sun, 2 Dec 2018 00:11:19 +0530
Subject: [PATCH] psxhdrs: add POSIX API Signature Compliance Tests for dlfcn.h
 File (GCI 2018)

---
 testsuites/psxtests/Makefile.am             |  6 ++-
 testsuites/psxtests/psxhdrs/dlfcn/dlclose.c | 38 +++++++++++++++++++
 testsuites/psxtests/psxhdrs/dlfcn/dlerror.c | 39 ++++++++++++++++++++
 testsuites/psxtests/psxhdrs/dlfcn/dlopen.c  | 40 ++++++++++++++++++++
 testsuites/psxtests/psxhdrs/dlfcn/dlsym.c   | 41 +++++++++++++++++++++
 5 files changed, 163 insertions(+), 1 deletion(-)
 create mode 100644 testsuites/psxtests/psxhdrs/dlfcn/dlclose.c
 create mode 100644 testsuites/psxtests/psxhdrs/dlfcn/dlerror.c
 create mode 100644 testsuites/psxtests/psxhdrs/dlfcn/dlopen.c
 create mode 100644 testsuites/psxtests/psxhdrs/dlfcn/dlsym.c

diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 03e823e7db..d028ad4e93 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -1122,7 +1122,11 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \
 	psxhdrs/strings/strcasecmp.c \
 	psxhdrs/strings/strcasecmp_l.c \
 	psxhdrs/strings/strncasecmp.c \
-	psxhdrs/strings/strncasecmp_l.c
+	psxhdrs/strings/strncasecmp_l.c \
+	psxhdrs/dlfcn/dlopen.c \
+	psxhdrs/dlfcn/dlclose.c \
+	psxhdrs/dlfcn/dlerror.c \
+	psxhdrs/dlfcn/dlsym.c
 endif
 
 rtems_tests_PROGRAMS = $(psx_tests)
diff --git a/testsuites/psxtests/psxhdrs/dlfcn/dlclose.c b/testsuites/psxtests/psxhdrs/dlfcn/dlclose.c
new file mode 100644
index 0000000000..ddc6759f08
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/dlfcn/dlclose.c
@@ -0,0 +1,38 @@
+/**
+ *  @file
+ *  @brief dlclose() 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 <dlfcn.h>
+
+ int test( void );
+
+ int test( void )
+ {
+   void *filename;
+   int result;
+
+   filename = dlopen( "mylib.so", RTLD_LOCAL | RTLD_LAZY );
+   result = dlclose( filename );
+
+   return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/dlfcn/dlerror.c b/testsuites/psxtests/psxhdrs/dlfcn/dlerror.c
new file mode 100644
index 0000000000..4ba13da61d
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/dlfcn/dlerror.c
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief dlerror() 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 <dlfcn.h>
+
+ int test( void );
+
+ int result = 1;
+
+ int test( void )
+ {
+   char *errstr;
+
+   errstr = dlerror();
+   result = 0;
+
+   return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/dlfcn/dlopen.c b/testsuites/psxtests/psxhdrs/dlfcn/dlopen.c
new file mode 100644
index 0000000000..382d1bbc74
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/dlfcn/dlopen.c
@@ -0,0 +1,40 @@
+/**
+ *  @file
+ *  @brief dlopen() 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 <dlfcn.h>
+
+ int test( void );
+
+ int result = 1;
+
+ int test( void )
+ {
+   void *filename;
+
+   filename = dlopen( "mylib.so", RTLD_LOCAL | RTLD_LAZY );
+   (void) filename;
+   result = 0;
+
+   return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/dlfcn/dlsym.c b/testsuites/psxtests/psxhdrs/dlfcn/dlsym.c
new file mode 100644
index 0000000000..83b1049c12
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/dlfcn/dlsym.c
@@ -0,0 +1,41 @@
+/**
+ *  @file
+ *  @brief dlsym() 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 <dlfcn.h>
+
+ int test( void );
+
+ int result = 1;
+
+ int test( void )
+ {
+   void *filename;
+   int *iptr;
+
+   filename = dlopen( "mylib.so", RTLD_LOCAL | RTLD_LAZY );
+   iptr = dlsym( filename, "my_function" );
+   result = 0;
+
+   return result;
+ }
-- 
2.17.2

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to