Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Move the bitmap(3) test to the "right" place. Note it in bit...
details: https://anonhg.NetBSD.org/src/rev/f9a1590de20d
branches: trunk
changeset: 783079:f9a1590de20d
user: jruoho <jruoho%NetBSD.org@localhost>
date: Tue Dec 04 06:57:44 2012 +0000
description:
Move the bitmap(3) test to the "right" place. Note it in bitops(3). Xrefs.
diffstat:
distrib/sets/lists/tests/mi | 6 +-
share/man/man3/bitmap.3 | 5 +-
share/man/man3/bitops.3 | 8 ++-
share/man/man3/bitstring.3 | 5 +-
tests/include/sys/t_bitops.c | 44 ++++++++++++++++++++++--
tests/lib/libc/sys/Makefile | 3 +-
tests/lib/libc/sys/t_bitops.c | 78 -------------------------------------------
7 files changed, 55 insertions(+), 94 deletions(-)
diffs (288 lines):
diff -r 221e6659d83f -r f9a1590de20d distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Tue Dec 04 05:50:57 2012 +0000
+++ b/distrib/sets/lists/tests/mi Tue Dec 04 06:57:44 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.511 2012/12/01 16:30:00 christos Exp $
+# $NetBSD: mi,v 1.512 2012/12/04 06:57:44 jruoho Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -548,7 +548,7 @@
./usr/libdata/debug/usr/tests/lib/libc/string/t_swab.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libc/sys tests-lib-debug
./usr/libdata/debug/usr/tests/lib/libc/sys/t_access.debug tests-lib-debug debug,atf
-./usr/libdata/debug/usr/tests/lib/libc/sys/t_bitops.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/sys/t_bitops.debug tests-obsolete obsolete
./usr/libdata/debug/usr/tests/lib/libc/sys/t_cerror.debug tests-obsolete obsolete
./usr/libdata/debug/usr/tests/lib/libc/sys/t_chroot.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libc/sys/t_clock_gettime.debug tests-lib-debug debug,atf
@@ -2491,7 +2491,7 @@
./usr/tests/lib/libc/sys tests-lib-tests
./usr/tests/lib/libc/sys/Atffile tests-lib-tests atf
./usr/tests/lib/libc/sys/t_access tests-lib-tests atf
-./usr/tests/lib/libc/sys/t_bitops tests-lib-tests atf
+./usr/tests/lib/libc/sys/t_bitops tests-obsolete obsolete
./usr/tests/lib/libc/sys/t_cerror tests-obsolete obsolete
./usr/tests/lib/libc/sys/t_chroot tests-lib-tests atf
./usr/tests/lib/libc/sys/t_clock_gettime tests-lib-tests atf
diff -r 221e6659d83f -r f9a1590de20d share/man/man3/bitmap.3
--- a/share/man/man3/bitmap.3 Tue Dec 04 05:50:57 2012 +0000
+++ b/share/man/man3/bitmap.3 Tue Dec 04 06:57:44 2012 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: bitmap.3,v 1.3 2012/12/01 21:21:44 wiz Exp $
+.\" $NetBSD: bitmap.3,v 1.4 2012/12/04 06:57:45 jruoho Exp $
.\"
.\" Copyright (c) 2012 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd December 1, 2012
+.Dd December 4, 2012
.Dt BITMAP 3
.Os
.Sh NAME
@@ -125,6 +125,7 @@
.Ed
.Sh SEE ALSO
.Xr select 2 ,
+.Xr bitops 3 ,
.Xr bitstring 3
.Sh HISTORY
The
diff -r 221e6659d83f -r f9a1590de20d share/man/man3/bitops.3
--- a/share/man/man3/bitops.3 Tue Dec 04 05:50:57 2012 +0000
+++ b/share/man/man3/bitops.3 Tue Dec 04 06:57:44 2012 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: bitops.3,v 1.3 2011/04/08 08:46:12 jruoho Exp $
+.\" $NetBSD: bitops.3,v 1.4 2012/12/04 06:57:45 jruoho Exp $
.\"
.\" Copyright (c) 2011 Jukka Ruohonen <jruohonen%iki.fi@localhost>
.\" All rights reserved.
@@ -24,7 +24,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd April 8, 2011
+.Dd December 4, 2012
.Dt BITOPS 3
.Os
.Sh NAME
@@ -35,11 +35,13 @@
.Sh DESCRIPTION
The
.In sys/bitops.h
-header includes some
+header includes macros and
.Em static inline
functions related bits and integers.
Among these are:
.Bl -tag -width "fast_divide32(3) " -offset indent
+.It Xr bitmap 3
+bitmap manipulation macros
.It Xr ffs32 3
functions to find the first and last bit in integers of type
.Vt uint32_t
diff -r 221e6659d83f -r f9a1590de20d share/man/man3/bitstring.3
--- a/share/man/man3/bitstring.3 Tue Dec 04 05:50:57 2012 +0000
+++ b/share/man/man3/bitstring.3 Tue Dec 04 06:57:44 2012 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: bitstring.3,v 1.13 2005/03/08 10:53:34 wiz Exp $
+.\" $NetBSD: bitstring.3,v 1.14 2012/12/04 06:57:45 jruoho Exp $
.\"
.\" Copyright (c) 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -31,7 +31,7 @@
.\"
.\" @(#)bitstring.3 8.1 (Berkeley) 7/19/93
.\"
-.Dd July 19, 1993
+.Dd December 4, 2012
.Dt BITSTRING 3
.Os
.Sh NAME
@@ -171,6 +171,7 @@
}
.Ed
.Sh SEE ALSO
+.Xr bitmap 3 ,
.Xr malloc 3
.Sh HISTORY
The
diff -r 221e6659d83f -r f9a1590de20d tests/include/sys/t_bitops.c
--- a/tests/include/sys/t_bitops.c Tue Dec 04 05:50:57 2012 +0000
+++ b/tests/include/sys/t_bitops.c Tue Dec 04 06:57:44 2012 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: t_bitops.c,v 1.14 2011/10/31 18:37:01 pgoyette Exp $ */
+/* $NetBSD: t_bitops.c,v 1.15 2012/12/04 06:57:44 jruoho Exp $ */
/*-
- * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * Copyright (c) 2011, 2012 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
- * by Jukka Ruohonen.
+ * by Christos Zoulas and Jukka Ruohonen.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_bitops.c,v 1.14 2011/10/31 18:37:01 pgoyette Exp $");
+__RCSID("$NetBSD: t_bitops.c,v 1.15 2012/12/04 06:57:44 jruoho Exp $");
#include <atf-c.h>
@@ -64,6 +64,41 @@
};
+ATF_TC(bitmap_basic);
+ATF_TC_HEAD(bitmap_basic, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "A basic test of __BITMAP_*");
+}
+
+ATF_TC_BODY(bitmap_basic, tc)
+{
+ uint32_t bm[__BITMAP_SIZE(uint32_t, 65536)];
+ __BITMAP_ZERO(bm);
+
+ ATF_REQUIRE(__BITMAP_SIZE(uint32_t, 65536) == 2048);
+
+ ATF_REQUIRE(__BITMAP_SHIFT(uint32_t) == 5);
+
+ ATF_REQUIRE(__BITMAP_MASK(uint32_t) == 31);
+
+ for (size_t i = 0; i < 65536; i += 2)
+ __BITMAP_SET(i, bm);
+
+ for (size_t i = 0; i < 2048; i++)
+ ATF_REQUIRE(bm[i] == 0x55555555);
+
+ for (size_t i = 0; i < 65536; i++)
+ if (i & 1)
+ ATF_REQUIRE(!__BITMAP_ISSET(i, bm));
+ else {
+ ATF_REQUIRE(__BITMAP_ISSET(i, bm));
+ __BITMAP_CLR(i, bm);
+ }
+
+ for (size_t i = 0; i < 65536; i += 2)
+ ATF_REQUIRE(!__BITMAP_ISSET(i, bm));
+}
+
ATF_TC(fast_divide32);
ATF_TC_HEAD(fast_divide32, tc)
{
@@ -193,6 +228,7 @@
ATF_TP_ADD_TCS(tp)
{
+ ATF_TP_ADD_TC(tp, bitmap_basic);
ATF_TP_ADD_TC(tp, fast_divide32);
ATF_TP_ADD_TC(tp, ffsfls);
ATF_TP_ADD_TC(tp, ilog2_basic);
diff -r 221e6659d83f -r f9a1590de20d tests/lib/libc/sys/Makefile
--- a/tests/lib/libc/sys/Makefile Tue Dec 04 05:50:57 2012 +0000
+++ b/tests/lib/libc/sys/Makefile Tue Dec 04 06:57:44 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.29 2012/12/01 16:27:27 christos Exp $
+# $NetBSD: Makefile,v 1.30 2012/12/04 06:57:44 jruoho Exp $
MKMAN= no
@@ -9,7 +9,6 @@
TESTSDIR= ${TESTSBASE}/lib/libc/sys
TESTS_C+= t_access
-TESTS_C+= t_bitops
TESTS_C+= t_chroot
TESTS_C+= t_clock_gettime
TESTS_C+= t_clone
diff -r 221e6659d83f -r f9a1590de20d tests/lib/libc/sys/t_bitops.c
--- a/tests/lib/libc/sys/t_bitops.c Tue Dec 04 05:50:57 2012 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/* $NetBSD: t_bitops.c,v 1.1 2012/12/01 16:27:27 christos Exp $ */
-
-/*-
- * Copyright (c) 2012 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas.
- *
- * 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>
-__RCSID("$NetBSD: t_bitops.c,v 1.1 2012/12/01 16:27:27 christos Exp $");
-
-#include <stdlib.h>
-#include <sys/bitops.h>
-#include <atf-c.h>
-
-ATF_TC(bitmap_basic);
-
-ATF_TC_HEAD(bitmap_basic, tc)
-{
- atf_tc_set_md_var(tc, "descr", "A basic test of __BITMAP_*");
-}
-
-ATF_TC_BODY(bitmap_basic, tc)
-{
- uint32_t bm[__BITMAP_SIZE(uint32_t, 65536)];
- __BITMAP_ZERO(bm);
-
- ATF_REQUIRE(__BITMAP_SIZE(uint32_t, 65536) == 2048);
-
- ATF_REQUIRE(__BITMAP_SHIFT(uint32_t) == 5);
-
- ATF_REQUIRE(__BITMAP_MASK(uint32_t) == 31);
-
- for (size_t i = 0; i < 65536; i += 2)
- __BITMAP_SET(i, bm);
-
- for (size_t i = 0; i < 2048; i++)
- ATF_REQUIRE(bm[i] == 0x55555555);
-
- for (size_t i = 0; i < 65536; i++)
- if (i & 1)
- ATF_REQUIRE(!__BITMAP_ISSET(i, bm));
- else {
- ATF_REQUIRE(__BITMAP_ISSET(i, bm));
- __BITMAP_CLR(i, bm);
- }
-
- for (size_t i = 0; i < 65536; i += 2)
- ATF_REQUIRE(!__BITMAP_ISSET(i, bm));
-}
-
-ATF_TP_ADD_TCS(tp)
-{
- ATF_TP_ADD_TC(tp, bitmap_basic);
- return atf_no_error();
-}
Home |
Main Index |
Thread Index |
Old Index