diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-11-17 06:36:54 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-11-22 09:40:22 +0100 |
commit | a7dcef97e93240b1947a0094b1af91e9b9324a30 (patch) | |
tree | 41a02234f131870bcb0c7bcc025682bce45fa582 /testsuites/sptests/sptls04 | |
parent | a8bf9a3f7a191d03733b7759501081265f051fe0 (diff) |
score: Simplify global construction
Update #3243.
Diffstat (limited to 'testsuites/sptests/sptls04')
-rw-r--r-- | testsuites/sptests/sptls04/Makefile.am | 19 | ||||
-rw-r--r-- | testsuites/sptests/sptls04/init.c | 85 | ||||
-rw-r--r-- | testsuites/sptests/sptls04/sptls04.doc | 12 | ||||
-rw-r--r-- | testsuites/sptests/sptls04/sptls04.scn | 7 |
4 files changed, 123 insertions, 0 deletions
diff --git a/testsuites/sptests/sptls04/Makefile.am b/testsuites/sptests/sptls04/Makefile.am new file mode 100644 index 0000000000..9d4afd2158 --- /dev/null +++ b/testsuites/sptests/sptls04/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = sptls04 +sptls04_SOURCES = init.c + +dist_rtems_tests_DATA = sptls04.scn sptls04.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 = $(sptls04_OBJECTS) +LINK_LIBS = $(sptls04_LDLIBS) + +sptls04$(EXEEXT): $(sptls04_OBJECTS) $(sptls04_DEPENDENCIES) + @rm -f sptls04$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/sptls04/init.c b/testsuites/sptests/sptls04/init.c new file mode 100644 index 0000000000..d73b0f4642 --- /dev/null +++ b/testsuites/sptests/sptls04/init.c @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2017 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. + */ + +/* + * This test program runs also on GNU/Linux and FreeBSD. Use + * + * cc init.c && ./a.out + * + * to run it. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef __rtems__ + +#include <tmacros.h> + +#else /* __rtems__ */ + +#include <assert.h> + +#define rtems_test_assert(x) assert(x) + +#endif /* __rtems__ */ + +static __thread int i; + +static __thread int j; + +static __attribute__((__constructor__)) void con(void) +{ + i = 1; +} + +static void test(void) +{ + rtems_test_assert(i == 1); + rtems_test_assert(j == 0); +} + +#ifdef __rtems__ + +const char rtems_test_name[] = "SPTLS 4"; + +static void Init(rtems_task_argument arg) +{ + TEST_BEGIN(); + test(); + TEST_END(); + rtems_test_exit(0); +} + +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 1 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> + +#else /* __rtems__ */ + +int main(void) +{ + test(); + return 0; +} + +#endif /* __rtems__ */ diff --git a/testsuites/sptests/sptls04/sptls04.doc b/testsuites/sptests/sptls04/sptls04.doc new file mode 100644 index 0000000000..4c77dace65 --- /dev/null +++ b/testsuites/sptests/sptls04/sptls04.doc @@ -0,0 +1,12 @@ +This file describes the directives and concepts tested by this test set. + +test set name: sptls04 + +directives: + + - None + +concepts: + + - Ensure that global construction affects the thread-local variables of the + first initialization thread to be in line with GNU/Linux and FreeBSD. diff --git a/testsuites/sptests/sptls04/sptls04.scn b/testsuites/sptests/sptls04/sptls04.scn new file mode 100644 index 0000000000..f07cef1723 --- /dev/null +++ b/testsuites/sptests/sptls04/sptls04.scn @@ -0,0 +1,7 @@ +*** BEGIN OF TEST SPTLS 4 *** +*** TEST VERSION: 5.0.0.b926da560283088c42555a3f2e03a0ae9508087a +*** TEST STATE: EXPECTED-PASS +*** TEST BUILD: default +*** TEST TOOLS: 7.2.0 20170814 (RTEMS 5, RSB d1e6dfcb1e14d2f9d42c79e1137ddca6d8fc67d5, Newlib 2.5.0.20170922) + +*** END OF TEST SPTLS 4 *** |