Changeset 0dc9a474 in mainline
- Timestamp:
- 2016-05-06T18:44:09Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 29405ac
- Parents:
- 91e4567
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/dltest/dltest.c
r91e4567 r0dc9a474 256 256 } 257 257 258 /** Test calling a function that returns contents of a private initialized 259 * fibril-local variable. 260 */ 261 static bool test_dlfcn_dl_get_private_fib_var(void) 262 { 263 int (*p_dl_get_private_fib_var)(void); 264 int val; 265 266 printf("Call dlsym/dl_get_private_fib_var...\n"); 267 268 p_dl_get_private_fib_var = dlsym(handle, "dl_get_private_fib_var"); 269 if (p_dl_get_private_fib_var == NULL) { 270 printf("FAILED\n"); 271 return false; 272 } 273 274 val = p_dl_get_private_fib_var(); 275 276 printf("Got %d, expected %d... ", val, dl_private_fib_var_val); 277 if (val != dl_private_fib_var_val) { 278 printf("FAILED\n"); 279 return false; 280 } 281 282 printf("Passed\n"); 283 return true; 284 } 285 286 /** Test calling a function that returns contents of a private uninitialized 287 * fibril-local variable. 288 */ 289 static bool test_dlfcn_dl_get_private_fib_uvar(void) 290 { 291 int (*p_dl_get_private_fib_uvar)(void); 292 int val; 293 294 printf("Call dlsym/dl_get_private_fib_uvar...\n"); 295 296 p_dl_get_private_fib_uvar = dlsym(handle, "dl_get_private_fib_uvar"); 297 if (p_dl_get_private_fib_uvar == NULL) { 298 printf("FAILED\n"); 299 return false; 300 } 301 302 val = p_dl_get_private_fib_uvar(); 303 304 printf("Got %d, expected %d... ", val, 0); 305 if (val != 0) { 306 printf("FAILED\n"); 307 return false; 308 } 309 310 printf("Passed\n"); 311 return true; 312 } 313 314 /** Test calling a function that returns the contents of a public initialized 315 * fibril-local variable. 316 */ 317 static bool test_dlfcn_dl_get_public_fib_var(void) 318 { 319 int (*p_dl_get_public_fib_var)(void); 320 int val; 321 322 printf("Call dlsym/dl_get_public_fib_var...\n"); 323 324 p_dl_get_public_fib_var = dlsym(handle, "dl_get_public_fib_var"); 325 if (p_dl_get_public_fib_var == NULL) { 326 printf("FAILED\n"); 327 return false; 328 } 329 330 val = p_dl_get_public_fib_var(); 331 332 printf("Got %d, expected %d... ", val, dl_public_fib_var_val); 333 if (val != dl_public_fib_var_val) { 334 printf("FAILED\n"); 335 return false; 336 } 337 338 printf("Passed\n"); 339 return true; 340 } 341 342 /** Test calling a function that returns the contents of a public uninitialized 343 * fibril-local variable. 344 */ 345 static bool test_dlfcn_dl_get_public_fib_uvar(void) 346 { 347 int (*p_dl_get_public_fib_uvar)(void); 348 int val; 349 350 printf("Call dlsym/dl_get_public_fib_uvar...\n"); 351 352 p_dl_get_public_fib_uvar = dlsym(handle, "dl_get_public_fib_uvar"); 353 if (p_dl_get_public_fib_uvar == NULL) { 354 printf("FAILED\n"); 355 return false; 356 } 357 358 val = p_dl_get_public_fib_uvar(); 359 360 printf("Got %d, expected %d... ", val, 0); 361 if (val != 0) { 362 printf("FAILED\n"); 363 return false; 364 } 365 366 printf("Passed\n"); 367 return true; 368 } 369 370 /** Test directly reading a public initialized fibril-local variable 371 * whose address was obtained using dlsym. 372 */ 373 static bool test_dlfcn_read_public_fib_var(void) 374 { 375 int *p_dl_public_fib_var; 376 int val; 377 378 printf("Read dlsym/dl_public_fib_var...\n"); 379 380 p_dl_public_fib_var = dlsym(handle, "dl_public_fib_var"); 381 if (p_dl_public_fib_var == NULL) { 382 printf("FAILED\n"); 383 return false; 384 } 385 386 val = *p_dl_public_fib_var; 387 388 printf("Got %d, expected %d... ", val, dl_public_fib_var_val); 389 if (val != dl_public_fib_var_val) { 390 printf("FAILED\n"); 391 return false; 392 } 393 394 printf("Passed\n"); 395 return true; 396 } 397 398 /** Test directly reading a public uninitialized fibril-local variable 399 * whose address was obtained using dlsym. 400 */ 401 static bool test_dlfcn_read_public_fib_uvar(void) 402 { 403 int *p_dl_public_fib_uvar; 404 int val; 405 406 printf("Read dlsym/dl_public_fib_uvar...\n"); 407 408 p_dl_public_fib_uvar = dlsym(handle, "dl_public_fib_uvar"); 409 if (p_dl_public_fib_uvar == NULL) { 410 printf("FAILED\n"); 411 return false; 412 } 413 414 val = *p_dl_public_fib_uvar; 415 416 printf("Got %d, expected %d... ", val, 0); 417 if (val != 0) { 418 printf("FAILED\n"); 419 return false; 420 } 421 422 printf("Passed\n"); 423 return true; 424 } 425 258 426 #ifdef DLTEST_LINKED 259 427 … … 388 556 389 557 val = dl_public_uvar; 558 559 printf("Got %d, expected %d... ", val, 0); 560 if (val != 0) { 561 printf("FAILED\n"); 562 return false; 563 } 564 565 printf("Passed\n"); 566 return true; 567 } 568 569 /** Test dircetly calling a function that returns contents of a private 570 * initialized fibril-local variable. 571 */ 572 static bool test_lnk_dl_get_private_fib_var(void) 573 { 574 int val; 575 576 printf("Call linked dl_get_private_fib_var...\n"); 577 578 val = dl_get_private_fib_var(); 579 580 printf("Got %d, expected %d... ", val, dl_private_fib_var_val); 581 if (val != dl_private_var_val) { 582 printf("FAILED\n"); 583 return false; 584 } 585 586 printf("Passed\n"); 587 return true; 588 } 589 590 /** Test dircetly calling a function that returns contents of a private 591 * uninitialized fibril-local variable. 592 */ 593 static bool test_lnk_dl_get_private_fib_uvar(void) 594 { 595 int val; 596 597 printf("Call linked dl_get_private_fib_uvar...\n"); 598 599 val = dl_get_private_fib_uvar(); 600 601 printf("Got %d, expected %d... ", val, 0); 602 if (val != 0) { 603 printf("FAILED\n"); 604 return false; 605 } 606 607 printf("Passed\n"); 608 return true; 609 } 610 611 /** Test directly calling a function that returns the contents of a public 612 * initialized fibril-local variable. 613 */ 614 static bool test_lnk_dl_get_public_fib_var(void) 615 { 616 int val; 617 618 printf("Call linked dl_get_public_fib_var...\n"); 619 620 val = dl_get_public_fib_var(); 621 622 printf("Got %d, expected %d... ", val, dl_public_fib_var_val); 623 if (val != dl_public_fib_var_val) { 624 printf("FAILED\n"); 625 return false; 626 } 627 628 printf("Passed\n"); 629 return true; 630 } 631 632 /** Test directly calling a function that returns the contents of a public 633 * uninitialized fibril-local variable. 634 */ 635 static bool test_lnk_dl_get_public_fib_uvar(void) 636 { 637 int val; 638 639 printf("Call linked dl_get_public_fib_uvar...\n"); 640 641 val = dl_get_public_fib_uvar(); 642 643 printf("Got %d, expected %d... ", val, 0); 644 if (val != 0) { 645 printf("FAILED\n"); 646 return false; 647 } 648 649 printf("Passed\n"); 650 return true; 651 } 652 653 /** Test directly reading a public initialized fibril-local variable. */ 654 static bool test_lnk_read_public_fib_var(void) 655 { 656 int val; 657 658 printf("Read linked dl_public_fib_var...\n"); 659 660 val = dl_public_fib_var; 661 662 printf("Got %d, expected %d... ", val, dl_public_fib_var_val); 663 if (val != dl_public_fib_var_val) { 664 printf("FAILED\n"); 665 return false; 666 } 667 668 printf("Passed\n"); 669 return true; 670 } 671 672 /** Test directly reading a public uninitialized fibril-local variable. */ 673 static bool test_lnk_read_public_fib_uvar(void) 674 { 675 int val; 676 677 printf("Read linked dl_public_fib_uvar...\n"); 678 679 val = dl_public_fib_uvar; 390 680 391 681 printf("Got %d, expected %d... ", val, 0); … … 439 729 return 1; 440 730 731 if (!test_dlfcn_dl_get_private_fib_var()) 732 return 1; 733 734 if (!test_dlfcn_dl_get_private_fib_uvar()) 735 return 1; 736 737 if (!test_dlfcn_dl_get_public_fib_var()) 738 return 1; 739 740 if (!test_dlfcn_dl_get_public_fib_uvar()) 741 return 1; 742 743 if (!test_dlfcn_read_public_fib_var()) 744 return 1; 745 746 if (!test_dlfcn_read_public_fib_uvar()) 747 return 1; 748 441 749 #ifdef DLTEST_LINKED 442 750 if (!test_lnk_dl_get_constant()) … … 459 767 460 768 if (!test_lnk_read_public_uvar()) 769 return 1; 770 771 if (!test_lnk_dl_get_private_fib_var()) 772 return 1; 773 774 if (!test_lnk_dl_get_private_fib_uvar()) 775 return 1; 776 777 if (!test_lnk_dl_get_public_fib_var()) 778 return 1; 779 780 if (!test_lnk_dl_get_public_fib_uvar()) 781 return 1; 782 783 if (!test_lnk_read_public_fib_var()) 784 return 1; 785 786 if (!test_lnk_read_public_fib_uvar()) 461 787 return 1; 462 788 #endif -
uspace/lib/dltest/dltest.c
r91e4567 r0dc9a474 34 34 */ 35 35 36 #include <fibril.h> 36 37 #include "libdltest.h" 37 38 … … 45 46 /** Public uninitialized variable */ 46 47 int dl_public_uvar; 48 49 /** Private initialized fibril-local variable */ 50 static fibril_local int dl_private_fib_var = dl_private_fib_var_val; 51 /** Private uninitialized fibril-local variable */ 52 static fibril_local int dl_private_fib_uvar; 53 54 /** Public initialized fibril-local variable */ 55 fibril_local int dl_public_fib_var = dl_public_fib_var_val; 56 /** Public uninitialized fibril-local variable */ 57 fibril_local int dl_public_fib_uvar; 47 58 48 59 /** Return constant value. */ … … 76 87 } 77 88 89 /** Return value of private initialized fibril-local variable */ 90 int dl_get_private_fib_var(void) 91 { 92 return dl_private_fib_var; 93 } 94 95 /** Return value of private uninitialized fibril-local variable */ 96 int dl_get_private_fib_uvar(void) 97 { 98 return dl_private_fib_uvar; 99 } 100 101 /** Return value of public initialized fibril-local variable */ 102 int dl_get_public_fib_var(void) 103 { 104 return dl_public_fib_var; 105 } 106 107 /** Return value of public uninitialized fibril-local variable */ 108 int dl_get_public_fib_uvar(void) 109 { 110 return dl_public_fib_uvar; 111 } 112 78 113 /** 79 114 * @} -
uspace/lib/dltest/libdltest.h
r91e4567 r0dc9a474 37 37 #define LIBDLTEST_H 38 38 39 #include <fibril.h> 40 39 41 enum { 40 42 dl_constant = 110011, 41 43 dl_private_var_val = 220022, 42 dl_public_var_val = 330033 44 dl_public_var_val = 330033, 45 dl_private_fib_var_val = 220022, 46 dl_public_fib_var_val = 330033 43 47 }; 44 48 … … 48 52 extern int dl_get_public_var(void); 49 53 extern int dl_get_public_uvar(void); 54 extern int dl_get_private_fib_var(void); 55 extern int dl_get_private_fib_uvar(void); 56 extern int dl_get_public_fib_var(void); 57 extern int dl_get_public_fib_uvar(void); 50 58 51 59 extern int dl_public_var; 52 60 extern int dl_public_uvar; 61 extern fibril_local int dl_public_fib_var; 62 extern fibril_local int dl_public_fib_uvar; 53 63 54 64 #endif
Note:
See TracChangeset
for help on using the changeset viewer.