test remove signal delivery

This commit is contained in:
pooka 2011-01-14 13:23:15 +00:00
parent 9fba158b8b
commit 1a076ae981
5 changed files with 110 additions and 8 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.13 2011/01/14 13:08:00 pooka Exp $
# $NetBSD: Makefile,v 1.14 2011/01/14 13:23:15 pooka Exp $
.include <bsd.own.mk>
@ -16,7 +16,7 @@ TESTS_C+= t_vm
TESTS_SH= t_sp
SUBDIR+= h_client
SUBDIR+= h_client h_server
ADD_TO_LD= -lrumpvfs -lrump -lrumpuser -lpthread
LDADD.t_modlinkset+= -lukfs -lrumpdev_disk -lrumpdev -lrumpfs_msdos

View File

@ -1,4 +1,4 @@
/* $NetBSD: h_simplecli.c,v 1.1 2010/11/30 22:09:15 pooka Exp $ */
/* $NetBSD: h_simplecli.c,v 1.2 2011/01/14 13:23:15 pooka Exp $ */
#include <sys/types.h>
@ -11,13 +11,20 @@
#include <rump/rumpclient.h>
int
main(void)
main(int argc, char *argv[])
{
if (rumpclient_init() == -1)
err(1, "rumpclient init");
if (rump_sys_getpid() > 0)
exit(0);
err(1, "getpid");
if (argc > 1) {
for (;;) {
rump_sys_getpid();
usleep(10000);
}
} else {
if (rump_sys_getpid() > 0)
exit(0);
err(1, "getpid");
}
}

View File

@ -0,0 +1,20 @@
# $NetBSD: Makefile,v 1.3 2011/01/14 13:23:15 pooka Exp $
#
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/rump/rumpkern/h_server
TESTS_C= h_simpleserver
ATFFILE= no
LDADD+= -lrump -lrumpuser -lpthread
WARNS= 4
NOMAN=
KERNSPACE != cd ${.CURDIR}/../../kernspace && ${PRINTOBJDIR}
LDADD+= -L${KERNSPACE} -lkernspace
.include <bsd.test.mk>

View File

@ -0,0 +1,63 @@
/* $NetBSD: h_simpleserver.c,v 1.3 2011/01/14 13:23:15 pooka Exp $ */
#include <sys/types.h>
#include <rump/rump.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "../../kernspace/kernspace.h"
#define NOFAIL(e) do { int rv = e; if (rv) err(1, #e); } while (/*CONSTCOND*/0)
struct {
const char *str;
void (*dofun)(char *);
} actions[] = {
{ "sendsig", rumptest_sendsig },
};
int
main(int argc, char *argv[])
{
unsigned i;
bool match;
if (argc < 2)
exit(1);
NOFAIL(rump_daemonize_begin());
NOFAIL(rump_init());
NOFAIL(rump_init_server(argv[1]));
NOFAIL(rump_daemonize_done(RUMP_DAEMONIZE_SUCCESS));
if (argc > 2) {
char *arg = NULL;
if (argc == 4)
arg = argv[3];
for (i = 0; i < __arraycount(actions); i++) {
if (strcmp(actions[i].str, argv[2]) == 0) {
rump_schedule();
actions[i].dofun(arg);
rump_unschedule();
match = true;
}
}
if (!match) {
exit(1);
}
pause();
} else {
for (;;)
pause();
}
return 0;
}

View File

@ -1,4 +1,4 @@
# $NetBSD: t_sp.sh,v 1.8 2011/01/12 12:32:53 pooka Exp $
# $NetBSD: t_sp.sh,v 1.9 2011/01/14 13:23:15 pooka Exp $
#
# Copyright (c) 2010 The NetBSD Foundation, Inc.
# All rights reserved.
@ -48,6 +48,7 @@ test_case fork_simple fork simple
test_case fork_pipecomm fork pipecomm
test_case fork_fakeauth fork fakeauth
test_case sigsafe sigsafe sigsafe
test_case signal signal
basic()
{
@ -79,6 +80,16 @@ sigsafe()
export RUMP_SERVER=unix://commsock
atf_check -s exit:0 rump_server ${RUMP_SERVER}
atf_check -s exit:0 $(atf_get_srcdir)/h_client/h_sigcli
}
signal()
{
export RUMP_SERVER=unix://commsock
atf_check -s exit:0 $(atf_get_srcdir)/h_server/h_simpleserver \
${RUMP_SERVER} sendsig 27
atf_check -s signal:27 $(atf_get_srcdir)/h_client/h_simplecli block
}
atf_init_test_cases()
@ -92,4 +103,5 @@ atf_init_test_cases()
atf_add_test_case fork_pipecomm
atf_add_test_case fork_fakeauth
atf_add_test_case sigsafe
atf_add_test_case signal
}