66{
68
70
71
73
77 }
78
80 test_skip( __FILE__, __LINE__,
"PAPI_get_shared_lib_info", 1 );
81 }
82
83 if ( ( shinfo->
count == 0 ) && ( shinfo->
map ) ) {
84 test_fail( __FILE__, __LINE__,
"PAPI_get_shared_lib_info", 1 );
85 }
86
88
89
90
91 sleep( 1 );
92
93#ifndef NO_DLFCN
94 {
95
96 const char *_libname = "libcrypt.so";
98 void ( *setkey) (
const char *
key);
99 void ( *encrypt) (char block[64], int edflag);
101 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
102 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
103 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
104 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
105 };
106 char orig[64];
107 char txt[64];
108
109 int oldcount;
110
111 handle = dlopen( _libname, RTLD_NOW );
113 printf( "dlopen: %s\n", dlerror( ) );
114 if (!
quiet) printf(
"Did you forget to set the environmental "
115 "variable LIBPATH (in AIX) or "
116 "LD_LIBRARY_PATH (in linux) ?\n" );
117 test_fail( __FILE__, __LINE__,
"dlopen", 1 );
118 }
119
120 setkey = dlsym(
handle,
"setkey" );
121 encrypt = dlsym(
handle,
"encrypt" );
122 if ( setkey == NULL || encrypt == NULL) {
123 if (!
quiet) printf(
"dlsym: %s\n", dlerror( ) );
124 test_fail( __FILE__, __LINE__,
"dlsym", 1 );
125 }
126
127 memset(orig,0,64);
128 memcpy(txt,orig,64);
130
132 printf("original ");
134 }
135
136 encrypt(txt, 0);
137
139 printf("encrypted ");
141 }
142
143 if (!memcmp(txt,orig,64)) {
144 test_fail( __FILE__, __LINE__,
"encode", 1 );
145 }
146
147 encrypt(txt, 1);
148
150 printf("decrypted ");
152 }
153
154 if (memcmp(txt,orig,64)) {
155 test_fail( __FILE__, __LINE__,
"decode", 1 );
156 }
157
158 oldcount = shinfo->
count;
159
161 test_fail( __FILE__, __LINE__,
"PAPI_get_shared_lib_info", 1 );
162 }
163
164
165
166 sleep( 1 );
167
168 if ( ( shinfo->
count == 0 ) && ( shinfo->
map ) ) {
169 test_fail( __FILE__, __LINE__,
"PAPI_get_shared_lib_info", 1 );
170 }
171
172 if ( shinfo->
count <= oldcount ) {
173 test_fail( __FILE__, __LINE__,
"PAPI_get_shared_lib_info", 1 );
174 }
175
177
178
179
180 sleep( 1 );
181
183
184 }
185#endif
186
188
189 return 0;
190
191}
static papi_handle_t handle
Get address info about the shared libraries used by the process.
initialize the PAPI library.
int tests_quiet(int argc, char **argv)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_pass(const char *filename)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
void print_shlib_info_map(const PAPI_shlib_info_t *shinfo, int quiet)