svn commit: branches/uClibc-nptl/test/nptl

sjhill at uclibc.org sjhill at uclibc.org
Sat Feb 11 04:58:25 UTC 2006


Author: sjhill
Date: 2006-02-10 20:58:21 -0800 (Fri, 10 Feb 2006)
New Revision: 13915

Log:
Add another 5 tests that pass leaving us with 14 to go. The best part is that I know why the other 14 are failing.....mhuwhahahahahah....


Added:
   branches/uClibc-nptl/test/nptl/tst-basic3.c
   branches/uClibc-nptl/test/nptl/tst-exit2.c
   branches/uClibc-nptl/test/nptl/tst-exit3.c
   branches/uClibc-nptl/test/nptl/tst-join1.c
   branches/uClibc-nptl/test/nptl/tst-tsd5.c

Modified:
   branches/uClibc-nptl/test/nptl/Makefile


Changeset:
Modified: branches/uClibc-nptl/test/nptl/Makefile
===================================================================
--- branches/uClibc-nptl/test/nptl/Makefile	2006-02-11 04:30:46 UTC (rev 13914)
+++ branches/uClibc-nptl/test/nptl/Makefile	2006-02-11 04:58:21 UTC (rev 13915)
@@ -85,7 +85,8 @@
 	  tst-atfork1							\
 	  tst-attr1 tst-attr2 tst-attr3					\
 	  tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4		\
-	  tst-basic1 tst-basic2 tst-basic4 tst-basic5 tst-basic6	\
+	  tst-basic1 tst-basic2 tst-basic3				\
+	  tst-basic4 tst-basic5 tst-basic6				\
 	  tst-cancel1 tst-cancel8 tst-cancel10 tst-cancel12		\
 	  tst-cancel13 tst-cancel14 tst-cancel15  tst-cancel16		\
 	  tst-cancel19							\
@@ -98,10 +99,11 @@
 	  tst-detach1							\
 	  tst-eintr1 tst-eintr2 tst-eintr3 tst-eintr4 tst-eintr5	\
 	  tst-exec2 tst-exec3 tst-exec4					\
+	  tst-exit2 tst-exit3						\
 	  tst-flock1 tst-flock2						\
 	  tst-fork1 tst-fork2 tst-fork3 tst-fork4			\
 	  tst-initializers1						\
-	  tst-join2 tst-join3						\
+	  tst-join1 tst-join2 tst-join3					\
 	  tst-key1 tst-key2 tst-key4					\
 	  tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6	\
 	  tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5	\
@@ -122,7 +124,7 @@
 	  tst-stack1 tst-stack2						\
 	  tst-stdio1 tst-stdio2 tst-sysconf				\
 	  tst-tls1 tst-tls2 tst-tls3 tst-tls4 tst-tls5			\
-	  tst-tsd1 tst-tsd2 tst-tsd3 tst-tsd4				\
+	  tst-tsd1 tst-tsd2 tst-tsd3 tst-tsd4 tst-tsd5			\
 	  tst-umask1
 
 #

Added: branches/uClibc-nptl/test/nptl/tst-basic3.c
===================================================================
--- branches/uClibc-nptl/test/nptl/tst-basic3.c	2006-02-11 04:30:46 UTC (rev 13914)
+++ branches/uClibc-nptl/test/nptl/tst-basic3.c	2006-02-11 04:58:21 UTC (rev 13915)
@@ -0,0 +1,87 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper at redhat.com>, 2003.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static int nrunning = 1;
+
+
+static void
+final_test (void)
+{
+  puts ("final_test has been called");
+
+#define THE_SIGNAL SIGUSR1
+  kill (getpid (), SIGUSR1);
+}
+
+
+static void *
+tf (void *a)
+{
+  if (pthread_join ((pthread_t) a, NULL) != 0)
+    {
+      printf ("join failed while %d are running\n", nrunning);
+      _exit (1);
+    }
+
+  printf ("%2d left\n", --nrunning);
+
+  return NULL;
+}
+
+
+int
+do_test (void)
+{
+#define N 20
+  pthread_t t[N];
+  pthread_t last = pthread_self ();
+  int i;
+
+  atexit (final_test);
+
+  printf ("starting %d + 1 threads\n", N);
+  for (i = 0; i < N; ++i)
+    {
+      if (pthread_create (&t[i], NULL, tf, (void *) last) != 0)
+	{
+	  puts ("create failed");
+	  _exit (1);
+	}
+
+      ++nrunning;
+
+      last = t[i];
+    }
+
+  printf ("%2d left\n", --nrunning);
+
+  pthread_exit (NULL);
+}
+
+
+#define EXPECTED_SIGNAL THE_SIGNAL
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Added: branches/uClibc-nptl/test/nptl/tst-exit2.c
===================================================================
--- branches/uClibc-nptl/test/nptl/tst-exit2.c	2006-02-11 04:30:46 UTC (rev 13914)
+++ branches/uClibc-nptl/test/nptl/tst-exit2.c	2006-02-11 04:58:21 UTC (rev 13915)
@@ -0,0 +1,40 @@
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static void *
+tf (void *arg)
+{
+  while (1)
+    sleep (100);
+
+  /* NOTREACHED */
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+
+  int e = pthread_create (&th, NULL, tf, NULL);
+  if (e != 0)
+    {
+      printf ("create failed: %s\n", strerror (e));
+      return 1;
+    }
+
+  /* Terminate only this thread.  */
+  pthread_exit (NULL);
+
+  /* NOTREACHED */
+  return 1;
+}
+
+#define EXPECTED_SIGNAL SIGALRM
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Added: branches/uClibc-nptl/test/nptl/tst-exit3.c
===================================================================
--- branches/uClibc-nptl/test/nptl/tst-exit3.c	2006-02-11 04:30:46 UTC (rev 13914)
+++ branches/uClibc-nptl/test/nptl/tst-exit3.c	2006-02-11 04:58:21 UTC (rev 13915)
@@ -0,0 +1,81 @@
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static pthread_barrier_t b;
+
+
+static void *
+tf2 (void *arg)
+{
+  while (1)
+    sleep (100);
+
+  /* NOTREACHED */
+  return NULL;
+}
+
+
+static void *
+tf (void *arg)
+{
+  pthread_t th;
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  e = pthread_create (&th, NULL, tf2, NULL);
+  if (e != 0)
+    {
+      printf ("create failed: %s\n", strerror (e));
+      exit (1);
+    }
+
+  /* Terminate only this thread.  */
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  int e = pthread_create (&th, NULL, tf, NULL);
+  if (e != 0)
+    {
+      printf ("create failed: %s\n", strerror (e));
+      exit (1);
+    }
+
+  e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  /* Terminate only this thread.  */
+  pthread_exit (NULL);
+
+  /* NOTREACHED */
+  return 1;
+}
+
+#define EXPECTED_SIGNAL SIGALRM
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Added: branches/uClibc-nptl/test/nptl/tst-join1.c
===================================================================
--- branches/uClibc-nptl/test/nptl/tst-join1.c	2006-02-11 04:30:46 UTC (rev 13914)
+++ branches/uClibc-nptl/test/nptl/tst-join1.c	2006-02-11 04:58:21 UTC (rev 13915)
@@ -0,0 +1,83 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper at redhat.com>, 2002.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+
+
+static void *
+tf (void *arg)
+{
+  pthread_t mh = (pthread_t) arg;
+  void *result;
+
+  if (pthread_mutex_unlock (&lock) != 0)
+    {
+      puts ("unlock failed");
+      exit (1);
+    }
+
+  if (pthread_join (mh, &result) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+
+  if (result != (void *) 42l)
+    {
+      printf ("result wrong: expected %p, got %p\n", (void *) 42, result);
+      exit (1);
+    }
+
+  exit (0);
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_mutex_lock (&lock) != 0)
+    {
+      puts ("1st lock failed");
+      exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf, (void *) pthread_self ()) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_lock (&lock) != 0)
+    {
+      puts ("2nd lock failed");
+      exit (1);
+    }
+
+  pthread_exit ((void *) 42);
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Added: branches/uClibc-nptl/test/nptl/tst-tsd5.c
===================================================================
--- branches/uClibc-nptl/test/nptl/tst-tsd5.c	2006-02-11 04:30:46 UTC (rev 13914)
+++ branches/uClibc-nptl/test/nptl/tst-tsd5.c	2006-02-11 04:58:21 UTC (rev 13915)
@@ -0,0 +1,81 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper at redhat.com>, 2004.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
+
+
+static void
+cl (void *p)
+{
+  pthread_mutex_unlock (&m);
+}
+
+
+static void *
+tf (void *arg)
+{
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("2nd mutex_lock failed");
+      exit (1);
+    }
+
+  exit (0);
+}
+
+
+static int
+do_test (void)
+{
+  pthread_key_t k;
+  if (pthread_key_create (&k, cl) != 0)
+    {
+      puts ("key_create failed");
+      return 1;
+    }
+  if (pthread_setspecific (k, (void *) 1) != 0)
+    {
+      puts ("setspecific failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("1st mutex_lock failed");
+      return 1;
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  pthread_exit (NULL);
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"




More information about the uClibc-cvs mailing list