summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests
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
parentscore: Add _Assert_Not_reached() (diff)
downloadrtems-6592cabade83930ae03f086afd416a9bcd029197.tar.bz2
psxtests: move pthread_once tests into an extra test.
Diffstat (limited to 'testsuites/psxtests')
-rw-r--r--testsuites/psxtests/Makefile.am3
-rw-r--r--testsuites/psxtests/configure.ac1
-rw-r--r--testsuites/psxtests/psx01/init.c17
-rw-r--r--testsuites/psxtests/psx01/psx01.doc3
-rw-r--r--testsuites/psxtests/psx01/psx01.scn5
-rw-r--r--testsuites/psxtests/psx01/task.c19
-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
11 files changed, 152 insertions, 44 deletions
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index fd4ceac338..172599bab9 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -30,6 +30,9 @@ if HAS_POSIX
SUBDIRS += psxkey07
endif
+## POSIX Once is always available
+SUBDIRS += psxonce01
+
SUBDIRS += psxrdwrv
include $(top_srcdir)/../automake/subdirs.am
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index a7b3312c87..26e4b60ed3 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -168,6 +168,7 @@ psxmsgq03/Makefile
psxmsgq04/Makefile
psxmutexattr01/Makefile
psxobj01/Makefile
+psxonce01/Makefile
psxpasswd01/Makefile
psxpasswd02/Makefile
psxpipe01/Makefile
diff --git a/testsuites/psxtests/psx01/init.c b/testsuites/psxtests/psx01/init.c
index 1d1a9e8e63..59605b49af 100644
--- a/testsuites/psxtests/psx01/init.c
+++ b/testsuites/psxtests/psx01/init.c
@@ -20,18 +20,6 @@
#include <rtems/score/todimpl.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 *POSIX_Init(
void *argument
)
@@ -107,11 +95,6 @@ void *POSIX_Init(
);
rtems_test_assert( !status );
- /* once nesting */
- puts( "Init: pthread_once - SUCCESSFUL (init_routine_nesting executes)" );
- status = pthread_once( &nesting_once, Test_init_routine_nesting );
- rtems_test_assert( !status );
-
/* create a thread */
puts( "Init: pthread_create - SUCCESSFUL" );
diff --git a/testsuites/psxtests/psx01/psx01.doc b/testsuites/psxtests/psx01/psx01.doc
index 60cff7cf0a..7766de3bef 100644
--- a/testsuites/psxtests/psx01/psx01.doc
+++ b/testsuites/psxtests/psx01/psx01.doc
@@ -14,7 +14,6 @@ test set name: psx01
directives:
pthread_create
pthread_equal
- pthread_once
sched_get_priority_min
sched_get_priority_max
sched_rr_get_interval
@@ -32,5 +31,3 @@ concepts:
+ Verify that thread yielding is operational
+ Verify that pthread_equal works as expected for different combinations of
legitimate and illegitimate thread id’s
-+ Verify that pthread_once works as expected for different combinations of
- legitimate and illegitimate thread initiations
diff --git a/testsuites/psxtests/psx01/psx01.scn b/testsuites/psxtests/psx01/psx01.scn
index b187dc95c4..5811744f54 100644
--- a/testsuites/psxtests/psx01/psx01.scn
+++ b/testsuites/psxtests/psx01/psx01.scn
@@ -27,9 +27,4 @@ Task_1: pthread_equal - match case passed
Task_1: pthread_equal - different case passed
Task_1: pthread_equal - first id bad
Task_1: pthread_equal - second id bad
-Task_1: pthread_once - EINVAL (NULL once_control)
-Task_1: pthread_once - EINVAL (NULL init_routine)
-Task_1: pthread_once - SUCCESSFUL (init_routine executes)
-Test_init_routine: invoked
-Task_1: pthread_once - SUCCESSFUL (init_routine does not execute)
*** END OF POSIX TEST 1 ***
diff --git a/testsuites/psxtests/psx01/task.c b/testsuites/psxtests/psx01/task.c
index f7abd5cc82..e97b039fdc 100644
--- a/testsuites/psxtests/psx01/task.c
+++ b/testsuites/psxtests/psx01/task.c
@@ -35,7 +35,6 @@ void *Task_1_through_3(
)
{
int status;
- pthread_once_t once = PTHREAD_ONCE_INIT;
puts( "Task_1: sched_yield to Init" );
status = sched_yield();
@@ -72,24 +71,6 @@ void *Task_1_through_3(
status = pthread_equal( Init_id, (pthread_t) -1 );
rtems_test_assert( !status );
- /* exercise pthread_once */
-
- puts( "Task_1: pthread_once - EINVAL (NULL once_control)" );
- status = pthread_once( NULL, Test_init_routine );
- rtems_test_assert( status == EINVAL );
-
- puts( "Task_1: pthread_once - EINVAL (NULL init_routine)" );
- status = pthread_once( &once, NULL );
- rtems_test_assert( status == EINVAL );
-
- puts( "Task_1: pthread_once - SUCCESSFUL (init_routine executes)" );
- status = pthread_once( &once, Test_init_routine );
- rtems_test_assert( !status );
-
- puts( "Task_1: pthread_once - SUCCESSFUL (init_routine does not execute)" );
- status = pthread_once( &once, Test_init_routine );
- rtems_test_assert( !status );
-
puts( "*** END OF POSIX TEST 1 ***" );
rtems_test_exit( 0 );
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 */