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 Add new tests in lib/libc/sys/t_ucontext
details: https://anonhg.NetBSD.org/src/rev/b491dc51404a
branches: trunk
changeset: 359785:b491dc51404a
user: kamil <kamil%NetBSD.org@localhost>
date: Sun Feb 25 14:27:07 2018 +0000
description:
Add new tests in lib/libc/sys/t_ucontext
New tests:
- ucontext_sp
- ucontext_fp
- ucontext_pc
- ucontext_intrv
They test respectively:
- _UC_MACHINE_SP
- _UC_MACHINE_FP
- _UC_MACHINE_PC
- _UC_MACHINE_INTRV
These tests attempt to access and print the values from ucontext, without
interpreting the values.
This is a follow up of the _UC_MACHINE_FP() introduction.
These tests use PRIxREGISTER, and require to be built with -D_KERNTYPES.
Sponsored by <The NetBSD Foundation>
diffstat:
tests/lib/libc/sys/Makefile | 3 +-
tests/lib/libc/sys/t_ucontext.c | 68 +++++++++++++++++++++++++++++++++++++++-
2 files changed, 68 insertions(+), 3 deletions(-)
diffs (109 lines):
diff -r 5a8c902ecb76 -r b491dc51404a tests/lib/libc/sys/Makefile
--- a/tests/lib/libc/sys/Makefile Sun Feb 25 13:15:35 2018 +0000
+++ b/tests/lib/libc/sys/Makefile Sun Feb 25 14:27:07 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.49 2017/04/02 21:44:00 kamil Exp $
+# $NetBSD: Makefile,v 1.50 2018/02/25 14:27:07 kamil Exp $
MKMAN= no
@@ -96,6 +96,7 @@
CPPFLAGS.t_ptrace_wait6.c += -D_KERNTYPES
CPPFLAGS.t_ptrace_waitid.c += -D_KERNTYPES
CPPFLAGS.t_ptrace_waitpid.c += -D_KERNTYPES
+CPPFLAGS.t_ucontext.c += -D_KERNTYPES
FILES= truncate_test.root_owned
FILESBUILD= yes
diff -r 5a8c902ecb76 -r b491dc51404a tests/lib/libc/sys/t_ucontext.c
--- a/tests/lib/libc/sys/t_ucontext.c Sun Feb 25 13:15:35 2018 +0000
+++ b/tests/lib/libc/sys/t_ucontext.c Sun Feb 25 14:27:07 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ucontext.c,v 1.1 2011/10/15 06:54:52 jruoho Exp $ */
+/* $NetBSD: t_ucontext.c,v 1.2 2018/02/25 14:27:07 kamil Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_ucontext.c,v 1.1 2011/10/15 06:54:52 jruoho Exp $");
+__RCSID("$NetBSD: t_ucontext.c,v 1.2 2018/02/25 14:27:07 kamil Exp $");
#include <atf-c.h>
#include <stdio.h>
@@ -68,9 +68,73 @@
ATF_REQUIRE_EQ(y, 21);
}
+ATF_TC(ucontext_sp);
+ATF_TC_HEAD(ucontext_sp, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Retrive _UC_MACHINE_SP()");
+}
+
+ATF_TC_BODY(ucontext_sp, tc)
+{
+ ucontext_t u;
+
+ getcontext(&u);
+
+ printf("_UC_MACHINE_SP(u)=%" PRIxREGISTER "\n", _UC_MACHINE_SP(&u));
+}
+
+ATF_TC(ucontext_fp);
+ATF_TC_HEAD(ucontext_fp, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Retrive _UC_MACHINE_FP()");
+}
+
+ATF_TC_BODY(ucontext_fp, tc)
+{
+ ucontext_t u;
+
+ getcontext(&u);
+
+ printf("_UC_MACHINE_FP(u)=%" PRIxREGISTER "\n", _UC_MACHINE_FP(&u));
+}
+
+ATF_TC(ucontext_pc);
+ATF_TC_HEAD(ucontext_pc, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Retrive _UC_MACHINE_PC()");
+}
+
+ATF_TC_BODY(ucontext_pc, tc)
+{
+ ucontext_t u;
+
+ getcontext(&u);
+
+ printf("_UC_MACHINE_PC(u)=%" PRIxREGISTER "\n", _UC_MACHINE_PC(&u));
+}
+
+ATF_TC(ucontext_intrv);
+ATF_TC_HEAD(ucontext_intrv, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Retrive _UC_MACHINE_INTRV()");
+}
+
+ATF_TC_BODY(ucontext_intrv, tc)
+{
+ ucontext_t u;
+
+ getcontext(&u);
+
+ printf("_UC_MACHINE_INTRV(u)=%" PRIxREGISTER "\n", _UC_MACHINE_INTRV(&u));
+}
+
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, ucontext_basic);
+ ATF_TP_ADD_TC(tp, ucontext_sp);
+ ATF_TP_ADD_TC(tp, ucontext_fp);
+ ATF_TP_ADD_TC(tp, ucontext_pc);
+ ATF_TP_ADD_TC(tp, ucontext_intrv);
return atf_no_error();
}
Home |
Main Index |
Thread Index |
Old Index