summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-02-28 13:02:55 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-03-06 07:27:18 +0100
commit8b2d5b8407144d3d2d96284b5e878d880ebeb67a (patch)
treeaf6f9b2e714a5de08c24eb3f297eb38bc4e8253f /testsuites/sptests
parentada/sp04: Fix test failure due to compiler opti (diff)
downloadrtems-8b2d5b8407144d3d2d96284b5e878d880ebeb67a.tar.bz2
spglobalcon02: New test
Update #3319.
Diffstat (limited to 'testsuites/sptests')
-rw-r--r--testsuites/sptests/Makefile.am1
-rw-r--r--testsuites/sptests/configure.ac1
-rw-r--r--testsuites/sptests/spglobalcon02/Makefile.am19
-rw-r--r--testsuites/sptests/spglobalcon02/init.c112
-rw-r--r--testsuites/sptests/spglobalcon02/spglobalcon02.doc12
-rw-r--r--testsuites/sptests/spglobalcon02/spglobalcon02.scn7
6 files changed, 152 insertions, 0 deletions
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 9bd53c58a2..2813062d6d 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -71,6 +71,7 @@ if HAS_CPLUSPLUS
_SUBDIRS += spglobalcon01
_SUBDIRS += sptls02
endif
+_SUBDIRS += spglobalcon02
_SUBDIRS += sptls01
_SUBDIRS += spintrcritical20
_SUBDIRS += spintrcritical21
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index 36ae9ac56a..2ebc5541c9 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -59,6 +59,7 @@ sptimecounter03/Makefile
sptimecounter04/Makefile
spatomic01/Makefile
spglobalcon01/Makefile
+spglobalcon02/Makefile
spintrcritical22/Makefile
spsem03/Makefile
spmrsp01/Makefile
diff --git a/testsuites/sptests/spglobalcon02/Makefile.am b/testsuites/sptests/spglobalcon02/Makefile.am
new file mode 100644
index 0000000000..3df53efddb
--- /dev/null
+++ b/testsuites/sptests/spglobalcon02/Makefile.am
@@ -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
diff --git a/testsuites/sptests/spglobalcon02/init.c b/testsuites/sptests/spglobalcon02/init.c
new file mode 100644
index 0000000000..aa4c4793b8
--- /dev/null
+++ b/testsuites/sptests/spglobalcon02/init.c
@@ -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>
diff --git a/testsuites/sptests/spglobalcon02/spglobalcon02.doc b/testsuites/sptests/spglobalcon02/spglobalcon02.doc
new file mode 100644
index 0000000000..f86ece810f
--- /dev/null
+++ b/testsuites/sptests/spglobalcon02/spglobalcon02.doc
@@ -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.
diff --git a/testsuites/sptests/spglobalcon02/spglobalcon02.scn b/testsuites/sptests/spglobalcon02/spglobalcon02.scn
new file mode 100644
index 0000000000..714bc3ef88
--- /dev/null
+++ b/testsuites/sptests/spglobalcon02/spglobalcon02.scn
@@ -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 ***