Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Move the _lwp_ctl(2) preemption counter check to the right p...



details:   https://anonhg.NetBSD.org/src/rev/0c10a4640d2b
branches:  trunk
changeset: 778128:0c10a4640d2b
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sat Mar 17 17:23:34 2012 +0000

description:
Move the _lwp_ctl(2) preemption counter check to the right place.

diffstat:

 distrib/sets/lists/tests/mi    |   8 ++-
 tests/kernel/Makefile          |   3 +-
 tests/kernel/t_lwpctl.c        |  74 -----------------------------------------
 tests/lib/libc/sys/Makefile    |   3 +-
 tests/lib/libc/sys/t_lwp_ctl.c |  75 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 83 insertions(+), 80 deletions(-)

diffs (234 lines):

diff -r 3b3a146de590 -r 0c10a4640d2b distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Sat Mar 17 17:16:41 2012 +0000
+++ b/distrib/sets/lists/tests/mi       Sat Mar 17 17:23:34 2012 +0000
@@ -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
diff -r 3b3a146de590 -r 0c10a4640d2b tests/kernel/Makefile
--- a/tests/kernel/Makefile     Sat Mar 17 17:16:41 2012 +0000
+++ b/tests/kernel/Makefile     Sat Mar 17 17:23:34 2012 +0000
@@ -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 @@
 TESTS_SUBDIRS= kqueue tty
 
 TESTS_C=       t_lock
-TESTS_C+=      t_lwpctl
 TESTS_C+=      t_pty
 TESTS_C+=      t_rnd
 TESTS_C+=      t_extattrctl
diff -r 3b3a146de590 -r 0c10a4640d2b tests/kernel/t_lwpctl.c
--- a/tests/kernel/t_lwpctl.c   Sat Mar 17 17:16:41 2012 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/* $NetBSD: t_lwpctl.c,v 1.1 2009/02/20 21:39:57 jmmv 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_lwpctl.c,v 1.1 2009/02/20 21:39:57 jmmv 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);
-ATF_TC_HEAD(lwpctl, tc)
-{
-       atf_tc_set_md_var(tc, "descr", "Checks lwpctl preemption counter");
-}
-ATF_TC_BODY(lwpctl, 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);
-
-       return atf_no_error();
-}
diff -r 3b3a146de590 -r 0c10a4640d2b tests/lib/libc/sys/Makefile
--- a/tests/lib/libc/sys/Makefile       Sat Mar 17 17:16:41 2012 +0000
+++ b/tests/lib/libc/sys/Makefile       Sat Mar 17 17:23:34 2012 +0000
@@ -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_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
diff -r 3b3a146de590 -r 0c10a4640d2b tests/lib/libc/sys/t_lwp_ctl.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libc/sys/t_lwp_ctl.c    Sat Mar 17 17:23:34 2012 +0000
@@ -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();
+}



Home | Main Index | Thread Index | Old Index