Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/sys Rename test case names.
details: https://anonhg.NetBSD.org/src/rev/c2aaa332d8d6
branches: trunk
changeset: 767059:c2aaa332d8d6
user: jruoho <jruoho%NetBSD.org@localhost>
date: Thu Jul 07 16:31:11 2011 +0000
description:
Rename test case names.
diffstat:
tests/lib/libc/sys/t_clone.c | 50 +++++++++++++++++--------------------
tests/lib/libc/sys/t_sigqueue.c | 54 +++++++++++++++++++++++++++-------------
2 files changed, 59 insertions(+), 45 deletions(-)
diffs (225 lines):
diff -r 143ff0a67be9 -r c2aaa332d8d6 tests/lib/libc/sys/t_clone.c
--- a/tests/lib/libc/sys/t_clone.c Thu Jul 07 15:53:27 2011 +0000
+++ b/tests/lib/libc/sys/t_clone.c Thu Jul 07 16:31:11 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_clone.c,v 1.1 2011/01/13 02:40:44 pgoyette Exp $ */
+/* $NetBSD: t_clone.c,v 1.2 2011/07/07 16:31:11 jruoho Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_clone.c,v 1.1 2011/01/13 02:40:44 pgoyette Exp $");
+__RCSID("$NetBSD: t_clone.c,v 1.2 2011/07/07 16:31:11 jruoho Exp $");
#include <sys/mman.h>
#include <sys/resource.h>
@@ -72,14 +72,6 @@
return 0;
}
-ATF_TC(clone);
-
-ATF_TC_HEAD(clone, tc)
-{
-
- atf_tc_set_md_var(tc, "descr", "Checks clone(2)");
-}
-
static int
clone_func(void *arg)
{
@@ -104,7 +96,14 @@
return (CHILDEXIT);
}
-ATF_TC_BODY(clone, tc)
+ATF_TC(clone_basic);
+ATF_TC_HEAD(clone_basic, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr", "Checks clone(2)");
+}
+
+ATF_TC_BODY(clone_basic, tc)
{
sigset_t mask;
void *allocstack, *stack;
@@ -171,16 +170,15 @@
ATF_REQUIRE_ERRNO(errno, munmap(allocstack, STACKSIZE) != -1);
}
-ATF_TC(null_stack);
-
-ATF_TC_HEAD(null_stack, tc)
+ATF_TC(clone_null_stack);
+ATF_TC_HEAD(clone_null_stack, tc)
{
atf_tc_set_md_var(tc, "descr",
"Checks that clone(2) fails when stack pointer is NULL");
}
-ATF_TC_BODY(null_stack, tc)
+ATF_TC_BODY(clone_null_stack, tc)
{
int rv;
@@ -191,16 +189,15 @@
ATF_REQUIRE_EQ(errno, EINVAL);
}
-ATF_TC(null_func);
-
-ATF_TC_HEAD(null_func, tc)
+ATF_TC(clone_null_func);
+ATF_TC_HEAD(clone_null_func, tc)
{
atf_tc_set_md_var(tc, "descr",
"Checks that clone(2) fails when function pointer is NULL");
}
-ATF_TC_BODY(null_func, tc)
+ATF_TC_BODY(clone_null_func, tc)
{
void *allocstack, *stack;
int rv, stat;
@@ -220,9 +217,8 @@
ATF_REQUIRE_ERRNO(errno, munmap(allocstack, STACKSIZE) != -1);
}
-ATF_TC(out_of_proc);
-
-ATF_TC_HEAD(out_of_proc, tc)
+ATF_TC(clone_out_of_proc);
+ATF_TC_HEAD(clone_out_of_proc, tc)
{
atf_tc_set_md_var(tc, "descr",
@@ -230,7 +226,7 @@
atf_tc_set_md_var(tc, "require.user", "unprivileged");
}
-ATF_TC_BODY(out_of_proc, tc)
+ATF_TC_BODY(clone_out_of_proc, tc)
{
struct rlimit rl;
int rv;
@@ -253,10 +249,10 @@
ATF_TP_ADD_TCS(tp)
{
- ATF_TP_ADD_TC(tp, clone);
- ATF_TP_ADD_TC(tp, null_stack);
- ATF_TP_ADD_TC(tp, null_func);
- ATF_TP_ADD_TC(tp, out_of_proc);
+ ATF_TP_ADD_TC(tp, clone_basic);
+ ATF_TP_ADD_TC(tp, clone_null_stack);
+ ATF_TP_ADD_TC(tp, clone_null_func);
+ ATF_TP_ADD_TC(tp, clone_out_of_proc);
return atf_no_error();
}
diff -r 143ff0a67be9 -r c2aaa332d8d6 tests/lib/libc/sys/t_sigqueue.c
--- a/tests/lib/libc/sys/t_sigqueue.c Thu Jul 07 15:53:27 2011 +0000
+++ b/tests/lib/libc/sys/t_sigqueue.c Thu Jul 07 16:31:11 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sigqueue.c,v 1.3 2011/01/10 16:42:37 christos Exp $ */
+/* $NetBSD: t_sigqueue.c,v 1.4 2011/07/07 16:31:11 jruoho Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,34 +30,35 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_sigqueue.c,v 1.3 2011/01/10 16:42:37 christos Exp $");
+__RCSID("$NetBSD: t_sigqueue.c,v 1.4 2011/07/07 16:31:11 jruoho Exp $");
+
+#include <atf-c.h>
+#include <errno.h>
#include <signal.h>
-#include <unistd.h>
#include <stdlib.h>
#include <sched.h>
-#include <err.h>
-
-#include <atf-c.h>
+#include <unistd.h>
-ATF_TC(sigqueue);
-ATF_TC_HEAD(sigqueue, tc)
-{
- atf_tc_set_md_var(tc, "descr", "Checks sigqueue sigval delivery");
-}
+static void handler(int, siginfo_t *, void *);
#define VALUE (int)0xc001dad1
static int value;
static void
-/*ARGSUSED*/
handler(int signo, siginfo_t *info, void *data)
{
value = info->si_value.sival_int;
kill(0, SIGINFO);
}
-ATF_TC_BODY(sigqueue, tc)
+ATF_TC(sigqueue_basic);
+ATF_TC_HEAD(sigqueue_basic, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Checks sigqueue(3) sigval delivery");
+}
+
+ATF_TC_BODY(sigqueue_basic, tc)
{
struct sigaction sa;
union sigval sv;
@@ -66,20 +67,37 @@
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_SIGINFO;
- if (sigaction(SIGUSR1, &sa, NULL) == -1)
- err(1, "sigaction");
+ if (sigaction(SIGUSR1, &sa, NULL) != 0)
+ atf_tc_fail("sigaction failed");
sv.sival_int = VALUE;
- if (sigqueue(0, SIGUSR1, sv) == -1)
- err(1, "sigqueue");
+
+ if (sigqueue(0, SIGUSR1, sv) != 0)
+ atf_tc_fail("sigqueue failed");
sched_yield();
ATF_REQUIRE_EQ(sv.sival_int, value);
}
+ATF_TC(sigqueue_err);
+ATF_TC_HEAD(sigqueue_err, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Test errors from sigqueue(3)");
+}
+
+ATF_TC_BODY(sigqueue_err, tc)
+{
+ union sigval sv;
+
+ errno = 0;
+ ATF_REQUIRE_ERRNO(EINVAL, sigqueue(getpid(), -1, sv) == -1);
+}
+
ATF_TP_ADD_TCS(tp)
{
- ATF_TP_ADD_TC(tp, sigqueue);
+
+ ATF_TP_ADD_TC(tp, sigqueue_basic);
+ ATF_TP_ADD_TC(tp, sigqueue_err);
return atf_no_error();
}
Home |
Main Index |
Thread Index |
Old Index