Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/rump/rumpkern New testcase which checks that rump copy...
details: https://anonhg.NetBSD.org/src/rev/d2a9420e942e
branches: trunk
changeset: 788873:d2a9420e942e
user: njoly <njoly%NetBSD.org@localhost>
date: Fri Jul 26 16:09:48 2013 +0000
description:
New testcase which checks that rump copyin/copyout/copyinstr/copyoutstr
version return EFAULT for special NULL "user" address.
ok pooka@.
diffstat:
tests/rump/rumpkern/t_copy.c | 28 ++++++++++++++++++++++++----
1 files changed, 24 insertions(+), 4 deletions(-)
diffs (60 lines):
diff -r 1467f3741a10 -r d2a9420e942e tests/rump/rumpkern/t_copy.c
--- a/tests/rump/rumpkern/t_copy.c Fri Jul 26 16:07:51 2013 +0000
+++ b/tests/rump/rumpkern/t_copy.c Fri Jul 26 16:09:48 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_copy.c,v 1.1 2010/11/09 15:25:20 pooka Exp $ */
+/* $NetBSD: t_copy.c,v 1.2 2013/07/26 16:09:48 njoly Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -56,14 +56,16 @@
atf_tc_set_md_var(tc, "descr", "Tests copyoutstr()");
}
-typedef int (copy_fn)(const void *, void *, size_t, size_t *);
+typedef int (copystr_fn)(const void *, void *, size_t, size_t *);
+typedef int (copy_fn)(const void *, void *, size_t);
-extern copy_fn rumpns_copystr, rumpns_copyinstr, rumpns_copyoutstr;
+extern copystr_fn rumpns_copystr, rumpns_copyinstr, rumpns_copyoutstr;
+extern copy_fn rumpns_copyin, rumpns_copyout;
#define TESTSTR "jippii, lisaa puuroa"
static void
-dotest(copy_fn *thefun)
+dotest(copystr_fn *thefun)
{
char buf[sizeof(TESTSTR)+1];
size_t len;
@@ -108,12 +110,30 @@
dotest(rumpns_copyoutstr);
}
+ATF_TC(copy_efault);
+ATF_TC_HEAD(copy_efault, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr", "Tests that copy(9) functions can return EFAULT");
+}
+ATF_TC_BODY(copy_efault, tc)
+{
+ char buf[1024];
+
+ ATF_REQUIRE_EQ(rumpns_copyin(NULL, buf, sizeof(buf)), EFAULT);
+ ATF_REQUIRE_EQ(rumpns_copyout(buf, NULL, sizeof(buf)), EFAULT);
+
+ ATF_REQUIRE_EQ(rumpns_copyinstr(NULL, buf, sizeof(buf), NULL), EFAULT);
+ ATF_REQUIRE_EQ(rumpns_copyoutstr(buf, NULL, sizeof(buf), NULL), EFAULT);
+}
+
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, copystr);
ATF_TP_ADD_TC(tp, copyinstr);
ATF_TP_ADD_TC(tp, copyoutstr);
+ ATF_TP_ADD_TC(tp, copy_efault);
return atf_no_error();
}
Home |
Main Index |
Thread Index |
Old Index