[rtems commit] spglobalcon02: New test

Sebastian Huber sebh at rtems.org
Tue Mar 6 06:32:32 UTC 2018


Module:    rtems
Branch:    master
Commit:    8b2d5b8407144d3d2d96284b5e878d880ebeb67a
Changeset: http://git.rtems.org/rtems/commit/?id=8b2d5b8407144d3d2d96284b5e878d880ebeb67a

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Feb 28 13:02:55 2018 +0100

spglobalcon02: New test

Update #3319.

---

 testsuites/sptests/Makefile.am                     |   1 +
 testsuites/sptests/configure.ac                    |   1 +
 testsuites/sptests/spglobalcon02/Makefile.am       |  19 ++++
 testsuites/sptests/spglobalcon02/init.c            | 112 +++++++++++++++++++++
 testsuites/sptests/spglobalcon02/spglobalcon02.doc |  12 +++
 testsuites/sptests/spglobalcon02/spglobalcon02.scn |   7 ++
 6 files changed, 152 insertions(+)

diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 9bd53c5..2813062 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 36ae9ac..2ebc554 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 0000000..3df53ef
--- /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 at .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 0000000..aa4c479
--- /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 at 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 0000000..f86ece8
--- /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 0000000..714bc3e
--- /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 ***




More information about the vc mailing list