summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxonce01
diff options
context:
space:
mode:
authorChristian Mauderer <Christian.Mauderer@embedded-brains.de>2014-03-18 16:25:33 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-03-19 08:34:27 +0100
commit6592cabade83930ae03f086afd416a9bcd029197 (patch)
treee289b022f1f8375d0c4a4c64f2c5bbf6912a2c68 /testsuites/psxtests/psxonce01
parentscore: Add _Assert_Not_reached() (diff)
downloadrtems-6592cabade83930ae03f086afd416a9bcd029197.tar.bz2
psxtests: move pthread_once tests into an extra test.
Diffstat (limited to 'testsuites/psxtests/psxonce01')
-rw-r--r--testsuites/psxtests/psxonce01/Makefile.am22
-rw-r--r--testsuites/psxtests/psxonce01/init.c68
-rw-r--r--testsuites/psxtests/psxonce01/psxonce01.doc19
-rw-r--r--testsuites/psxtests/psxonce01/psxonce01.scn11
-rw-r--r--testsuites/psxtests/psxonce01/system.h28
5 files changed, 148 insertions, 0 deletions
diff --git a/testsuites/psxtests/psxonce01/Makefile.am b/testsuites/psxtests/psxonce01/Makefile.am
new file mode 100644
index 0000000000..bb11fe178b
--- /dev/null
+++ b/testsuites/psxtests/psxonce01/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = psxonce01
+psxonce01_SOURCES = init.c system.h ../include/pmacros.h
+
+dist_rtems_tests_DATA = psxonce01.scn
+
+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)/include
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(psxonce01_OBJECTS)
+LINK_LIBS = $(psxonce01_LDLIBS)
+
+psxonce01$(EXEEXT): $(psxonce01_OBJECTS) $(psxonce01_DEPENDENCIES)
+ @rm -f psxonce01$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxonce01/init.c b/testsuites/psxtests/psxonce01/init.c
new file mode 100644
index 0000000000..6fd65794ab
--- /dev/null
+++ b/testsuites/psxtests/psxonce01/init.c
@@ -0,0 +1,68 @@
+/*
+ * COPYRIGHT (c) 1989-2009.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * 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
+
+#define CONFIGURE_INIT
+#include "system.h"
+
+pthread_once_t nesting_once = PTHREAD_ONCE_INIT;
+
+void Test_init_routine_nesting( void );
+
+void Test_init_routine_nesting( void )
+{
+ int status;
+ puts( "Test_init_routine_nesting: invoked" );
+ status = pthread_once( &nesting_once, Test_init_routine_nesting );
+ rtems_test_assert( status == EINVAL );
+}
+
+void Test_init_routine( void );
+
+void Test_init_routine( void )
+{
+ puts( "Test_init_routine: invoked" );
+}
+
+rtems_task Init(rtems_task_argument argument)
+{
+ int status;
+ pthread_once_t once = PTHREAD_ONCE_INIT;
+
+ puts( "\n\n*** TEST POSIX ONCE 01 ***" );
+
+ /* once nesting */
+ puts( "Init: pthread_once - SUCCESSFUL (init_routine_nesting executes)" );
+ status = pthread_once( &nesting_once, Test_init_routine_nesting );
+ rtems_test_assert( !status );
+
+ /* exercise pthread_once */
+
+ puts( "Init: pthread_once - EINVAL (NULL once_control)" );
+ status = pthread_once( NULL, Test_init_routine );
+ rtems_test_assert( status == EINVAL );
+
+ puts( "Init: pthread_once - EINVAL (NULL init_routine)" );
+ status = pthread_once( &once, NULL );
+ rtems_test_assert( status == EINVAL );
+
+ puts( "Init: pthread_once - SUCCESSFUL (init_routine executes)" );
+ status = pthread_once( &once, Test_init_routine );
+ rtems_test_assert( !status );
+
+ puts( "Init: pthread_once - SUCCESSFUL (init_routine does not execute)" );
+ status = pthread_once( &once, Test_init_routine );
+ rtems_test_assert( !status );
+
+ puts( "*** END OF TEST POSIX ONCE 01 ***" );
+ rtems_test_exit( 0 );
+}
diff --git a/testsuites/psxtests/psxonce01/psxonce01.doc b/testsuites/psxtests/psxonce01/psxonce01.doc
new file mode 100644
index 0000000000..10bae5ba84
--- /dev/null
+++ b/testsuites/psxtests/psxonce01/psxonce01.doc
@@ -0,0 +1,19 @@
+# COPYRIGHT (c) 1989-2009.
+# On-Line Applications Research Corporation (OAR).
+# Copyright (c) 2013 Annelies Odermann <annelies.odermann@gmail.com>
+# Copyright (c) 2014 embedded brains GmbH.
+#
+# 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 file describes the directives and concepts tested by this test set.
+
+test set name: psxonce01
+
+directives:
+ pthread_once
+
+concepts:
++ Verify that pthread_once works as expected for different combinations of
+ legitimate and illegitimate thread initiations
diff --git a/testsuites/psxtests/psxonce01/psxonce01.scn b/testsuites/psxtests/psxonce01/psxonce01.scn
new file mode 100644
index 0000000000..2c5d47d2d1
--- /dev/null
+++ b/testsuites/psxtests/psxonce01/psxonce01.scn
@@ -0,0 +1,11 @@
+
+
+*** TEST POSIX ONCE 01 ***
+Init: pthread_once - SUCCESSFUL (init_routine_nesting executes)
+Test_init_routine_nesting: invoked
+Init: pthread_once - EINVAL (NULL once_control)
+Init: pthread_once - EINVAL (NULL init_routine)
+Init: pthread_once - SUCCESSFUL (init_routine executes)
+Test_init_routine: invoked
+Init: pthread_once - SUCCESSFUL (init_routine does not execute)
+*** END OF TEST POSIX ONCE 01 ***
diff --git a/testsuites/psxtests/psxonce01/system.h b/testsuites/psxtests/psxonce01/system.h
new file mode 100644
index 0000000000..1e230ebc06
--- /dev/null
+++ b/testsuites/psxtests/psxonce01/system.h
@@ -0,0 +1,28 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989-1999.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * 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.
+ */
+
+/* functions */
+
+#include <pmacros.h>
+
+/* configuration information */
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#include <rtems/confdefs.h>
+
+/* end of include file */