summaryrefslogtreecommitdiffstats
path: root/lib/libc_r
diff options
context:
space:
mode:
authord <d@openbsd.org>2001-03-13 00:09:10 +0000
committerd <d@openbsd.org>2001-03-13 00:09:10 +0000
commit30f4c85f34ed248a044bacfc3cf52f98c72a52a3 (patch)
treede15d64c8d4ec6c62b28db857dc98f10ed251cb8 /lib/libc_r
parenttypo in comment (diff)
downloadwireguard-openbsd-30f4c85f34ed248a044bacfc3cf52f98c72a52a3.tar.xz
wireguard-openbsd-30f4c85f34ed248a044bacfc3cf52f98c72a52a3.zip
stronger test
Diffstat (limited to 'lib/libc_r')
-rw-r--r--lib/libc_r/TEST/test_fork.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/libc_r/TEST/test_fork.c b/lib/libc_r/TEST/test_fork.c
index f5733fba627..91167001a30 100644
--- a/lib/libc_r/TEST/test_fork.c
+++ b/lib/libc_r/TEST/test_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_fork.c,v 1.8 2000/10/04 05:50:58 d Exp $ */
+/* $OpenBSD: test_fork.c,v 1.9 2001/03/13 00:09:10 d Exp $ */
/*
* Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu
*
@@ -17,11 +17,18 @@
void *
+empty(void *arg)
+{
+
+ return (void *)0x12345678;
+}
+
+void *
sleeper(void *arg)
{
pthread_set_name_np(pthread_self(), "slpr");
- sleep(4);
+ sleep(10);
PANIC("sleeper timed out");
}
@@ -57,7 +64,14 @@ main()
/* Our pid should change */
ASSERT(getpid() != parent_pid);
/* Our sleeper thread should have disappeared */
+ printf("sleeper should have disappeared\n");
ASSERT(ESRCH == pthread_join(sleeper_thread, &result));
+ printf("sleeper disappeared correctly\n");
+ /* Test starting another thread */
+ CHECKr(pthread_create(&sleeper_thread, NULL, empty, NULL));
+ sleep(1);
+ CHECKr(pthread_join(sleeper_thread, &result));
+ ASSERT(result == (void *)0x12345678);
printf("child ok\n");
_exit(0);
PANIC("child _exit");