]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Sat, 7 Dec 2002 05:39:20 +0000 (05:39 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 7 Dec 2002 05:39:20 +0000 (05:39 +0000)
* test-skeleton.c (timeout_handler): Allow expected signal to be
SIGALRM.

ChangeLog
nptl/ChangeLog
nptl/Makefile
nptl/tst-stdio1.c [new file with mode: 0644]
nptl/tst-stdio2.c [new file with mode: 0644]
test-skeleton.c

index 5efbd6c99d3db19c24616fa86a19cffeb3cf441d..d44a06feac93f5ac910f56b9225607689ecd0ddf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2002-12-06  Ulrich Drepper  <drepper@redhat.com>
 
+       * test-skeleton.c (timeout_handler): Allow expected signal to be
+       SIGALRM.
+
        * wctype/wcfuncs.c: Add libc_hidden_def for iswalnum.
 
        * sysdeps/posix/raise.c: Add libc_hidden_def for raise.
index 2f29a88309e4650d289ad199337acb5c20147bb2..3d2dcd3156cbc3b9a117742ae447ce5a910169d9 100644 (file)
@@ -1,5 +1,9 @@
 2002-12-06  Ulrich Drepper  <drepper@redhat.com>
 
+       * Makefile (tests): Add tst-stdio1 and tst-stdio2.
+       * tst-stdio1.c: New file.
+       * tst-stdio2.c: New file.
+
        * init.c (__pthread_initialize_minimal): Correct INIT_LIST_HEAD use.
 
        * Makefile (tests): Comment out tst-locale2 for now.
index 7683ab87dba7cde86a7e74ed497a443e3fbe956a..77541b8874d7540017f4b1946cacd4257ad0ee7c 100644 (file)
@@ -131,6 +131,7 @@ tests = tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5 tst-mutex6 \
        tst-signal1 tst-signal2 tst-signal3 \
        tst-exec1 tst-exec2 tst-exec3 \
        tst-exit1 \
+       tst-stdio1 tst-stdio2 \
        tst-stack1 \
        tst-unload \
        tst-sysconf \
diff --git a/nptl/tst-stdio1.c b/nptl/tst-stdio1.c
new file mode 100644 (file)
index 0000000..ebb3e2f
--- /dev/null
@@ -0,0 +1,57 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@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 <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+
+
+static void *tf (void *a)
+{
+  flockfile (stdout);
+  /* This call should never return.  */
+  return a;
+}
+
+
+int
+do_test (void)
+{
+  pthread_t th;
+
+  flockfile (stdout);
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      write (2, "create failed\n", 14);
+      _exit (1);
+    }
+
+  pthread_join (th, NULL);
+
+  puts ("join returned");
+
+  return 0;
+}
+
+
+#define EXPECTED_SIGNAL SIGALRM
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/nptl/tst-stdio2.c b/nptl/tst-stdio2.c
new file mode 100644 (file)
index 0000000..08d6add
--- /dev/null
@@ -0,0 +1,82 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@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 <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static void *tf (void *a)
+{
+  puts ("start tf");
+
+  /* Multiple locking, implicitly or explicitly, must be possible.  */
+  flockfile (stdout);
+
+  puts ("after first flockfile");
+
+  flockfile (stdout);
+
+  puts ("foo");
+
+  funlockfile (stdout);
+
+  puts ("after first funlockfile");
+
+  funlockfile (stdout);
+
+  puts ("all done");
+
+  return a;
+}
+
+
+int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      write (2, "create failed\n", 14);
+      _exit (1);
+    }
+
+  void *result;
+  if (pthread_join (th, &result) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+  else if (result != NULL)
+    {
+      printf ("wrong return value: %p, expected %p\n", result, NULL);
+      exit (1);
+    }
+
+  puts ("join returned succsefully");
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
index a285478ae8a660a7f28ce00b5349ea90c7e180b8..2b5102ba91930f4bc7b32330d7f1b90fe3c7266e 100644 (file)
@@ -145,6 +145,12 @@ timeout_handler (int sig __attribute__ ((unused)))
   CLEANUP_HANDLER;
 #endif
 
+  /* If we expected this signal: good!  */
+#ifdef EXPECTED_SIGNAL
+  if (EXPECTED_SIGNAL == SIGALRM)
+    exit (0);
+#endif
+
   if (WIFSIGNALED (status) && WTERMSIG (status) == SIGKILL)
     fputs ("Timed out: killed the child process\n", stderr);
   else if (WIFSTOPPED (status))