summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-11-22 19:14:51 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-14 07:03:29 +0100
commit21275b58a5a69c3c838082ffc8a7a3641f32ea9a (patch)
treed331e17c15d71f107d0f14581a93ddf768b05813 /testsuites/sptests
parentrtems: Use object information to get config max (diff)
downloadrtems-21275b58a5a69c3c838082ffc8a7a3641f32ea9a.tar.bz2
score: Static Objects_Information initialization
Statically allocate the objects information together with the initial set of objects either via <rtems/confdefs.h>. Provide default object informations with zero objects via librtemscpu.a. This greatly simplifies the workspace size estimate. RTEMS applications which do not use the unlimited objects option are easier to debug since all objects reside now in statically allocated objects of the right types. Close #3621.
Diffstat (limited to 'testsuites/sptests')
-rw-r--r--testsuites/sptests/Makefile.am10
-rw-r--r--testsuites/sptests/configure.ac1
-rw-r--r--testsuites/sptests/spfatal13/spfatal13.doc19
-rw-r--r--testsuites/sptests/spfatal13/spfatal13.scn3
-rw-r--r--testsuites/sptests/spfatal13/testcase.h26
-rw-r--r--testsuites/sptests/spfreechain01/init.c9
-rw-r--r--testsuites/sptests/spsimplesched02/init.c2
-rw-r--r--testsuites/sptests/spsize/size.c2
-rw-r--r--testsuites/sptests/spsysinit01/init.c357
9 files changed, 324 insertions, 105 deletions
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 80680dfe83..8f92873d2b 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -985,16 +985,6 @@ spfatal12_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal12) \
$(support_includes) -I$(top_srcdir)/spfatal12
endif
-if TEST_spfatal13
-sp_tests += spfatal13
-sp_screens += spfatal13/spfatal13.scn
-sp_docs += spfatal13/spfatal13.doc
-spfatal13_SOURCES = spfatal_support/init.c spfatal_support/system.h \
- spfatal13/testcase.h
-spfatal13_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal13) \
- $(support_includes) -I$(top_srcdir)/spfatal13
-endif
-
if TEST_spfatal14
sp_tests += spfatal14
sp_screens += spfatal14/spfatal14.scn
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index e725b39067..d25d9e9e32 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -146,7 +146,6 @@ RTEMS_TEST_CHECK([spfatal09])
RTEMS_TEST_CHECK([spfatal10])
RTEMS_TEST_CHECK([spfatal11])
RTEMS_TEST_CHECK([spfatal12])
-RTEMS_TEST_CHECK([spfatal13])
RTEMS_TEST_CHECK([spfatal14])
RTEMS_TEST_CHECK([spfatal15])
RTEMS_TEST_CHECK([spfatal16])
diff --git a/testsuites/sptests/spfatal13/spfatal13.doc b/testsuites/sptests/spfatal13/spfatal13.doc
deleted file mode 100644
index e47ee27d12..0000000000
--- a/testsuites/sptests/spfatal13/spfatal13.doc
+++ /dev/null
@@ -1,19 +0,0 @@
-# COPYRIGHT (c) 1989-2009.
-# On-Line Applications Research Corporation (OAR).
-#
-# The license and distribution terms for this file may be
-# found in the file LICENSE in this distribution or at
-# http://www.rtems.org/license/LICENSE.
-#
-
-This file describes the directives and concepts tested by this test set.
-
-test set name: fatal 13
-
-directives:
- initialization focued on _Objects_Initialize
-
-concepts:
-
- a. Verify that the combination of maximum of 0 and unlimited is
- detected.
diff --git a/testsuites/sptests/spfatal13/spfatal13.scn b/testsuites/sptests/spfatal13/spfatal13.scn
deleted file mode 100644
index 27c0dba42e..0000000000
--- a/testsuites/sptests/spfatal13/spfatal13.scn
+++ /dev/null
@@ -1,3 +0,0 @@
-*** TEST FATAL 13 ***
-Fatal error (Configuration of unlimited and maximum of 0) hit
-*** END OF TEST FATAL 13 ***
diff --git a/testsuites/sptests/spfatal13/testcase.h b/testsuites/sptests/spfatal13/testcase.h
deleted file mode 100644
index 6f82689958..0000000000
--- a/testsuites/sptests/spfatal13/testcase.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Test __assert_func with NULL function name
- *
- * COPYRIGHT (c) 1989-2010.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#define FATAL_ERROR_TEST_NAME "13"
-#define FATAL_ERROR_DESCRIPTION \
- "Configuration of unlimited and maximum of 0"
-#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE
-#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0
-
-/*
- * Actual object does not matter. Important thing is zero and unlimited.
- */
-#define CONFIGURE_MAXIMUM_PARTITIONS rtems_resource_unlimited(0)
-
-void force_error()
-{
- /* we should not run this far */
- rtems_partition_create(0, NULL, 0, 0, 0, NULL);
-}
diff --git a/testsuites/sptests/spfreechain01/init.c b/testsuites/sptests/spfreechain01/init.c
index 60388101ea..22730793a4 100644
--- a/testsuites/sptests/spfreechain01/init.c
+++ b/testsuites/sptests/spfreechain01/init.c
@@ -25,13 +25,16 @@ static rtems_task Init(rtems_task_argument ignored)
{
Freechain_Control fc;
test_node *node;
+ test_node node2;
TEST_BEGIN();
- _Freechain_Initialize(&fc, NULL, 0, sizeof(test_node));
- rtems_test_assert(_Chain_Is_empty(&fc.Free));
+ _Freechain_Initialize(&fc, &node2, 1, sizeof(node2));
+ rtems_test_assert(_Chain_Node_count_unprotected(&fc.Free) == 1);
+ rtems_test_assert(_Chain_First(&fc.Free) == &node2.Node);
+ rtems_test_assert(_Chain_Last(&fc.Free) == &node2.Node);
- _Freechain_Initialize(&fc, malloc, 1, SIZE_MAX);
+ _Freechain_Initialize(&fc, NULL, 0, sizeof(test_node));
rtems_test_assert(_Chain_Is_empty(&fc.Free));
rtems_test_assert(_Freechain_Get(&fc, NULL, 0, sizeof(test_node)) == NULL);
diff --git a/testsuites/sptests/spsimplesched02/init.c b/testsuites/sptests/spsimplesched02/init.c
index f683a7dd90..b7b1a21919 100644
--- a/testsuites/sptests/spsimplesched02/init.c
+++ b/testsuites/sptests/spsimplesched02/init.c
@@ -81,7 +81,7 @@ rtems_task Init(
TEST_BEGIN();
status = _Objects_Name_to_id_u32(
- &_Thread_Internal_information.Objects,
+ &_Thread_Information.Objects,
rtems_build_name( 'I', 'D', 'L', 'E' ),
RTEMS_SEARCH_LOCAL_NODE,
&Idle_id
diff --git a/testsuites/sptests/spsize/size.c b/testsuites/sptests/spsize/size.c
index 951cdd7414..671ecd7197 100644
--- a/testsuites/sptests/spsize/size.c
+++ b/testsuites/sptests/spsize/size.c
@@ -368,7 +368,7 @@ uninitialized =
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
(sizeof _Thread_Allocated_fp) +
#endif
- (sizeof _Thread_Internal_information) +
+ (sizeof _Thread_Information) +
/*threadq.h*/
diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c
index 6d0c431a85..7e187c423e 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -19,12 +19,18 @@
#include "tmacros.h"
#include <sys/types.h>
+#include <sys/mman.h>
#include <sys/stat.h>
#include <assert.h>
+#include <fcntl.h>
+#include <mqueue.h>
#include <pthread.h>
-#include <string.h>
+#include <semaphore.h>
+#include <signal.h>
#include <stdlib.h>
+#include <string.h>
+#include <time.h>
#include <unistd.h>
#include <rtems.h>
@@ -188,6 +194,16 @@ static void next_step(init_step expected)
step = expected + 1;
}
+static bool info_not_init(const Objects_Information *info)
+{
+ return _Chain_Is_empty(&info->Inactive);
+}
+
+static bool info_is_init(const Objects_Information *info, size_t count)
+{
+ return _Chain_Node_count_unprotected(&info->Inactive) == count;
+}
+
FIRST(RTEMS_SYSINIT_BSP_WORK_AREAS)
{
assert(_Workspace_Area.area_begin == 0);
@@ -248,53 +264,49 @@ LAST(RTEMS_SYSINIT_INITIAL_EXTENSIONS)
FIRST(RTEMS_SYSINIT_DATA_STRUCTURES)
{
- assert(
- _Objects_Get_maximum_index(&_Thread_Internal_information.Objects) == 0
- );
+ assert(info_not_init(&_Thread_Information.Objects));
next_step(DATA_STRUCTURES_PRE);
}
LAST(RTEMS_SYSINIT_DATA_STRUCTURES)
{
- assert(
- _Objects_Get_maximum_index(&_Thread_Internal_information.Objects) != 0
- );
+ assert(info_is_init(&_Thread_Information.Objects, 1));
next_step(DATA_STRUCTURES_POST);
}
FIRST(RTEMS_SYSINIT_USER_EXTENSIONS)
{
- assert(_Objects_Get_maximum_index(&_Extension_Information) == 0);
+ assert(info_not_init(&_Extension_Information));
next_step(USER_EXTENSIONS_PRE);
}
LAST(RTEMS_SYSINIT_USER_EXTENSIONS)
{
- assert(_Objects_Get_maximum_index(&_Extension_Information) != 0);
+ assert(info_is_init(&_Extension_Information, 1));
next_step(USER_EXTENSIONS_POST);
}
FIRST(RTEMS_SYSINIT_CLASSIC_TASKS)
{
- assert(_Objects_Get_maximum_index(&_RTEMS_tasks_Information.Objects) == 0);
+ assert(info_not_init(&_RTEMS_tasks_Information.Objects));
next_step(CLASSIC_TASKS_PRE);
}
LAST(RTEMS_SYSINIT_CLASSIC_TASKS)
{
- assert(_Objects_Get_maximum_index(&_RTEMS_tasks_Information.Objects) != 0);
+ assert(info_is_init(&_RTEMS_tasks_Information.Objects, 2));
next_step(CLASSIC_TASKS_POST);
}
FIRST(RTEMS_SYSINIT_CLASSIC_TIMER)
{
- assert(_Objects_Get_maximum_index(&_Timer_Information) == 0);
+ assert(info_not_init(&_Timer_Information));
next_step(CLASSIC_TIMER_PRE);
}
LAST(RTEMS_SYSINIT_CLASSIC_TIMER)
{
- assert(_Objects_Get_maximum_index(&_Timer_Information) != 0);
+ assert(info_is_init(&_Timer_Information, 1));
next_step(CLASSIC_TIMER_POST);
}
@@ -322,85 +334,85 @@ LAST(RTEMS_SYSINIT_CLASSIC_EVENT)
FIRST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE)
{
- assert(_Objects_Get_maximum_index(&_Message_queue_Information) == 0);
+ assert(info_not_init(&_Message_queue_Information));
next_step(CLASSIC_MESSAGE_QUEUE_PRE);
}
LAST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE)
{
- assert(_Objects_Get_maximum_index(&_Message_queue_Information) != 0);
+ assert(info_is_init(&_Message_queue_Information, 1));
next_step(CLASSIC_MESSAGE_QUEUE_POST);
}
FIRST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE)
{
- assert(_Objects_Get_maximum_index(&_Semaphore_Information) == 0);
+ assert(_Semaphore_Information.initial_objects[0].id == 0);
next_step(CLASSIC_SEMAPHORE_PRE);
}
LAST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE)
{
- assert(_Objects_Get_maximum_index(&_Semaphore_Information) != 0);
+ assert(_Semaphore_Information.initial_objects[0].id != 0);
next_step(CLASSIC_SEMAPHORE_POST);
}
FIRST(RTEMS_SYSINIT_CLASSIC_PARTITION)
{
- assert(_Objects_Get_maximum_index(&_Partition_Information) == 0);
+ assert(info_not_init(&_Partition_Information));
next_step(CLASSIC_PARTITION_PRE);
}
LAST(RTEMS_SYSINIT_CLASSIC_PARTITION)
{
- assert(_Objects_Get_maximum_index(&_Partition_Information) != 0);
+ assert(info_is_init(&_Partition_Information, 1));
next_step(CLASSIC_PARTITION_POST);
}
FIRST(RTEMS_SYSINIT_CLASSIC_REGION)
{
- assert(_Objects_Get_maximum_index(&_Region_Information) == 0);
+ assert(info_not_init(&_Region_Information));
next_step(CLASSIC_REGION_PRE);
}
LAST(RTEMS_SYSINIT_CLASSIC_REGION)
{
- assert(_Objects_Get_maximum_index(&_Region_Information) != 0);
+ assert(info_is_init(&_Region_Information, 1));
next_step(CLASSIC_REGION_POST);
}
FIRST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY)
{
- assert(_Objects_Get_maximum_index(&_Dual_ported_memory_Information) == 0);
+ assert(info_not_init(&_Dual_ported_memory_Information));
next_step(CLASSIC_DUAL_PORTED_MEMORY_PRE);
}
LAST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY)
{
- assert(_Objects_Get_maximum_index(&_Dual_ported_memory_Information) != 0);
+ assert(info_is_init(&_Dual_ported_memory_Information, 1));
next_step(CLASSIC_DUAL_PORTED_MEMORY_POST);
}
FIRST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC)
{
- assert(_Objects_Get_maximum_index(&_Rate_monotonic_Information) == 0);
+ assert(info_not_init(&_Rate_monotonic_Information));
next_step(CLASSIC_RATE_MONOTONIC_PRE);
}
LAST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC)
{
- assert(_Objects_Get_maximum_index(&_Rate_monotonic_Information) != 0);
+ assert(info_is_init(&_Rate_monotonic_Information, 1));
next_step(CLASSIC_RATE_MONOTONIC_POST);
}
FIRST(RTEMS_SYSINIT_CLASSIC_BARRIER)
{
- assert(_Objects_Get_maximum_index(&_Barrier_Information) == 0);
+ assert(info_not_init(&_Barrier_Information));
next_step(CLASSIC_BARRIER_PRE);
}
LAST(RTEMS_SYSINIT_CLASSIC_BARRIER)
{
- assert(_Objects_Get_maximum_index(&_Barrier_Information) != 0);
+ assert(info_is_init(&_Barrier_Information, 1));
next_step(CLASSIC_BARRIER_POST);
}
@@ -432,63 +444,63 @@ LAST(RTEMS_SYSINIT_POSIX_SIGNALS)
FIRST(RTEMS_SYSINIT_POSIX_THREADS)
{
- assert(_Objects_Get_maximum_index(&_POSIX_Threads_Information.Objects) == 0);
+ assert(info_not_init(&_POSIX_Threads_Information.Objects));
next_step(POSIX_THREADS_PRE);
}
LAST(RTEMS_SYSINIT_POSIX_THREADS)
{
- assert(_Objects_Get_maximum_index(&_POSIX_Threads_Information.Objects) != 0);
+ assert(info_is_init(&_POSIX_Threads_Information.Objects, 1));
next_step(POSIX_THREADS_POST);
}
FIRST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE)
{
- assert(_Objects_Get_maximum_index(&_POSIX_Message_queue_Information) == 0);
+ assert(info_not_init(&_POSIX_Message_queue_Information));
next_step(POSIX_MESSAGE_QUEUE_PRE);
}
LAST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE)
{
- assert(_Objects_Get_maximum_index(&_POSIX_Message_queue_Information) != 0);
+ assert(info_is_init(&_POSIX_Message_queue_Information, 1));
next_step(POSIX_MESSAGE_QUEUE_POST);
}
FIRST(RTEMS_SYSINIT_POSIX_SEMAPHORE)
{
- assert(_Objects_Get_maximum_index(&_POSIX_Semaphore_Information) == 0);
+ assert(info_not_init(&_POSIX_Semaphore_Information));
next_step(POSIX_SEMAPHORE_PRE);
}
LAST(RTEMS_SYSINIT_POSIX_SEMAPHORE)
{
- assert(_Objects_Get_maximum_index(&_POSIX_Semaphore_Information) != 0);
+ assert(info_is_init(&_POSIX_Semaphore_Information, 1));
next_step(POSIX_SEMAPHORE_POST);
}
#ifdef RTEMS_POSIX_API
FIRST(RTEMS_SYSINIT_POSIX_TIMER)
{
- assert(_Objects_Get_maximum_index(&_POSIX_Timer_Information) == 0);
+ assert(info_not_init(&_POSIX_Timer_Information));
next_step(POSIX_TIMER_PRE);
}
LAST(RTEMS_SYSINIT_POSIX_TIMER)
{
- assert(_Objects_Get_maximum_index(&_POSIX_Timer_Information) != 0);
+ assert(info_is_init(&_POSIX_Timer_Information, 1));
next_step(POSIX_TIMER_POST);
}
#endif /* RTEMS_POSIX_API */
FIRST(RTEMS_SYSINIT_POSIX_SHM)
{
- assert(_Objects_Get_maximum_index(&_POSIX_Shm_Information) == 0);
+ assert(info_not_init(&_POSIX_Shm_Information));
next_step(POSIX_SHM_PRE);
}
LAST(RTEMS_SYSINIT_POSIX_SHM)
{
- assert(_Objects_Get_maximum_index(&_POSIX_Shm_Information) != 0);
+ assert(info_is_init(&_POSIX_Shm_Information, 1));
next_step(POSIX_SHM_POST);
}
@@ -512,13 +524,13 @@ LAST(RTEMS_SYSINIT_POSIX_CLEANUP)
FIRST(RTEMS_SYSINIT_POSIX_KEYS)
{
- assert(_Objects_Get_maximum_index(&_POSIX_Keys_Information) == 0);
+ assert(info_not_init(&_POSIX_Keys_Information));
next_step(POSIX_KEYS_PRE);
}
LAST(RTEMS_SYSINIT_POSIX_KEYS)
{
- assert(_Objects_Get_maximum_index(&_POSIX_Keys_Information) != 0);
+ assert(info_is_init(&_POSIX_Keys_Information, 2));
next_step(POSIX_KEYS_POST);
}
@@ -657,11 +669,268 @@ LAST_STEP(TENTH);
LAST_STEP(MIDDLE);
LAST_STEP(LAST);
-static void Init(rtems_task_argument arg)
+static void do_barrier_create(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_barrier_create(
+ rtems_build_name('T', 'E', 'S', 'T'),
+ RTEMS_DEFAULT_ATTRIBUTES,
+ 1,
+ &id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_barrier_delete(id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+static void do_extensions_create(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+ rtems_extensions_table table;
+
+ memset(&table, 0, sizeof(table));
+ sc = rtems_extension_create(
+ rtems_build_name('T', 'E', 'S', 'T'),
+ &table,
+ &id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_extension_delete(id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+static void do_message_queue_create(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_message_queue_create(
+ rtems_build_name('T', 'E', 'S', 'T'),
+ 1,
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_message_queue_delete(id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+static void do_partition_create(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+ long buf[32];
+
+ sc = rtems_partition_create(
+ rtems_build_name('T', 'E', 'S', 'T'),
+ buf,
+ sizeof(buf),
+ sizeof(buf),
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_partition_delete(id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+static void do_period_create(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_rate_monotonic_create(
+ rtems_build_name('T', 'E', 'S', 'T'),
+ &id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_rate_monotonic_delete(id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+static void do_port_create(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_port_create(
+ rtems_build_name('T', 'E', 'S', 'T'),
+ NULL,
+ NULL,
+ 1,
+ &id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_port_delete(id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+static void do_region_create(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+ long buf[32];
+
+ sc = rtems_region_create(
+ rtems_build_name('T', 'E', 'S', 'T'),
+ buf,
+ sizeof(buf),
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_region_delete(id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+static void do_semaphore_create(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_semaphore_create(
+ rtems_build_name('T', 'E', 'S', 'T'),
+ 0,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ 0,
+ &id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_semaphore_delete(id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+static void do_task_create(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_task_create(
+ rtems_build_name('T', 'E', 'S', 'T'),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_task_delete(id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+static void do_timer_create(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_timer_create(rtems_build_name('T', 'E', 'S', 'T'), &id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_timer_delete(id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+static void do_cleanup_push_pop(void)
{
pthread_cleanup_push(NULL, NULL);
pthread_cleanup_pop(0);
+}
+
+static void do_posix_mq_open(void)
+{
+ struct mq_attr attr;
+ mqd_t mq;
+ int rv;
+
+ memset(&attr, 0, sizeof(attr));
+ attr.mq_maxmsg = 1;
+ attr.mq_msgsize = 1;
+ mq = mq_open("mq", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO, &attr);
+ rtems_test_assert(mq != (mqd_t) -1);
+
+ rv = mq_close(mq);
+ rtems_test_assert(rv == 0);
+
+ rv = mq_unlink("mq");
+ rtems_test_assert(rv == 0);
+}
+
+static void do_posix_sem_open(void)
+{
+ sem_t *sem;
+ int rv;
+
+ sem = sem_open("sem", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO);
+ rtems_test_assert(sem != SEM_FAILED);
+
+ rv = sem_close(sem);
+ rtems_test_assert(rv == 0);
+
+ rv = sem_unlink("sem");
+ rtems_test_assert(rv == 0);
+}
+
+static void do_posix_shm_open(void)
+{
+ int fd;
+ int rv;
+
+ fd = shm_open("/shm", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO);
+ rtems_test_assert(fd >= 0);
+
+ rv = close(fd);
+ rtems_test_assert(rv == 0);
+
+ rv = shm_unlink("/shm");
+ rtems_test_assert(rv == 0);
+}
+
+static void do_posix_timer_create(void)
+{
+#ifdef RTEMS_POSIX_API
+ int rv;
+ timer_t timer;
+
+ rv = timer_create(CLOCK_REALTIME, NULL, &timer);
+ rtems_test_assert(rv == 0);
+
+ rv = timer_delete(timer);
+ rtems_test_assert(rv == 0);
+#endif /* RTEMS_POSIX_API */
+}
+
+static void Init(rtems_task_argument arg)
+{
next_step(INIT_TASK);
+ do_barrier_create();
+ do_extensions_create();
+ do_message_queue_create();
+ do_partition_create();
+ do_period_create();
+ do_port_create();
+ do_region_create();
+ do_semaphore_create();
+ do_task_create();
+ do_timer_create();
+ do_cleanup_push_pop();
+ do_posix_mq_open();
+ do_posix_sem_open();
+ do_posix_shm_open();
+ do_posix_timer_create();
TEST_END();
exit(0);
}
@@ -672,8 +941,11 @@ static void *POSIX_Init(void *arg)
}
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+
#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
+
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
#define CONFIGURE_MAXIMUM_BARRIERS 1
@@ -690,7 +962,7 @@ static void *POSIX_Init(void *arg)
#define CONFIGURE_MAXIMUM_SEMAPHORES 1
-#define CONFIGURE_MAXIMUM_TASKS 1
+#define CONFIGURE_MAXIMUM_TASKS 2
#define CONFIGURE_MAXIMUM_TIMERS 1
@@ -710,6 +982,9 @@ static void *POSIX_Init(void *arg)
#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
+#define CONFIGURE_MESSAGE_BUFFER_MEMORY \
+ CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(1, 1)
+
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_STACK_CHECKER_ENABLED