Module Name:    src
Committed By:   kamil
Date:           Sun Feb 25 14:27:07 UTC 2018

Modified Files:
        src/tests/lib/libc/sys: Makefile t_ucontext.c

Log Message:
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>


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/tests/lib/libc/sys/Makefile
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_ucontext.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/sys/Makefile
diff -u src/tests/lib/libc/sys/Makefile:1.49 src/tests/lib/libc/sys/Makefile:1.50
--- src/tests/lib/libc/sys/Makefile:1.49	Sun Apr  2 21:44:00 2017
+++ src/tests/lib/libc/sys/Makefile	Sun Feb 25 14:27:07 2018
@@ -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_wait4.c	+= -D_KERNTYPE
 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

Index: src/tests/lib/libc/sys/t_ucontext.c
diff -u src/tests/lib/libc/sys/t_ucontext.c:1.1 src/tests/lib/libc/sys/t_ucontext.c:1.2
--- src/tests/lib/libc/sys/t_ucontext.c:1.1	Sat Oct 15 06:54:52 2011
+++ src/tests/lib/libc/sys/t_ucontext.c	Sun Feb 25 14:27:07 2018
@@ -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_TC_BODY(ucontext_basic, tc)
 	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();
 }

Reply via email to