PERFORCE change 190854 for review
John Baldwin
jhb at FreeBSD.org
Fri Apr 1 16:33:15 UTC 2011
http://p4web.freebsd.org/@@190854?ac=10
Change 190854 by jhb at jhb_jhbbsd on 2011/04/01 01:02:49
More WIP on region regression tests.
Affected files ...
.. //depot/projects/pci/sys/modules/rman/rman.c#6 edit
Differences ...
==== //depot/projects/pci/sys/modules/rman/rman.c#6 (text+ko) ====
@@ -295,6 +295,47 @@
assert_rman_ok();
}
+struct region {
+ u_long start;
+ u_long end;
+};
+
+static void
+assert_rman_regions(struct region *regions, int count)
+{
+ struct resource_i *i;
+ struct region *r;
+ u_long start;
+
+ i = TAILQ_FIRST(&test.rm_list);
+ if (count == 0) {
+ KASSERT(i == NULL, ("non-empty rman"));
+ return;
+ }
+
+ KASSERT(i != NULL, ("empty rman"));
+ r = regions;
+ start = r->start;
+ while (i != NULL) {
+ KASSERT(count != 0, ("resource beyond last region"));
+ KASSERT(i->r_start >= REGION_START && i->r_end <= REGION_END,
+ ("bad resource range"));
+ KASSERT(i->r_start == start, ("missing start of region"));
+ KASSERT(i->r_end <= r->end, ("resource overflows region"));
+
+ if (i->r_end == r->end) {
+ /* Next region. */
+ count--;
+ r++;
+ start = r->r_start;
+ } else
+ start = i->r_end + 1;
+ i = TAILQ_NEXT(i, r_link);
+ }
+
+ KASSERT(count == 0, ("resources did not cover all regions"));
+}
+
static void
region_regression_tests(void)
{
More information about the p4-projects
mailing list