diff options
author | WeiY <wei.a.yang@gmail.com> | 2013-08-01 21:49:49 +0800 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-08-01 16:48:25 +0200 |
commit | 693088951db029f92eb02f0f8a49fc9576ca0fab (patch) | |
tree | 53f7cd00fcf185668bb42137e760a13e49d67560 /testsuites/sptests/spatomic01/tasks.c | |
parent | score: Use an ISR lock for TOD (diff) | |
download | rtems-693088951db029f92eb02f0f8a49fc9576ca0fab.tar.bz2 |
clean up spatomic testcase
Diffstat (limited to '')
-rw-r--r-- | testsuites/sptests/spatomic01/tasks.c | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/testsuites/sptests/spatomic01/tasks.c b/testsuites/sptests/spatomic01/tasks.c deleted file mode 100644 index 9392a5b612..0000000000 --- a/testsuites/sptests/spatomic01/tasks.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2012 Deng Hengyi. - * - * This test case is to test atomic load operation. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "system.h" - -#include <stdlib.h> -#include <rtems/rtems/atomic.h> - -#define TEST_REPEAT 1000 - -#define ATOMIC_LOAD_NO_BARRIER(NAME, TYPE, R_TYPE, task_id, mem_bar) \ -{ \ - Atomic_##TYPE t; \ - R_TYPE a; \ - R_TYPE b; \ - unsigned int i; \ - for (i = 0; i < TEST_REPEAT; i++){ \ - b = (R_TYPE)rand(); \ - atomic_init(&t, b); \ - a = _Atomic_Load_##NAME(&t, mem_bar); \ - rtems_test_assert(a == b); \ - } \ - printf("\ntask%d: Atomic_Load_" #NAME ": SUCCESS\n", (unsigned int)task_id); \ -} - -rtems_task Test_task( - rtems_task_argument argument - ) -{ - char name[5]; - char *p; - rtems_status_code status; - - /* Get the task name */ - p = rtems_object_get_name( RTEMS_SELF, 5, name ); - rtems_test_assert( p != NULL ); - - /* Print that the task is up and running. */ - /* test relaxed barrier */ - ATOMIC_LOAD_NO_BARRIER(uint, Uint, uint_fast32_t, argument, ATOMIC_ORDER_RELAXED); - - ATOMIC_LOAD_NO_BARRIER(ptr, Pointer, uintptr_t, argument, ATOMIC_ORDER_RELAXED); - - /* test acquire barrier */ - ATOMIC_LOAD_NO_BARRIER(uint, Uint, uint_fast32_t, argument, ATOMIC_ORDER_ACQUIRE); - - ATOMIC_LOAD_NO_BARRIER(ptr, Pointer, uintptr_t, argument, ATOMIC_ORDER_ACQUIRE); - - /* Set the flag that the task is up and running */ - TaskRan[argument] = true; - - status = rtems_task_delete( RTEMS_SELF ); - directive_failed( status, "delete" ); -} - -rtems_task Wait_task( - rtems_task_argument argument - ) -{ - char name[5]; - char *p; - bool allDone; - int i; - - /* Get the task name */ - p = rtems_object_get_name( RTEMS_SELF, 5, name ); - rtems_test_assert( p != NULL ); - - /* Wait on the all tasks to run */ - while (1) { - allDone = true; - for ( i=0; i<TASK_NUMS ; i++ ) { - if (TaskRan[i] == false) - allDone = false; - } - if (allDone) { - puts( "\n\n*** END OF TEST spatomic01 ***\n" ); - rtems_test_exit( 0 ); - } - } -} |