[rtems commit] psxtests: move pthread_once tests into an extra test.
Sebastian Huber
sebh at rtems.org
Wed Mar 19 07:31:16 UTC 2014
Module: rtems
Branch: master
Commit: 6592cabade83930ae03f086afd416a9bcd029197
Changeset: http://git.rtems.org/rtems/commit/?id=6592cabade83930ae03f086afd416a9bcd029197
Author: Christian Mauderer <Christian.Mauderer at embedded-brains.de>
Date: Tue Mar 18 16:25:33 2014 +0100
psxtests: move pthread_once tests into an extra test.
---
testsuites/psxtests/Makefile.am | 3 +
testsuites/psxtests/configure.ac | 1 +
testsuites/psxtests/psx01/init.c | 17 -------
testsuites/psxtests/psx01/psx01.doc | 3 -
testsuites/psxtests/psx01/psx01.scn | 5 --
testsuites/psxtests/psx01/task.c | 19 -------
testsuites/psxtests/psxonce01/Makefile.am | 22 +++++++++
testsuites/psxtests/psxonce01/init.c | 68 +++++++++++++++++++++++++++
testsuites/psxtests/psxonce01/psxonce01.doc | 19 +++++++
testsuites/psxtests/psxonce01/psxonce01.scn | 11 ++++
testsuites/psxtests/psxonce01/system.h | 28 +++++++++++
11 files changed, 152 insertions(+), 44 deletions(-)
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index fd4ceac..172599b 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 a7b3312..26e4b60 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 1d1a9e8..59605b4 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 60cff7c..7766de3 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 b187dc9..5811744 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 f7abd5c..e97b039 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 0000000..bb11fe1
--- /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 at .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 0000000..6fd6579
--- /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 0000000..10bae5b
--- /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 at 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 0000000..2c5d47d
--- /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 0000000..1e230eb
--- /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 */
More information about the vc
mailing list