Changeset 945853b7 in rtems for testsuites/smptests/smpatomic01/init.c
 Timestamp:
 Feb 13, 2014, 2:38:52 PM (6 years ago)
 Branches:
 4.11, 5, master
 Children:
 ad56361
 Parents:
 cd2c655
 gitauthor:
 Sebastian Huber <sebastian.huber@…> (02/13/14 14:38:52)
 gitcommitter:
 Sebastian Huber <sebastian.huber@…> (02/14/14 09:28:30)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

testsuites/smptests/smpatomic01/init.c
rcd2c655 r945853b7 81 81 size_t worker_count; 82 82 rtems_id stop_worker_timer_id; 83 Atomic_Uint atomic_int_value; 83 84 Atomic_Ulong atomic_value; 84 85 unsigned long per_worker_value[CPU_COUNT]; … … 384 385 static void test_static_and_dynamic_initialization(void) 385 386 { 387 static Atomic_Uint static_uint = 388 ATOMIC_INITIALIZER_UINT(0xc01dc0feU); 386 389 static Atomic_Ulong static_ulong = 387 390 ATOMIC_INITIALIZER_ULONG(0xdeadbeefUL); … … 390 393 static Atomic_Flag static_flag = ATOMIC_INITIALIZER_FLAG; 391 394 395 Atomic_Uint stack_uint; 392 396 Atomic_Ulong stack_ulong; 393 397 Atomic_Pointer stack_ptr; … … 396 400 puts("=== static and dynamic initialization test case ==="); 397 401 402 _Atomic_Init_uint(&stack_uint, 0xc01dc0feU); 398 403 _Atomic_Init_ulong(&stack_ulong, 0xdeadbeefUL); 399 404 _Atomic_Init_ptr(&stack_ptr, &static_ptr); … … 401 406 402 407 rtems_test_assert( 408 memcmp(&stack_uint, &static_uint, sizeof(stack_uint)) == 0 409 ); 410 rtems_test_assert( 403 411 memcmp(&stack_ulong, &static_ulong, sizeof(stack_ulong)) == 0 404 412 ); … … 410 418 ); 411 419 420 rtems_test_assert( 421 _Atomic_Load_uint(&stack_uint, ATOMIC_ORDER_RELAXED) == 0xc01dc0feU 422 ); 412 423 rtems_test_assert( 413 424 _Atomic_Load_ulong(&stack_ulong, ATOMIC_ORDER_RELAXED) == 0xdeadbeefUL … … 461 472 static void test_simple_atomic_add_body(test_context *ctx) 462 473 { 474 unsigned int ia = 8, ib = 4; 475 unsigned int ic; 463 476 unsigned long a = 2, b = 1; 464 477 unsigned long c; 465 478 466 479 puts("=== atomic simple add test case ==\n"); 480 481 _Atomic_Store_uint(&ctx>atomic_int_value, ia, ATOMIC_ORDER_RELAXED); 482 _Atomic_Fetch_add_uint(&ctx>atomic_int_value, ib, ATOMIC_ORDER_RELAXED); 483 ic = _Atomic_Load_uint(&ctx>atomic_int_value, ATOMIC_ORDER_RELAXED); 484 rtems_test_assert(ic == (ia + ib)); 467 485 468 486 _Atomic_Store_ulong(&ctx>atomic_value, a, ATOMIC_ORDER_RELAXED); … … 474 492 static void test_simple_atomic_sub_body(test_context *ctx) 475 493 { 494 unsigned int ia = 8, ib = 4; 495 unsigned int ic; 476 496 unsigned long a = 2, b = 1; 477 497 unsigned long c; 478 498 479 499 puts("=== atomic simple sub test case ==\n"); 500 501 _Atomic_Store_uint(&ctx>atomic_int_value, ia, ATOMIC_ORDER_RELAXED); 502 _Atomic_Fetch_sub_uint(&ctx>atomic_int_value, ib, ATOMIC_ORDER_RELAXED); 503 ic = _Atomic_Load_uint(&ctx>atomic_int_value, ATOMIC_ORDER_RELAXED); 504 rtems_test_assert(ic == (ia  ib)); 480 505 481 506 _Atomic_Store_ulong(&ctx>atomic_value, a, ATOMIC_ORDER_RELAXED); … … 487 512 static void test_simple_atomic_or_body(test_context *ctx) 488 513 { 514 unsigned int ia = 8, ib = 4; 515 unsigned int ic; 489 516 unsigned long a = 2, b = 1; 490 517 unsigned long c; 491 518 492 519 puts("=== atomic simple or test case ==\n"); 520 521 _Atomic_Store_uint(&ctx>atomic_int_value, ia, ATOMIC_ORDER_RELAXED); 522 _Atomic_Fetch_or_uint(&ctx>atomic_int_value, ib, ATOMIC_ORDER_RELAXED); 523 ic = _Atomic_Load_uint(&ctx>atomic_int_value, ATOMIC_ORDER_RELAXED); 524 rtems_test_assert(ic == (ia  ib)); 493 525 494 526 _Atomic_Store_ulong(&ctx>atomic_value, a, ATOMIC_ORDER_RELAXED); … … 500 532 static void test_simple_atomic_and_body(test_context *ctx) 501 533 { 534 unsigned int ia = 8, ib = 4; 535 unsigned int ic; 502 536 unsigned long a = 2, b = 1; 503 537 unsigned long c; 504 538 505 539 puts("=== atomic simple and test case ==\n"); 540 541 _Atomic_Store_uint(&ctx>atomic_int_value, ia, ATOMIC_ORDER_RELAXED); 542 _Atomic_Fetch_and_uint(&ctx>atomic_int_value, ib, ATOMIC_ORDER_RELAXED); 543 ic = _Atomic_Load_uint(&ctx>atomic_int_value, ATOMIC_ORDER_RELAXED); 544 rtems_test_assert(ic == (ia & ib)); 506 545 507 546 _Atomic_Store_ulong(&ctx>atomic_value, a, ATOMIC_ORDER_RELAXED); … … 513 552 static void test_simple_atomic_exchange_body(test_context *ctx) 514 553 { 554 unsigned int ia = 8, ib = 4; 555 unsigned int ic; 515 556 unsigned long a = 2, b = 1; 516 557 unsigned long c; 517 558 518 559 puts("=== atomic simple exchange test case ==\n"); 560 561 _Atomic_Store_uint(&ctx>atomic_int_value, ia, ATOMIC_ORDER_RELAXED); 562 _Atomic_Exchange_uint(&ctx>atomic_int_value, ib, ATOMIC_ORDER_RELAXED); 563 ic = _Atomic_Load_uint(&ctx>atomic_int_value, ATOMIC_ORDER_RELAXED); 564 rtems_test_assert(ic == ib); 519 565 520 566 _Atomic_Store_ulong(&ctx>atomic_value, a, ATOMIC_ORDER_RELAXED); … … 526 572 static void test_simple_atomic_compare_exchange_body(test_context *ctx) 527 573 { 574 unsigned int ia = 8, ib = 4; 575 unsigned int ic; 528 576 unsigned long a = 2, b = 1; 529 577 unsigned long c; 530 578 531 579 puts("=== atomic simple compare exchange test case ==\n"); 580 581 _Atomic_Store_uint(&ctx>atomic_int_value, ia, ATOMIC_ORDER_RELAXED); 582 _Atomic_Compare_exchange_uint(&ctx>atomic_int_value, &ia, ib, 583 ATOMIC_ORDER_RELAXED, ATOMIC_ORDER_RELAXED); 584 ic = _Atomic_Load_uint(&ctx>atomic_int_value, ATOMIC_ORDER_RELAXED); 585 rtems_test_assert(ic == ib); 532 586 533 587 _Atomic_Store_ulong(&ctx>atomic_value, a, ATOMIC_ORDER_RELAXED);
Note: See TracChangeset
for help on using the changeset viewer.