Module Name: src
Committed By: jruoho
Date: Tue Dec 4 06:57:45 UTC 2012
Modified Files:
src/distrib/sets/lists/tests: mi
src/share/man/man3: bitmap.3 bitops.3 bitstring.3
src/tests/include/sys: t_bitops.c
src/tests/lib/libc/sys: Makefile
Removed Files:
src/tests/lib/libc/sys: t_bitops.c
Log Message:
Move the bitmap(3) test to the "right" place. Note it in bitops(3). Xrefs.
To generate a diff of this commit:
cvs rdiff -u -r1.511 -r1.512 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.3 -r1.4 src/share/man/man3/bitmap.3 \
src/share/man/man3/bitops.3
cvs rdiff -u -r1.13 -r1.14 src/share/man/man3/bitstring.3
cvs rdiff -u -r1.14 -r1.15 src/tests/include/sys/t_bitops.c
cvs rdiff -u -r1.29 -r1.30 src/tests/lib/libc/sys/Makefile
cvs rdiff -u -r1.1 -r0 src/tests/lib/libc/sys/t_bitops.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.511 src/distrib/sets/lists/tests/mi:1.512
--- src/distrib/sets/lists/tests/mi:1.511 Sat Dec 1 16:30:00 2012
+++ src/distrib/sets/lists/tests/mi Tue Dec 4 06:57:44 2012
@@ -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
Index: src/share/man/man3/bitmap.3
diff -u src/share/man/man3/bitmap.3:1.3 src/share/man/man3/bitmap.3:1.4
--- src/share/man/man3/bitmap.3:1.3 Sat Dec 1 21:21:44 2012
+++ src/share/man/man3/bitmap.3 Tue Dec 4 06:57:45 2012
@@ -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 @@ main(int argc, char **argv)
.Ed
.Sh SEE ALSO
.Xr select 2 ,
+.Xr bitops 3 ,
.Xr bitstring 3
.Sh HISTORY
The
Index: src/share/man/man3/bitops.3
diff -u src/share/man/man3/bitops.3:1.3 src/share/man/man3/bitops.3:1.4
--- src/share/man/man3/bitops.3:1.3 Fri Apr 8 08:46:12 2011
+++ src/share/man/man3/bitops.3 Tue Dec 4 06:57:45 2012
@@ -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 <[email protected]>
.\" 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
Index: src/share/man/man3/bitstring.3
diff -u src/share/man/man3/bitstring.3:1.13 src/share/man/man3/bitstring.3:1.14
--- src/share/man/man3/bitstring.3:1.13 Tue Mar 8 10:53:34 2005
+++ src/share/man/man3/bitstring.3 Tue Dec 4 06:57:45 2012
@@ -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 @@ make_lpr_available()
}
.Ed
.Sh SEE ALSO
+.Xr bitmap 3 ,
.Xr malloc 3
.Sh HISTORY
The
Index: src/tests/include/sys/t_bitops.c
diff -u src/tests/include/sys/t_bitops.c:1.14 src/tests/include/sys/t_bitops.c:1.15
--- src/tests/include/sys/t_bitops.c:1.14 Mon Oct 31 18:37:01 2011
+++ src/tests/include/sys/t_bitops.c Tue Dec 4 06:57:44 2012
@@ -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 @@ static const struct {
};
+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_TC_BODY(ilog2_log2, tc)
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);
Index: src/tests/lib/libc/sys/Makefile
diff -u src/tests/lib/libc/sys/Makefile:1.29 src/tests/lib/libc/sys/Makefile:1.30
--- src/tests/lib/libc/sys/Makefile:1.29 Sat Dec 1 16:27:27 2012
+++ src/tests/lib/libc/sys/Makefile Tue Dec 4 06:57:44 2012
@@ -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 @@ MKMAN= no
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