Changeset 7c4b26c in mainline for uspace/app/dltest/dltest.c
- Timestamp:
- 2016-05-02T21:30:14Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 91e4567
- Parents:
- 32573ff
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/dltest/dltest.c
r32573ff r7c4b26c 45 45 void *handle; 46 46 47 47 48 /** Test dlsym() function */ 48 49 static bool test_dlsym(void) … … 255 256 } 256 257 258 #ifdef DLTEST_LINKED 259 260 /** Test directly calling function that returns a constant */ 261 static bool test_lnk_dl_get_constant(void) 262 { 263 int val; 264 265 printf("Call linked dl_get_constant...\n"); 266 267 val = dl_get_constant(); 268 269 printf("Got %d, expected %d... ", val, dl_constant); 270 if (val != dl_constant) { 271 printf("FAILED\n"); 272 return false; 273 } 274 275 printf("Passed\n"); 276 return true; 277 } 278 279 /** Test dircetly calling a function that returns contents of a private 280 * initialized variable. 281 */ 282 static bool test_lnk_dl_get_private_var(void) 283 { 284 int val; 285 286 printf("Call linked dl_get_private_var...\n"); 287 288 val = dl_get_private_var(); 289 290 printf("Got %d, expected %d... ", val, dl_private_var_val); 291 if (val != dl_private_var_val) { 292 printf("FAILED\n"); 293 return false; 294 } 295 296 printf("Passed\n"); 297 return true; 298 } 299 300 /** Test dircetly calling a function that returns contents of a private 301 * uninitialized variable. 302 */ 303 static bool test_lnk_dl_get_private_uvar(void) 304 { 305 int val; 306 307 printf("Call linked dl_get_private_uvar...\n"); 308 309 val = dl_get_private_uvar(); 310 311 printf("Got %d, expected %d... ", val, 0); 312 if (val != 0) { 313 printf("FAILED\n"); 314 return false; 315 } 316 317 printf("Passed\n"); 318 return true; 319 } 320 321 /** Test directly calling a function that returns the contents of a public 322 * initialized variable. 323 */ 324 static bool test_lnk_dl_get_public_var(void) 325 { 326 int val; 327 328 printf("Call linked dl_get_public_var...\n"); 329 330 val = dl_get_public_var(); 331 332 printf("Got %d, expected %d... ", val, dl_public_var_val); 333 if (val != dl_public_var_val) { 334 printf("FAILED\n"); 335 return false; 336 } 337 338 printf("Passed\n"); 339 return true; 340 } 341 342 /** Test directly calling a function that returns the contents of a public 343 * uninitialized variable. 344 */ 345 static bool test_lnk_dl_get_public_uvar(void) 346 { 347 int val; 348 349 printf("Call linked dl_get_public_uvar...\n"); 350 351 val = dl_get_public_uvar(); 352 353 printf("Got %d, expected %d... ", val, 0); 354 if (val != 0) { 355 printf("FAILED\n"); 356 return false; 357 } 358 359 printf("Passed\n"); 360 return true; 361 } 362 363 /** Test directly reading a public initialized variable. */ 364 static bool test_lnk_read_public_var(void) 365 { 366 int val; 367 368 printf("Read linked dl_public_var...\n"); 369 370 val = dl_public_var; 371 372 printf("Got %d, expected %d... ", val, dl_public_var_val); 373 if (val != dl_public_var_val) { 374 printf("FAILED\n"); 375 return false; 376 } 377 378 printf("Passed\n"); 379 return true; 380 } 381 382 /** Test directly reading a public uninitialized variable. */ 383 static bool test_lnk_read_public_uvar(void) 384 { 385 int val; 386 387 printf("Read linked dl_public_uvar...\n"); 388 389 val = dl_public_uvar; 390 391 printf("Got %d, expected %d... ", val, 0); 392 if (val != 0) { 393 printf("FAILED\n"); 394 return false; 395 } 396 397 printf("Passed\n"); 398 return true; 399 } 400 401 #endif 402 257 403 int main(int argc, char *argv[]) 258 404 { … … 293 439 return 1; 294 440 441 #ifdef DLTEST_LINKED 442 if (!test_lnk_dl_get_constant()) 443 return 1; 444 445 if (!test_lnk_dl_get_private_var()) 446 return 1; 447 448 if (!test_lnk_dl_get_private_uvar()) 449 return 1; 450 451 if (!test_lnk_dl_get_public_var()) 452 return 1; 453 454 if (!test_lnk_dl_get_public_uvar()) 455 return 1; 456 457 if (!test_lnk_read_public_var()) 458 return 1; 459 460 if (!test_lnk_read_public_uvar()) 461 return 1; 462 #endif 295 463 // printf("dlclose()... "); 296 464 // dlclose(handle);
Note:
See TracChangeset
for help on using the changeset viewer.