]>
Commit | Line | Data |
---|---|---|
02d5e5d9 PK |
1 | #include "../dlfcn/dlfcn.h" |
2 | #include <stdio.h> | |
3 | #include <stdlib.h> | |
4 | ||
5 | static int | |
6 | do_test (void) | |
7 | { | |
8 | int result = 0; | |
9 | ||
10 | /* This is a test for correct handling of dlopen failures for library that | |
11 | is loaded with RTLD_NODELETE flag. The first dlopen should fail because | |
12 | of undefined symbols in shared library. The second dlopen then verifies | |
13 | that library was properly unloaded. */ | |
14 | if (dlopen ("tst-nodelete-rtldmod.so", RTLD_NOW | RTLD_NODELETE) != NULL | |
15 | || dlopen ("tst-nodelete-rtldmod.so", RTLD_LAZY | RTLD_NOLOAD) != NULL) | |
16 | { | |
17 | printf ("RTLD_NODELETE test failed\n"); | |
18 | result = 1; | |
19 | } | |
20 | ||
21 | /* This is a test for correct handling of dlopen failures for library that | |
22 | is linked with '-z nodelete' option and hence has DF_1_NODELETE flag. | |
23 | The first dlopen should fail because of undefined symbols in shared | |
24 | library. The second dlopen then verifies that library was properly | |
25 | unloaded. */ | |
26 | if (dlopen ("tst-nodelete-zmod.so", RTLD_NOW) != NULL | |
27 | || dlopen ("tst-nodelete-zmod.so", RTLD_LAZY | RTLD_NOLOAD) != NULL) | |
28 | { | |
29 | printf ("-z nodelete test failed\n"); | |
30 | result = 1; | |
31 | } | |
32 | ||
33 | /* This is a test for correct handling of dlopen failures for library | |
34 | with unique symbols. The first dlopen should fail because of undefined | |
35 | symbols in shared library. The second dlopen then verifies that library | |
36 | was properly unloaded. */ | |
37 | if (dlopen ("tst-nodelete-uniquemod.so", RTLD_NOW) != NULL | |
38 | || dlopen ("tst-nodelete-uniquemod.so", RTLD_LAZY | RTLD_NOLOAD) != NULL) | |
39 | { | |
40 | printf ("Unique symbols test failed\n"); | |
41 | result = 1; | |
42 | } | |
43 | ||
44 | if (result == 0) | |
45 | printf ("SUCCESS\n"); | |
46 | ||
47 | return result; | |
48 | } | |
49 | ||
36fe25fd | 50 | #include <support/test-driver.c> |