From a7dcef97e93240b1947a0094b1af91e9b9324a30 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 17 Nov 2017 06:36:54 +0100 Subject: score: Simplify global construction Update #3243. --- testsuites/sptests/Makefile.am | 1 + testsuites/sptests/configure.ac | 1 + testsuites/sptests/spextensions01/init.c | 6 +-- testsuites/sptests/sptls04/Makefile.am | 19 +++++++ testsuites/sptests/sptls04/init.c | 85 ++++++++++++++++++++++++++++++++ testsuites/sptests/sptls04/sptls04.doc | 12 +++++ testsuites/sptests/sptls04/sptls04.scn | 7 +++ 7 files changed, 128 insertions(+), 3 deletions(-) create mode 100644 testsuites/sptests/sptls04/Makefile.am create mode 100644 testsuites/sptests/sptls04/init.c create mode 100644 testsuites/sptests/sptls04/sptls04.doc create mode 100644 testsuites/sptests/sptls04/sptls04.scn (limited to 'testsuites/sptests') diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index e52316a825..00f7571902 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -64,6 +64,7 @@ _SUBDIRS += spfatal28 _SUBDIRS += spthreadlife01 _SUBDIRS += spcache01 _SUBDIRS += sptls03 +_SUBDIRS += sptls04 _SUBDIRS += spcpucounter01 if HAS_CPLUSPLUS _SUBDIRS += spglobalcon01 diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index 0872f678f7..6a303b25c5 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -36,6 +36,7 @@ AM_CONDITIONAL(HAS_SMP,test "$rtems_cv_RTEMS_SMP" = "yes") # Explicitly list all Makefiles here AC_CONFIG_FILES([Makefile +sptls04/Makefile spconsole01/Makefile spintrcritical24/Makefile spfatal31/Makefile diff --git a/testsuites/sptests/spextensions01/init.c b/testsuites/sptests/spextensions01/init.c index 35fce4878e..f9e3c11140 100644 --- a/testsuites/sptests/spextensions01/init.c +++ b/testsuites/sptests/spextensions01/init.c @@ -318,7 +318,7 @@ static void three_fatal( { if (source == RTEMS_FATAL_SOURCE_EXIT) { assert_forward_order(3); - assert(counter == 72); + assert(counter == 68); TEST_END(); } } @@ -453,8 +453,8 @@ static void test(void) #endif active_extensions = 4; - assert(counter == 14); - counter = 16; + assert(counter == 10); + counter = 12; sc = rtems_task_create( rtems_build_name('W', 'O', 'R', 'K'), 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 + * + * + * 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 + +#else /* __rtems__ */ + +#include + +#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 + +#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 *** -- cgit v1.2.3