summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-07-31 16:16:43 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-07-31 16:16:43 +0000
commit0126591e0ade5fe3a7a237078458c6988091ee46 (patch)
tree991c36f97fbe5bc05eb903947bc496ac76aa7602
parent13893343187f4cbbcc132db3c1663dab5f6729d1 (diff)
2011-07-31 Joel Sherrill <joel.sherrilL@OARcorp.com>
PR 1867/cpukit * Makefile.am, configure.ac, psx12/task.c, psxkey03/init.c, psxrwlock01/test.c: Correct implementation of pthread_exit() and pthread_join() to support the case where a thread is joinable but calls pthread_exit() before a thread has attempted to join. * psx16/.cvsignore, psx16/Makefile.am, psx16/init.c, psx16/psx16.doc, psx16/psx16.scn: New files.
-rw-r--r--testsuites/psxtests/ChangeLog66
-rw-r--r--testsuites/psxtests/Makefile.am2
-rw-r--r--testsuites/psxtests/configure.ac1
-rw-r--r--testsuites/psxtests/psx12/task.c5
-rw-r--r--testsuites/psxtests/psx16/.cvsignore2
-rw-r--r--testsuites/psxtests/psx16/Makefile.am25
-rw-r--r--testsuites/psxtests/psx16/init.c78
-rw-r--r--testsuites/psxtests/psx16/psx16.doc24
-rw-r--r--testsuites/psxtests/psx16/psx16.scn6
-rw-r--r--testsuites/psxtests/psxkey03/init.c5
-rw-r--r--testsuites/psxtests/psxrwlock01/test.c10
11 files changed, 195 insertions, 29 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog
index 6bd7ebfbcf..36625b52ec 100644
--- a/testsuites/psxtests/ChangeLog
+++ b/testsuites/psxtests/ChangeLog
@@ -1,14 +1,24 @@
-2011-02-08 Ralf Corsépius <ralf.corsepius@rtems.org>
+2011-07-31 Joel Sherrill <joel.sherrilL@OARcorp.com>
+
+ PR 1867/cpukit
+ * Makefile.am, configure.ac, psx12/task.c, psxkey03/init.c,
+ psxrwlock01/test.c: Correct implementation of pthread_exit() and
+ pthread_join() to support the case where a thread is joinable but
+ calls pthread_exit() before a thread has attempted to join.
+ * psx16/.cvsignore, psx16/Makefile.am, psx16/init.c, psx16/psx16.doc,
+ psx16/psx16.scn: New files.
+
+2011-02-08 Ralf Corsépius <ralf.corsepius@rtems.org>
* include/pmacros.h: Add PRIxblksize_t, PRIxblkcnt_t.
* configure.ac: Add AC_CHECK_SIZEOF([blksize_t]),
AC_CHECK_SIZEOF([blkcnt_t]).
-2011-02-02 Ralf Corsépius <ralf.corsepius@rtems.org>
+2011-02-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Require autoconf-2.68, automake-1.11.1.
-2010-10-01 Ralf Corsépius <ralf.corsepius@rtems.org>
+2010-10-01 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Check for pthread_attr_{get,set}cputime instead of
pthread_pthread_attr_{get,set}cputime (Typo).
@@ -18,7 +28,7 @@
* psxfile01/test.c, psxmount/test.c, psxreaddir/test.c,
psxstat/test.c: Update to the new mount API.
-2010-05-29 Ralf Corsépius <ralf.corsepius@rtems.org>
+2010-05-29 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Add AC_CHECK_SIZEOF(off_t).
* include/pmacros.h: Add PRIdoff_t.
@@ -55,7 +65,7 @@
psxhdrs/pthread22.c, psxhdrs/sched01.c, psxhdrs/sched03.c:
Reflect POSIX changes to sched_param.
-2010-04-02 Ralf Corsépius <ralf.corsepius@rtems.org>
+2010-04-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* psxhdrs/proc01.c, psxhdrs/proc02.c, psxhdrs/proc07.c,
psxhdrs/proc08.c, psxhdrs/proc09.c, psxhdrs/proc10.c,
@@ -136,28 +146,28 @@
* psxenosys/Makefile.am: Add documentation file.
* psxenosys/psxenosys.doc: New file.
-2009-01-02 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-01-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* psxsignal03/init.c:
Print sigval.sival_ptr instead of "union sigval".
-2009-01-01 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-01-01 Ralf Corsépius <ralf.corsepius@rtems.org>
* psxstat/test.c: Apply PRI* macros to print struct stat fields.
* psxreaddir/test.c: Apply PRI* macros to print struct stat fields.
* psxfile01/test.c: Remove obsure #ifdef's.
Apply PRI* macros to print struct stat fields.
-2009-10-31 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-10-31 Ralf Corsépius <ralf.corsepius@rtems.org>
* include/pmacros.h: Change TM_OCTOBER to 9, TM_NOVEMBER to 10,
TM_DECEMBER to 11 (tm_mon months start with JAN = 0).
-2009-10-31 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-10-31 Ralf Corsépius <ralf.corsepius@rtems.org>
* include/pmacros.h: November is the 11th month.
-2009-10-30 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-10-30 Ralf Corsépius <ralf.corsepius@rtems.org>
* psxstat/test.c: Remove #ifdef's.
* psxmount/test.c, psxreaddir/test.c: Remove __P (unused anachronism).
@@ -169,7 +179,7 @@
rtems_object_api_minimum_class, rtems_object_api_maximum_class.
Reflect the prototypes having been missing to printf's.
-2009-10-29 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-10-29 Ralf Corsépius <ralf.corsepius@rtems.org>
* psxsysconf/init.c:
Comment out sysconf(LONG_MAX) check (not useful).
@@ -179,11 +189,11 @@
* psx10/init.c: Pass 0x7FFF instead of 0xFFFFFF as invalid pshared
attribute to pthread_condattr_setpshared for 16bit target compliance.
-2009-10-28 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-10-28 Ralf Corsépius <ralf.corsepius@rtems.org>
* psxbarrier01/test.c: Include <tmacros.h>
-2009-10-27 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-10-27 Ralf Corsépius <ralf.corsepius@rtems.org>
* psx01/init.c, psx01/task.c, psx02/init.c, psx03/init.c,
psx04/init.c, psx05/init.c, psx06/init.c, psx07/init.c,
@@ -193,7 +203,7 @@
psxmsgq02/init.c, psxsignal01/init.c, psxualarm/init.c:
Use PRIxpthread_t to print pthread_t's.
-2009-10-27 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-10-27 Ralf Corsépius <ralf.corsepius@rtems.org>
* psxmsgq02/init.c:
Remove cast in call to fatal_posix_service_status_errno.
@@ -206,14 +216,14 @@
* configure.ac:
Add AC_CHECK_DECLS pthread_attr_getcputime, pthread_attr_setcputime.
-2009-10-27 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-10-27 Ralf Corsépius <ralf.corsepius@rtems.org>
* psxtimer01/psxtimer.c: Use %ld to print *.tv_nsec.
* psxsysconf/init.c: Use %ld to print *.tv_nsec.
* psxclock/init.c: Use %ld to print *.tv_nsec.
* psx06/init.c, psx06/system.h: Misc. warning fixes.
-2009-10-26 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-10-26 Ralf Corsépius <ralf.corsepius@rtems.org>
* psxsignal03/init.c: Add missing argument to printf.
* psxfile01/test.c: Use %zu instead of %d to print size_t's.
@@ -222,7 +232,7 @@
* configure.ac: Add AC_CHECK_HEADERS sys/mman.h.
Add AC_CHECK_DECLS pthread_atfork, adjtime, mprotect.
-2009-10-25 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-10-25 Ralf Corsépius <ralf.corsepius@rtems.org>
* psxtime/test.c: Include <sys/time.h>.
Conditionally add local prototype for adjtime()
@@ -236,27 +246,27 @@
if pthread.h doesn't supply it.
* psxkey01/init.c: Include "test_support.h".
-2009-10-25 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-10-25 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Check for pthread_atfork in pthread.h.
* psxrwlock01/test.c: Conditionally add local prototype for
pthread_atfork() if pthread.h doesn't supply it.
Include <pthread.h>.
-2009-10-25 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-10-25 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Check for sys/mman.h.
Check for mprotect in sys/mman.h.
* psxenosys/init.c: Conditionally add local prototype for
mprotect() if sys/mman.h doesn't supply it.
-2009-10-25 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-10-25 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Check for pthread_rwlock_unlock in pthread.h.
* psxrwlock01/test.c: Conditionally add local prototype for
pthread_rwlock_unlock() if pthread.h doesn't supply it.
-2009-10-25 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-10-25 Ralf Corsépius <ralf.corsepius@rtems.org>
* psx01/init.c, psxalarm01/init.c, psxbarrier01/test.c,
psxclock/init.c, psxfatal01/testcase.h, psxfatal02/testcase.h,
@@ -273,7 +283,7 @@
* Makefile.am: Build file IO related tests even with POSIX threading is
disabled.
-2009-10-20 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-10-20 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Don't add -ansi -fasm to CFLAGS.
@@ -768,7 +778,7 @@
* psxfile01/test.c: Change from int to size_t.
-2009-04-03 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-04-03 Ralf Corsépius <ralf.corsepius@rtems.org>
* psx01/Makefile.am, psx02/Makefile.am, psx03/Makefile.am,
psx04/Makefile.am, psx05/Makefile.am, psx06/Makefile.am,
@@ -816,7 +826,7 @@
* psx01/psx01.scn: Bump version to 4.9.99.0
-2008-09-06 Ralf Corsépius <ralf.corsepius@rtems.org>
+2008-09-06 Ralf Corsépius <ralf.corsepius@rtems.org>
* psxcleanup/psxcleanup.c, psxfatal_support/init.c,
psxfatal_support/system.h: Convert to "bool".
@@ -1044,7 +1054,7 @@
* psxrwlock01/main.c, psxrwlock01/test.c: Improve rwlock test to
include normal blocking and unblocking on timeout.
-2006-12-02 Ralf Corsépius <ralf.corsepius@rtems.org>
+2006-12-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: New BUG-REPORT address.
@@ -1078,11 +1088,11 @@
* psxsem01/init.c: Make sem_timedwait more conformant to Open Group
specification.
-2006-10-17 Ralf Corsépius <ralf.corsepius@rtems.org>
+2006-10-17 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Require autoconf-2.60. Require automake-1.10.
-2006-07-11 Ralf Corsépius <ralf.corsepius@rtems.org>
+2006-07-11 Ralf Corsépius <ralf.corsepius@rtems.org>
* psx01/Makefile.am, psx02/Makefile.am, psx03/Makefile.am,
psx04/Makefile.am, psx05/Makefile.am, psx06/Makefile.am,
@@ -1268,7 +1278,7 @@
* psxfile01/test.c, psxmsgq01/init.c, psxstat/test.c,
psxtimer/psxtimer.c: Eliminate warnings and typos.
-2004-02-26 Sébastien Barré <sbarre@sdelcc.com>
+2004-02-26 Sébastien Barré <sbarre@sdelcc.com>
PR 582/core
* psxmsgq01/init.c, psxmsgq01/psxmsgq01.scn: Fix the POSIX message
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index fd7450e2d9..5acb1789f1 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -7,7 +7,7 @@ ACLOCAL_AMFLAGS = -I ../aclocal
SUBDIRS = psxclock
if HAS_POSIX
SUBDIRS += psxhdrs psx01 psx02 psx03 psx04 psx05 psx06 psx07 psx08 psx09 \
- psx10 psx11 psx12 psx13 psx14 psxalarm01 \
+ psx10 psx11 psx12 psx13 psx14 psx16 psxalarm01 \
psxautoinit01 psxautoinit02 psxbarrier01 \
psxcancel psxcancel01 psxcleanup psxcleanup01 \
psxcond01 psxenosys psxkey01 psxkey02 \
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index c001e74bca..bf527e1980 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -74,6 +74,7 @@ psx11/Makefile
psx12/Makefile
psx13/Makefile
psx14/Makefile
+psx16/Makefile
psxalarm01/Makefile
psxautoinit01/Makefile
psxautoinit02/Makefile
diff --git a/testsuites/psxtests/psx12/task.c b/testsuites/psxtests/psx12/task.c
index 67e5a68e40..1d3804da4f 100644
--- a/testsuites/psxtests/psx12/task.c
+++ b/testsuites/psxtests/psx12/task.c
@@ -26,6 +26,11 @@ void *Task_1(
void *argument
)
{
+ /*
+ * Detach ourselves so we don't wait for a join that won't happen.
+ */
+ pthread_detach( pthread_self() );
+
puts( "Task_1: exitting" );
pthread_exit( NULL );
diff --git a/testsuites/psxtests/psx16/.cvsignore b/testsuites/psxtests/psx16/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/psxtests/psx16/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/psxtests/psx16/Makefile.am b/testsuites/psxtests/psx16/Makefile.am
new file mode 100644
index 0000000000..048d896440
--- /dev/null
+++ b/testsuites/psxtests/psx16/Makefile.am
@@ -0,0 +1,25 @@
+##
+## $Id$
+##
+
+rtems_tests_PROGRAMS = psx16
+psx16_SOURCES = init.c
+
+dist_rtems_tests_DATA = psx16.scn
+dist_rtems_tests_DATA += psx16.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)/include
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(psx16_OBJECTS) $(psx16_LDADD)
+LINK_LIBS = $(psx16_LDLIBS)
+
+psx16$(EXEEXT): $(psx16_OBJECTS) $(psx16_DEPENDENCIES)
+ @rm -f psx16$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psx16/init.c b/testsuites/psxtests/psx16/init.c
new file mode 100644
index 0000000000..c829d9aadd
--- /dev/null
+++ b/testsuites/psxtests/psx16/init.c
@@ -0,0 +1,78 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * 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.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+#include "test_support.h"
+#include <pthread.h>
+
+int Index;
+
+void *TestThread(
+ void *argument
+)
+{
+ int *index = (int *)argument;
+
+ *index = 7;
+
+ puts( "TestThread exiting" );
+ return argument;
+}
+
+void *POSIX_Init(
+ rtems_task_argument argument
+)
+{
+ int status;
+ pthread_t id;
+ pthread_attr_t attr;
+ void *join_return;
+
+ puts( "\n\n*** POSIX TEST PSX16 ***" );
+
+ Index = 5;
+
+ /* Initialize and set thread detached attribute */
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
+
+ puts( "Creating TestThread" );
+ status = pthread_create( &id, &attr, TestThread, (void *)&Index );
+ rtems_test_assert( status == 0 );
+
+ /* let test thread run and exit */
+ puts( "Let TestThread run and exit before we attempt to join" );
+ sleep( 2 );
+
+ join_return = NULL;
+ status = pthread_join( id, &join_return );
+ rtems_test_assert( status == 0 );
+ rtems_test_assert( join_return == &Index );
+ rtems_test_assert( *(int *)join_return == 7 );
+ puts( "Successfully joined with TestThread" );
+
+ puts( "*** END OF POSIX TEST PSX16 ***" );
+
+ rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+/* end of file */
diff --git a/testsuites/psxtests/psx16/psx16.doc b/testsuites/psxtests/psx16/psx16.doc
new file mode 100644
index 0000000000..e646efae52
--- /dev/null
+++ b/testsuites/psxtests/psx16/psx16.doc
@@ -0,0 +1,24 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989-2011.
+# 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.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: psx16
+
+directives:
+
+ pthread_join
+ pthread_exit
+
+concepts:
+
++ Ensure that if a joinable thread exits before it has been joined,
+that it waits for a thread to call pthread_join.
diff --git a/testsuites/psxtests/psx16/psx16.scn b/testsuites/psxtests/psx16/psx16.scn
new file mode 100644
index 0000000000..d01e954a57
--- /dev/null
+++ b/testsuites/psxtests/psx16/psx16.scn
@@ -0,0 +1,6 @@
+*** POSIX TEST PSX16 ***
+Creating TestThread
+Let TestThread run and exit before we attempt to join
+TestThread exiting
+Successfully joined with TestThread
+*** END OF POSIX TEST PSX16 ***
diff --git a/testsuites/psxtests/psxkey03/init.c b/testsuites/psxtests/psxkey03/init.c
index d551a444c2..12088e4e98 100644
--- a/testsuites/psxtests/psxkey03/init.c
+++ b/testsuites/psxtests/psxkey03/init.c
@@ -28,6 +28,11 @@ void *Test_Thread(
{
int sc;
+ /*
+ * Detach ourselves so we don't wait for a join that won't happen.
+ */
+ pthread_detach( pthread_self() );
+
puts( "Test_Thread - pthread_setspecific - OK" );
sc = pthread_setspecific( Key, key_value );
rtems_test_assert( !sc );
diff --git a/testsuites/psxtests/psxrwlock01/test.c b/testsuites/psxtests/psxrwlock01/test.c
index af17da1abe..c58b880fb5 100644
--- a/testsuites/psxtests/psxrwlock01/test.c
+++ b/testsuites/psxtests/psxrwlock01/test.c
@@ -35,6 +35,11 @@ void *ReadLockThread(void *arg)
{
int status;
+ /*
+ * Detach ourselves so we don't wait for a join that won't happen.
+ */
+ pthread_detach( pthread_self() );
+
puts( "ReadThread - pthread_rwlock_rdlock(RWLock) blocking -- OK" );
status = pthread_rwlock_rdlock(&RWLock);
rtems_test_assert( !status );
@@ -52,6 +57,11 @@ void *WriteLockThread(void *arg)
{
int status;
+ /*
+ * Detach ourselves so we don't wait for a join that won't happen.
+ */
+ pthread_detach( pthread_self() );
+
puts( "WriteThread - pthread_rwlock_wrlock(RWLock) blocking -- OK" );
status = pthread_rwlock_wrlock(&RWLock);
rtems_test_assert( !status );