Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/regress/sys/kern/extent first cut on a testsuite for sys/ker...
details: https://anonhg.NetBSD.org/src/rev/e39c5da78c25
branches: trunk
changeset: 472890:e39c5da78c25
user: drochner <drochner%NetBSD.org@localhost>
date: Tue May 11 19:14:50 1999 +0000
description:
first cut on a testsuite for sys/kern/subr_extent.c
diffstat:
regress/sys/kern/extent/Makefile | 20 ++++++++++++++
regress/sys/kern/extent/extest.awk | 54 ++++++++++++++++++++++++++++++++++++++
regress/sys/kern/extent/extest.exp | 18 ++++++++++++
regress/sys/kern/extent/tests | 23 ++++++++++++++++
4 files changed, 115 insertions(+), 0 deletions(-)
diffs (131 lines):
diff -r 3e83760bc725 -r e39c5da78c25 regress/sys/kern/extent/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/sys/kern/extent/Makefile Tue May 11 19:14:50 1999 +0000
@@ -0,0 +1,20 @@
+# $NetBSD: Makefile,v 1.1 1999/05/11 19:14:50 drochner Exp $
+
+PROG= extest
+NOMAN=
+
+.PATH: $(.CURDIR)/../../../../sys/kern
+SRCS= extest.c subr_extent.c
+
+CPPFLAGS+= -D_EXTENT_TESTING -D__POOL_EXPOSE
+
+regress: $(PROG)
+ $(.OBJDIR)/$(PROG) >extest.out
+ tail +4 $(.CURDIR)/extest.exp | diff - extest.out
+
+extest.c: extest.awk tests
+ awk -f $(.CURDIR)/extest.awk <$(.CURDIR)/tests >extest.c
+
+CLEANFILES+= extest.c extest.out
+
+.include <bsd.prog.mk>
diff -r 3e83760bc725 -r e39c5da78c25 regress/sys/kern/extent/extest.awk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/sys/kern/extent/extest.awk Tue May 11 19:14:50 1999 +0000
@@ -0,0 +1,54 @@
+# $NetBSD: extest.awk,v 1.1 1999/05/11 19:14:50 drochner Exp $
+
+BEGIN {
+ first = 1;
+
+ printf("#include <stdio.h>\n")
+ printf("#include <sys/extent.h>\n\n")
+ printf("main() {\n")
+ printf("struct extent *ex; int error; long result;\n")
+}
+
+END {
+ printf("exit (0);\n")
+ printf("}\n")
+}
+
+$1 == "extent" {
+ if (first == 0) {
+ printf("extent_destroy(ex);\n")
+ }
+
+ align = "EX_NOALIGN";
+ boundary = "EX_NOBOUNDARY";
+
+ printf("printf(\"output for %s\\n\");\n", $2)
+
+ if ($5 == "") {
+ flags = "0";
+ } else {
+ flags = $5;
+ }
+ printf("ex = extent_create(\"%s\", %s, %s, 0, 0, 0, %s);\n",
+ $2, $3, $4, flags)
+
+ first = 0;
+}
+
+$1 == "alloc_region" {
+ printf("error = extent_alloc_region(ex, %s, %s, 0);\n",
+ $2, $3)
+ printf("if (error)\n\tprintf(\"error: %%s\\n\", strerror(error));\n")
+}
+
+$1 == "alloc_subregion" {
+ printf("error = extent_alloc_subregion1(ex, %s, %s, %s,\n",
+ $2, $3, $4)
+ printf("\t%s, 0, %s, 0, &result);\n", align, boundary)
+ printf("if (error)\n\tprintf(\"error: %%s\\n\", strerror(error));\n")
+ printf("else\n\tprintf(\"result: 0x%%x\\n\", result);\n")
+}
+
+$1 == "print" {
+ printf("extent_print(ex);\n")
+}
diff -r 3e83760bc725 -r e39c5da78c25 regress/sys/kern/extent/extest.exp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/sys/kern/extent/extest.exp Tue May 11 19:14:50 1999 +0000
@@ -0,0 +1,18 @@
+# $NetBSD: extest.exp,v 1.1 1999/05/11 19:14:50 drochner Exp $
+# real output must start in line 4
+
+output for test1
+result: 0x30
+extent `test1' (0x0 - 0x4f), flags = 0x0
+ 0x0 - 0x4f
+output for test2
+result: 0x20
+extent `test2' (0x0 - 0x2f), flags = 0x2
+ 0x0 - 0xf
+ 0x20 - 0x2f
+output for test3
+result: 0x20
+extent `test3' (0x0 - 0x3f), flags = 0x2
+ 0x0 - 0x1f
+ 0x20 - 0x2f
+ 0x30 - 0x3f
diff -r 3e83760bc725 -r e39c5da78c25 regress/sys/kern/extent/tests
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/sys/kern/extent/tests Tue May 11 19:14:50 1999 +0000
@@ -0,0 +1,23 @@
+# $NetBSD: tests,v 1.1 1999/05/11 19:14:50 drochner Exp $
+
+#fill up an extent, should coalesce into one allocation
+extent test1 0 0x4f
+alloc_region 0x00 0x10
+alloc_region 0x20 0x10
+alloc_region 0x40 0x10
+alloc_region 0x10 0x10
+alloc_subregion 0 0x4f 0x10
+print
+
+#check whether subregion is obeyed (PR kern/7539)
+extent test2 0 0x2f EX_NOCOALESCE
+alloc_region 0x00 0x10
+alloc_subregion 0x20 0x30 0x10
+print
+
+#check overlap into subregion (fixed in 1.25)
+extent test3 0 0x3f EX_NOCOALESCE
+alloc_region 0x00 0x20
+alloc_region 0x30 0x10
+alloc_subregion 0x10 0x3f 0x10
+print
Home |
Main Index |
Thread Index |
Old Index