The siginfo tests have migrated to atf in src/tests/lib/libc/gen/

This commit is contained in:
pgoyette 2010-12-25 01:08:36 +00:00
parent de2970929a
commit 0352bad5fd
9 changed files with 0 additions and 361 deletions

View File

@ -1,5 +0,0 @@
# $NetBSD: Makefile,v 1.2 2009/02/17 19:05:22 christos Exp $
SUBDIR+= sigalrm sigchld sigfpe sigsegv
.include <bsd.subdir.mk>

View File

@ -1,10 +0,0 @@
# $NetBSD: Makefile,v 1.1 2003/09/14 06:55:01 christos Exp $
NOMAN= # defined
PROG= sigalrm
regress: ${PROG}
./${PROG}
.include <bsd.prog.mk>

View File

@ -1,59 +0,0 @@
/* $NetBSD: sigalrm.c,v 1.6 2007/05/21 20:18:01 dogcow Exp $ */
#include <sys/time.h>
#include <sys/ucontext.h>
#include <assert.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
void
sigalrm(int signo, siginfo_t *info, void *ptr)
{
#ifdef DEBUG
printf("%d %p %p\n", signo, info, ptr);
if (info != NULL) {
printf("si_signo=%d\n", info->si_signo);
printf("si_errno=%d\n", info->si_errno);
printf("si_code=%d\n", info->si_code);
printf("si_value.sival_int=%d\n", info->si_value.sival_int);
}
if (ptr != NULL) {
ucontext_t *ctx = ptr;
int i;
mcontext_t *mc = &ctx->uc_mcontext;
printf("uc_flags 0x%x\n", ctx->uc_flags);
printf("uc_link %p\n", ctx->uc_link);
for (i = 0; i < sizeof(ctx->uc_sigmask.__bits) /
sizeof(ctx->uc_sigmask.__bits[0]); i++)
printf("uc_sigmask[%d] 0x%x\n", i,
ctx->uc_sigmask.__bits[i]);
printf("uc_stack %p %lu 0x%x\n", ctx->uc_stack.ss_sp,
(unsigned long)ctx->uc_stack.ss_size,
ctx->uc_stack.ss_flags);
for (i = 0; i < sizeof(mc->__gregs)/sizeof(mc->__gregs[0]); i++)
printf("uc_mcontext.greg[%d] 0x%x\n", i,
mc->__gregs[i]);
}
#endif
assert(info->si_signo == SIGALRM);
assert(info->si_code == SI_TIMER);
assert(info->si_value.sival_int == ITIMER_REAL);
exit(0);
}
int
main(void)
{
struct sigaction sa;
sa.sa_flags = SA_SIGINFO;
sa.sa_sigaction = sigalrm;
sigemptyset(&sa.sa_mask);
sigaction(SIGALRM, &sa, NULL);
for (;;) {
alarm(1);
sleep(1);
}
return 0;
}

View File

@ -1,10 +0,0 @@
# $NetBSD: Makefile,v 1.1 2003/09/14 05:38:41 christos Exp $
NOMAN= # defined
PROG= sigchld
regress: ${PROG}
./${PROG}
.include <bsd.prog.mk>

View File

@ -1,132 +0,0 @@
/* $NetBSD: sigchld.c,v 1.7 2006/11/04 00:08:34 oster Exp $ */
#include <sys/ucontext.h>
#include <sys/wait.h>
#include <sys/resource.h>
#include <assert.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
pid_t child;
int code;
int status;
void
handler(int signo, siginfo_t *info, void *ptr)
{
#ifdef DEBUG
if (info != NULL) {
printf("info=%p\n", info);
printf("ptr=%p\n", ptr);
printf("si_signo=%d\n", info->si_signo);
printf("si_errno=%d\n", info->si_errno);
printf("si_code=%d\n", info->si_code);
printf("si_uid=%d\n", info->si_uid);
printf("si_pid=%d\n", info->si_pid);
printf("si_status=%d\n", info->si_status);
printf("si_utime=%d\n", info->si_utime);
printf("si_stime=%d\n", info->si_stime);
}
#endif
assert(info->si_code == code);
assert(info->si_signo == SIGCHLD);
assert(info->si_uid == getuid());
assert(info->si_pid == child);
if (WIFEXITED(info->si_status))
assert(WEXITSTATUS(info->si_status) == status);
else if (WIFSTOPPED(info->si_status))
assert(WSTOPSIG(info->si_status) == status);
else if (WIFSIGNALED(info->si_status))
assert(WTERMSIG(info->si_status) == status);
}
static void
sethandler(void (*action)(int, siginfo_t *, void *))
{
struct sigaction sa;
sa.sa_flags = SA_SIGINFO;
sa.sa_sigaction = action;
sigemptyset(&sa.sa_mask);
sigaction(SIGCHLD, &sa, NULL);
}
static void
runnormal()
{
sigset_t set;
status = 25;
code = CLD_EXITED;
switch ((child = fork())) {
case 0:
sleep(1);
exit(status);
case -1:
err(1, "fork");
default:
sigemptyset(&set);
sigsuspend(&set);
}
}
static void
rundump()
{
sigset_t set;
status = SIGSEGV;
code = CLD_DUMPED;
switch ((child = fork())) {
case 0:
sleep(1);
*(long *)0 = 0;
break;
case -1:
err(1, "fork");
default:
sigemptyset(&set);
sigsuspend(&set);
}
}
static void
runkill()
{
sigset_t set;
status = SIGPIPE;
code = CLD_KILLED;
switch ((child = fork())) {
case 0:
sigemptyset(&set);
sigsuspend(&set);
break;
case -1:
err(1, "fork");
default:
kill(child, SIGPIPE);
sigemptyset(&set);
sigsuspend(&set);
}
}
int
main(void)
{
sigset_t set;
struct rlimit rlim;
(void)getrlimit(RLIMIT_CORE, &rlim);
rlim.rlim_cur = rlim.rlim_max;
(void)setrlimit(RLIMIT_CORE, &rlim);
sethandler(handler);
sigemptyset(&set);
sigaddset(&set, SIGCHLD);
sigprocmask(SIG_BLOCK, &set, NULL);
runnormal();
rundump();
runkill();
return 0;
}

View File

@ -1,10 +0,0 @@
# $NetBSD: Makefile,v 1.1 2009/02/17 19:05:22 christos Exp $
NOMAN= # defined
PROG= sigfpe
regress: ${PROG}
./${PROG}
.include <bsd.prog.mk>

View File

@ -1,68 +0,0 @@
/* $NetBSD: sigfpe.c,v 1.2 2009/02/17 19:22:43 christos Exp $ */
#include <sys/time.h>
#include <sys/ucontext.h>
#include <assert.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifndef __vax__
#include <ieeefp.h>
#endif
sig_atomic_t z = 0;
void
sigfpe(int signo, siginfo_t *info, void *ptr)
{
#ifdef DEBUG
printf("%d %p %p\n", signo, info, ptr);
if (info != NULL) {
printf("si_signo=%d\n", info->si_signo);
printf("si_errno=%d\n", info->si_errno);
printf("si_code=%d\n", info->si_code);
printf("si_value.sival_int=%d\n", info->si_value.sival_int);
}
if (ptr != NULL) {
ucontext_t *ctx = ptr;
int i;
mcontext_t *mc = &ctx->uc_mcontext;
printf("uc_flags 0x%x\n", ctx->uc_flags);
printf("uc_link %p\n", ctx->uc_link);
for (i = 0; i < sizeof(ctx->uc_sigmask.__bits) /
sizeof(ctx->uc_sigmask.__bits[0]); i++)
printf("uc_sigmask[%d] 0x%x\n", i,
ctx->uc_sigmask.__bits[i]);
printf("uc_stack %p %lu 0x%x\n", ctx->uc_stack.ss_sp,
(unsigned long)ctx->uc_stack.ss_size,
ctx->uc_stack.ss_flags);
for (i = 0; i < sizeof(mc->__gregs)/sizeof(mc->__gregs[0]); i++)
printf("uc_mcontext.greg[%d] 0x%x\n", i,
mc->__gregs[i]);
}
#endif
assert(z++ == 0);
assert(info->si_signo == SIGFPE);
assert(info->si_code == FPE_FLTDIV);
assert(info->si_errno == 0);
}
int
main(void)
{
struct sigaction sa;
double d = strtod("0", NULL);
sa.sa_flags = SA_SIGINFO;
sa.sa_sigaction = sigfpe;
sigemptyset(&sa.sa_mask);
sigaction(SIGFPE, &sa, NULL);
#ifndef __vax__
fpsetmask(FP_X_INV|FP_X_DZ|FP_X_OFL|FP_X_UFL|FP_X_IMP);
#endif
printf("%g\n", 1 / d);
assert(z == 1);
return 0;
}

View File

@ -1,10 +0,0 @@
# $NetBSD: Makefile,v 1.1 2003/09/13 22:55:17 christos Exp $
NOMAN= # defined
PROG= sigsegv
regress: ${PROG}
./${PROG}
.include <bsd.prog.mk>

View File

@ -1,57 +0,0 @@
/* $NetBSD: sigsegv.c,v 1.5 2006/05/10 19:07:22 mrg Exp $ */
#include <sys/ucontext.h>
#include <assert.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
void
sigsegv(int signo, siginfo_t *info, void *ptr)
{
#ifdef DEBUG
printf("%d %p %p\n", signo, info, ptr);
if (info != NULL) {
printf("si_signo=%d\n", info->si_signo);
printf("si_errno=%d\n", info->si_errno);
printf("si_code=%d\n", info->si_code);
printf("si_trap=%d\n", info->si_trap);
printf("si_addr=%p\n", info->si_addr);
}
if (ptr != NULL) {
ucontext_t *ctx = ptr;
int i;
mcontext_t *mc = &ctx->uc_mcontext;
printf("uc_flags 0x%x\n", ctx->uc_flags);
printf("uc_link %p\n", ctx->uc_link);
for (i = 0; i < sizeof(ctx->uc_sigmask.__bits) /
sizeof(ctx->uc_sigmask.__bits[0]); i++)
printf("uc_sigmask[%d] 0x%x\n", i,
ctx->uc_sigmask.__bits[i]);
printf("uc_stack %p %lu 0x%x\n", ctx->uc_stack.ss_sp,
(unsigned long)ctx->uc_stack.ss_size,
ctx->uc_stack.ss_flags);
for (i = 0; i < sizeof(mc->__gregs)/sizeof(mc->__gregs[0]); i++)
printf("uc_mcontext.greg[%d] 0x%x\n", i,
mc->__gregs[i]);
}
#endif
assert(info->si_signo == SIGSEGV);
assert(info->si_errno == 0);
assert(info->si_code == SEGV_MAPERR);
assert(info->si_addr == (void *)0);
exit(0);
}
int
main(void)
{
struct sigaction sa;
sa.sa_flags = SA_SIGINFO;
sa.sa_sigaction = sigsegv;
sigemptyset(&sa.sa_mask);
sigaction(SIGSEGV, &sa, NULL);
*(long *)0 = 0;
return 0;
}