libtest/dl01: Add dlerror tests.

Update #2747
This commit is contained in:
Chris Johns
2018-02-08 14:18:05 +11:00
parent 5812a26eeb
commit 7093cb5e5d

View File

@@ -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);