[rtems commit] libtest/dl01: Add dlerror tests.

Chris Johns chrisj at rtems.org
Thu Feb 8 22:32:33 UTC 2018


Module:    rtems
Branch:    4.11
Commit:    7093cb5e5def41e621c0eb3cdfcff5178b8f9594
Changeset: http://git.rtems.org/rtems/commit/?id=7093cb5e5def41e621c0eb3cdfcff5178b8f9594

Author:    Chris Johns <chrisj at rtems.org>
Date:      Thu Feb  8 14:18:05 2018 +1100

libtest/dl01: Add dlerror tests.

Update #2747

---

 testsuites/libtests/dl01/dl-load.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/testsuites/libtests/dl01/dl-load.c b/testsuites/libtests/dl01/dl-load.c
index 7441808..99c1ebf 100644
--- a/testsuites/libtests/dl01/dl-load.c
+++ b/testsuites/libtests/dl01/dl-load.c
@@ -29,6 +29,37 @@ int dl_load_test(void)
   char*  message = "loaded";
   char*  err;
 
+  err = dlerror ();
+  if (err != NULL)
+  {
+    printf ("dlerror failed: did not return NULL for no error\n");
+    return 1;
+  }
+
+  printf("load: /abcd.o (no found)\n");
+  handle = dlopen ("/abcd.o", RTLD_NOW | RTLD_GLOBAL);
+  if (handle)
+  {
+    printf ("dlopen failed: found unknown object file\n");
+    return 1;
+  }
+
+  err = dlerror ();
+  if (!err)
+  {
+    printf ("dlerror failed: no error message\n");
+    return 1;
+  }
+
+  printf ("dlerror: %s\n", err);
+
+  err = dlerror ();
+  if (err != NULL)
+  {
+    printf ("dlerror failed: did not return NULL so error no cleared\n");
+    return 1;
+  }
+
   printf("load: /dl-o1.o\n");
 
   handle = dlopen ("/dl-o1.o", RTLD_NOW | RTLD_GLOBAL);



More information about the vc mailing list