Module Name: src Committed By: jruoho Date: Sat Mar 17 17:23:34 UTC 2012
Modified Files: src/distrib/sets/lists/tests: mi src/tests/kernel: Makefile src/tests/lib/libc/sys: Makefile Added Files: src/tests/lib/libc/sys: t_lwp_ctl.c Removed Files: src/tests/kernel: t_lwpctl.c Log Message: Move the _lwp_ctl(2) preemption counter check to the right place. To generate a diff of this commit: cvs rdiff -u -r1.445 -r1.446 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.24 -r1.25 src/tests/kernel/Makefile cvs rdiff -u -r1.1 -r0 src/tests/kernel/t_lwpctl.c cvs rdiff -u -r1.20 -r1.21 src/tests/lib/libc/sys/Makefile cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_lwp_ctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.445 src/distrib/sets/lists/tests/mi:1.446 --- src/distrib/sets/lists/tests/mi:1.445 Sat Mar 17 17:16:41 2012 +++ src/distrib/sets/lists/tests/mi Sat Mar 17 17:23:34 2012 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.445 2012/03/17 17:16:41 jruoho Exp $ +# $NetBSD: mi,v 1.446 2012/03/17 17:23:34 jruoho Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -333,7 +333,7 @@ ./usr/libdata/debug/usr/tests/kernel/t_extent.debug tests-kernel-tests debug,atf ./usr/libdata/debug/usr/tests/kernel/t_filedesc.debug tests-kernel-tests debug,atf ./usr/libdata/debug/usr/tests/kernel/t_lock.debug tests-kernel-tests debug,atf -./usr/libdata/debug/usr/tests/kernel/t_lwpctl.debug tests-kernel-tests debug,atf +./usr/libdata/debug/usr/tests/kernel/t_lwpctl.debug tests-obsolete obsolete ./usr/libdata/debug/usr/tests/kernel/t_mkdir.debug tests-obsolete obsolete ./usr/libdata/debug/usr/tests/kernel/t_pipe.debug tests-obsolete obsolete ./usr/libdata/debug/usr/tests/kernel/t_poll3w.debug tests-obsolete obsolete @@ -536,6 +536,7 @@ ./usr/libdata/debug/usr/tests/lib/libc/sys/t_kill.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/sys/t_link.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/sys/t_listen.debug tests-lib-debug debug,atf +./usr/libdata/debug/usr/tests/lib/libc/sys/t_lwp_ctl.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/sys/t_mincore.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/sys/t_mkdir.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/sys/t_mkfifo.debug tests-lib-debug debug,atf @@ -1954,7 +1955,7 @@ ./usr/tests/kernel/t_extent tests-kernel-tests atf ./usr/tests/kernel/t_filedesc tests-kernel-tests atf ./usr/tests/kernel/t_lock tests-kernel-tests atf -./usr/tests/kernel/t_lwpctl tests-kernel-tests atf +./usr/tests/kernel/t_lwpctl tests-obsolete obsolete ./usr/tests/kernel/t_mkdir tests-obsolete obsolete ./usr/tests/kernel/t_pipe tests-obsolete obsolete ./usr/tests/kernel/t_poll3w tests-obsolete obsolete @@ -2258,6 +2259,7 @@ ./usr/tests/lib/libc/sys/t_kill tests-lib-tests atf ./usr/tests/lib/libc/sys/t_link tests-lib-tests atf ./usr/tests/lib/libc/sys/t_listen tests-lib-tests atf +./usr/tests/lib/libc/sys/t_lwp_ctl tests-lib-tests atf ./usr/tests/lib/libc/sys/t_mincore tests-lib-tests atf ./usr/tests/lib/libc/sys/t_mkdir tests-lib-tests atf ./usr/tests/lib/libc/sys/t_mkfifo tests-lib-tests atf Index: src/tests/kernel/Makefile diff -u src/tests/kernel/Makefile:1.24 src/tests/kernel/Makefile:1.25 --- src/tests/kernel/Makefile:1.24 Mon Feb 13 21:03:06 2012 +++ src/tests/kernel/Makefile Sat Mar 17 17:23:34 2012 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.24 2012/02/13 21:03:06 martin Exp $ +# $NetBSD: Makefile,v 1.25 2012/03/17 17:23:34 jruoho Exp $ NOMAN= # defined @@ -9,7 +9,6 @@ TESTSDIR= ${TESTSBASE}/kernel TESTS_SUBDIRS= kqueue tty TESTS_C= t_lock -TESTS_C+= t_lwpctl TESTS_C+= t_pty TESTS_C+= t_rnd TESTS_C+= t_extattrctl Index: src/tests/lib/libc/sys/Makefile diff -u src/tests/lib/libc/sys/Makefile:1.20 src/tests/lib/libc/sys/Makefile:1.21 --- src/tests/lib/libc/sys/Makefile:1.20 Thu Nov 17 01:14:12 2011 +++ src/tests/lib/libc/sys/Makefile Sat Mar 17 17:23:34 2012 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.20 2011/11/17 01:14:12 christos Exp $ +# $NetBSD: Makefile,v 1.21 2012/03/17 17:23:34 jruoho Exp $ MKMAN= no @@ -28,6 +28,7 @@ TESTS_C+= t_kevent TESTS_C+= t_kill TESTS_C+= t_link TESTS_C+= t_listen +TESTS_C+= t_lwp_ctl TESTS_C+= t_mincore TESTS_C+= t_mkdir TESTS_C+= t_mkfifo Added files: Index: src/tests/lib/libc/sys/t_lwp_ctl.c diff -u /dev/null src/tests/lib/libc/sys/t_lwp_ctl.c:1.1 --- /dev/null Sat Mar 17 17:23:34 2012 +++ src/tests/lib/libc/sys/t_lwp_ctl.c Sat Mar 17 17:23:34 2012 @@ -0,0 +1,75 @@ +/* $NetBSD: t_lwp_ctl.c,v 1.1 2012/03/17 17:23:34 jruoho Exp $ */ + +/*- + * Copyright (c) 2008 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sys/cdefs.h> +__COPYRIGHT("@(#) Copyright (c) 2008\ + The NetBSD Foundation, inc. All rights reserved."); +__RCSID("$NetBSD: t_lwp_ctl.c,v 1.1 2012/03/17 17:23:34 jruoho Exp $"); + +#include <sys/lwpctl.h> + +#include <lwp.h> +#include <stdio.h> +#include <time.h> + +#include <atf-c.h> + +#include "../../../h_macros.h" + +ATF_TC(lwpctl_counter); +ATF_TC_HEAD(lwpctl_counter, tc) +{ + atf_tc_set_md_var(tc, "descr", "Checks lwpctl preemption counter"); +} + +ATF_TC_BODY(lwpctl_counter, tc) +{ + lwpctl_t *lc; + struct timespec ts; + int ctr1, ctr2; + + RL(_lwp_ctl(LWPCTL_FEATURE_PCTR, &lc)); + + /* Ensure that preemption is reported. */ + ctr1 = lc->lc_pctr; + (void)printf("pctr = %d\n", ctr1); + ts.tv_nsec = 10*1000000; + ts.tv_sec = 0; + RL(nanosleep(&ts, 0)); + ctr2 = lc->lc_pctr; + (void)printf("pctr = %d\n", ctr2); + + ATF_REQUIRE_MSG(ctr1 != ctr2, "counters match"); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, lwpctl_counter); + + return atf_no_error(); +}