diff options
author | David Leonard <d@cvs.openbsd.org> | 2001-03-13 00:09:11 +0000 |
---|---|---|
committer | David Leonard <d@cvs.openbsd.org> | 2001-03-13 00:09:11 +0000 |
commit | 3d7dd3ab39b4cb85851af713a545746f61f4b154 (patch) | |
tree | 7245db7ff8c29a32e53d204c485d37e14f24d683 /lib | |
parent | 664bffe1ca118f507d35ebdb2bab38458f67c17b (diff) |
stronger test
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc_r/TEST/test_fork.c | 18 |
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"); |