spglobalcon02: New test

Update #3319.
This commit is contained in:
Sebastian Huber
2018-03-06 07:27:18 +01:00
parent 0d44e251d9
commit 8b2d5b8407
6 changed files with 152 additions and 0 deletions
+1
View File
@@ -71,6 +71,7 @@ if HAS_CPLUSPLUS
_SUBDIRS += spglobalcon01
_SUBDIRS += sptls02
endif
_SUBDIRS += spglobalcon02
_SUBDIRS += sptls01
_SUBDIRS += spintrcritical20
_SUBDIRS += spintrcritical21
+1
View File
@@ -59,6 +59,7 @@ sptimecounter03/Makefile
sptimecounter04/Makefile
spatomic01/Makefile
spglobalcon01/Makefile
spglobalcon02/Makefile
spintrcritical22/Makefile
spsem03/Makefile
spmrsp01/Makefile
@@ -0,0 +1,19 @@
rtems_tests_PROGRAMS = spglobalcon02
spglobalcon02_SOURCES = init.c
dist_rtems_tests_DATA = spglobalcon02.scn spglobalcon02.doc
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
LINK_OBJS = $(spglobalcon02_OBJECTS)
LINK_LIBS = $(spglobalcon02_LDLIBS)
spglobalcon02$(EXEEXT): $(spglobalcon02_OBJECTS) $(spglobalcon02_DEPENDENCIES)
@rm -f spglobalcon02$(EXEEXT)
$(make-exe)
include $(top_srcdir)/../automake/local.am
+112
View File
@@ -0,0 +1,112 @@
/*
* Copyright (c) 2018 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* 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 <stdlib.h>
#include <tmacros.h>
const char rtems_test_name[] = "SPGLOBALCON 2";
static int i;
static __attribute__((__constructor__(1000))) void c0(void)
{
rtems_test_assert(i == 0);
++i;
}
static __attribute__((__constructor__(1001))) void c1(void)
{
rtems_test_assert(i == 1);
++i;
}
static __attribute__((__constructor__(1002))) void c2(void)
{
rtems_test_assert(i == 2);
++i;
}
static __attribute__((__constructor__)) void c(void)
{
rtems_test_assert(i == 3);
++i;
}
static __attribute__((__destructor__(1000))) void d0(void)
{
rtems_test_assert(i == 8);
++i;
}
static __attribute__((__destructor__(1001))) void d1(void)
{
rtems_test_assert(i == 7);
++i;
}
static __attribute__((__destructor__(1002))) void d2(void)
{
rtems_test_assert(i == 6);
++i;
}
static __attribute__((__destructor__)) void d(void)
{
rtems_test_assert(i == 5);
++i;
}
static void Init(rtems_task_argument arg)
{
TEST_BEGIN();
rtems_test_assert(i == 4);
++i;
exit(0);
}
static void fatal_extension(
rtems_fatal_source source,
bool always_set_to_false,
rtems_fatal_code error
)
{
if (
source == RTEMS_FATAL_SOURCE_EXIT
&& !always_set_to_false
&& error == 0
&& i == 9
) {
TEST_END();
}
}
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_INITIAL_EXTENSIONS \
{ .fatal = fatal_extension }, \
RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
@@ -0,0 +1,12 @@
This file describes the directives and concepts tested by this test set.
test set name: spglobalcon02
directives:
- _Thread_Global_construction
- _exit
concepts:
- Ensure global construction and destruction works.
@@ -0,0 +1,7 @@
*** BEGIN OF TEST SPGLOBALCON 2 ***
*** TEST VERSION: 5.0.0.5b7a1e145df3d278f315ead280bc55c67184b943
*** TEST STATE: EXPECTED-PASS
*** TEST BUILD: RTEMS_NETWORKING RTEMS_POSIX_API RTEMS_SMP
*** TEST TOOLS: 7.3.0 20180125 (RTEMS 5, RSB 6d9c77c77d271d1fc2dfe8493d6713930b52a6dd, Newlib 3.0.0)
*** END OF TEST SPGLOBALCON 2 ***