add test for strftime
[libc-test.git] / src / functional / tls_init_dlopen.c
blobef3d10a97489e6afd8b616dda3e0eaef432eb9b0
1 #include <string.h>
2 #include <dlfcn.h>
3 #include "test.h"
5 int main()
7 void *h;
8 char *(*f)(void);
9 char *s;
11 h = dlopen("src/functional/tls_init_dso.so", RTLD_NOW|RTLD_GLOBAL);
12 if (!h)
13 t_error("dlopen failed: %s\n", dlerror());
14 f = dlsym(h, "gettls");
15 if (!f)
16 t_error("dlsym failed: %s\n", dlerror());
17 s = f();
18 if (!s)
19 t_error("tls was not initialized at dlopen\n");
20 if (strcmp(s, "foobar")!=0)
21 t_error("tls was not initialized correctly at dlopen (got \"%s\", want \"foobar\"\n", s);
23 return t_status;