summaryrefslogtreecommitdiffstats
path: root/testsuites/samples
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testsuites/samples/cdtest/main.cc58
-rw-r--r--testsuites/samples/iostream/init.cc9
-rw-r--r--testsuites/samples/minimum/init.c20
3 files changed, 59 insertions, 28 deletions
diff --git a/testsuites/samples/cdtest/main.cc b/testsuites/samples/cdtest/main.cc
index 894e404ba1..1c5057a32b 100644
--- a/testsuites/samples/cdtest/main.cc
+++ b/testsuites/samples/cdtest/main.cc
@@ -25,9 +25,11 @@
#include <rtems.h>
#include <rtems/bspIo.h>
#include <rtems/test-info.h>
+#include <rtems/sysinit.h>
#include <cstdio>
#include <cstdlib>
+#include <cstring>
#include <stdexcept>
#ifdef RTEMS_TEST_IO_STREAM
@@ -44,13 +46,6 @@ extern rtems_task main_task(rtems_task_argument);
static int num_inst = 0;
-static void check_begin_of_test(void)
-{
- if ( num_inst == 0 ) {
- TEST_BEGIN();
- }
-}
-
static void check_end_of_test(void)
{
if ( num_inst == 0 ) {
@@ -62,7 +57,6 @@ class AClass {
public:
AClass(const char *p = "LOCAL" ) : ptr( p )
{
- check_begin_of_test();
num_inst++;
printf(
"%s: Hey I'm in base class constructor number %d for %p.\n",
@@ -104,7 +98,6 @@ class BClass : public AClass {
public:
BClass(const char *p = "LOCAL" ) : AClass( p )
{
- check_begin_of_test();
num_inst++;
printf(
"%s: Hey I'm in derived class constructor number %d for %p.\n",
@@ -244,3 +237,50 @@ rtems_task main_task(
printf( "Global Dtors should be called after this line....\n" );
exit(0);
}
+
+/*
+ * Exceptions during system initialization work only on targets which do not
+ * need a registration of exception frames during the global construction. In
+ * particular, targets which use the DWARF2 unwinder cannot use exceptions
+ * during system initialization.
+ */
+#if defined(__arm__)
+#define CAN_DO_EXCEPTIONS_DURING_SYSINIT
+#endif
+
+#ifdef CAN_DO_EXCEPTIONS_DURING_SYSINIT
+static void early_exception()
+{
+ try
+ {
+ throw "early exception";
+ }
+ catch( const char *e )
+ {
+ rtems_test_assert(strcmp(e, "early exception") == 0);
+ throw "early exception 2";
+ }
+}
+#endif
+
+static void test_exceptions_during_system_init()
+{
+ TEST_BEGIN();
+
+#ifdef CAN_DO_EXCEPTIONS_DURING_SYSINIT
+ try
+ {
+ early_exception();
+ }
+ catch( const char *e )
+ {
+ rtems_test_assert(strcmp(e, "early exception 2") == 0);
+ }
+#endif
+}
+
+RTEMS_SYSINIT_ITEM(
+ test_exceptions_during_system_init,
+ RTEMS_SYSINIT_IDLE_THREADS,
+ RTEMS_SYSINIT_ORDER_LAST
+);
diff --git a/testsuites/samples/iostream/init.cc b/testsuites/samples/iostream/init.cc
index 22d973019b..ddd38a9d15 100644
--- a/testsuites/samples/iostream/init.cc
+++ b/testsuites/samples/iostream/init.cc
@@ -44,16 +44,17 @@
#include <stdlib.h>
+#include <tmacros.h>
+
const char rtems_test_name[] = "IOSTREAM";
rtems_task Init(
rtems_task_argument ignored
)
{
- std::cout << std::endl << std::endl
- << "*** BEGIN OF TEST " << rtems_test_name << " ***" << std::endl;
+ TEST_BEGIN();
std::cout << "Hello World" << std::endl;
- std::cout << "*** END OF TEST " << rtems_test_name << " ***" << std::endl;
- exit( 0 );
+ TEST_END();
+ rtems_test_exit( 0 );
}
diff --git a/testsuites/samples/minimum/init.c b/testsuites/samples/minimum/init.c
index c988d6d750..ee14a1aef4 100644
--- a/testsuites/samples/minimum/init.c
+++ b/testsuites/samples/minimum/init.c
@@ -81,7 +81,12 @@ static void *Init( uintptr_t ignored )
* demonstrates that the user can specify how small of a minimum
* stack they want.
*/
+#ifdef RTEMS_GCOV_COVERAGE
+#define CONFIGURE_MINIMUM_TASK_STACK_SIZE \
+ (CPU_STACK_MINIMUM_SIZE - CPU_STACK_ALIGNMENT)
+#else
#define CONFIGURE_MINIMUM_TASK_STACK_SIZE 512
+#endif
/*
* Keep the interrupt/initialization stack as is. Otherwise, the test may fail
@@ -100,21 +105,6 @@ static void *Init( uintptr_t ignored )
#define CONFIGURE_MAXIMUM_PRIORITY 15
/*
- * This configures RTEMS to use a single memory pool for the RTEMS Workspace
- * and C Program Heap. If not defined, there will be separate memory pools
- * for the RTEMS Workspace and C Program Heap. Having separate pools
- * does haved some advantages in the event a task blows a stack or writes
- * outside its memory area. However, in low memory systems the overhead of
- * the two pools plus the potential for unused memory in either pool is
- * very undesirable.
- *
- * In high memory environments, this is desirable when you want to use
- * the RTEMS "unlimited" objects option. You will be able to create objects
- * until you run out of memory.
- */
-#define CONFIGURE_UNIFIED_WORK_AREAS
-
-/*
* In this application, the initialization task performs the system
* initialization and then transforms itself into the idle task.
*/