count = 0;
drm_mm_for_each_hole(hole, mm, hole_start, hole_end)
count++; if (count) {
KUNIT_FAIL(test, "Expected to find no holes (after reserve), found %lu instead\n", count); returnfalse;
}
count = 0;
drm_mm_for_each_hole(hole, mm, hole_start, hole_end) { if (start != hole_start || end != hole_end) { if (ok)
KUNIT_FAIL(test, "empty mm has incorrect hole, found (%llx, %llx), expect (%llx, %llx)\n",
hole_start, hole_end, start, end);
ok = false;
}
count++;
} if (count != 1) {
KUNIT_FAIL(test, "Expected to find one hole, found %lu instead\n", count);
ok = false;
}
/* Start with some simple checks on initialising the struct drm_mm */
memset(&mm, 0, sizeof(mm));
KUNIT_ASSERT_FALSE_MSG(test, drm_mm_initialized(&mm), "zeroed mm claims to be initialized\n");
memset(&mm, 0xff, sizeof(mm));
drm_mm_init(&mm, 0, size); if (!drm_mm_initialized(&mm)) {
KUNIT_FAIL(test, "mm claims not to be initialized\n"); goto out;
}
if (!drm_mm_clean(&mm)) {
KUNIT_FAIL(test, "mm not empty on creation\n"); goto out;
}
/* After creation, it should all be one massive hole */ if (!assert_one_hole(test, &mm, 0, size)) {
KUNIT_FAIL(test, "mm not one hole on creation"); goto out;
}
/* After filling the range entirely, there should be no holes */ if (!assert_no_holes(test, &mm)) {
KUNIT_FAIL(test, "mm has holes when filled"); goto out;
}
/* And then after emptying it again, the massive hole should be back */
drm_mm_remove_node(&tmp); if (!assert_one_hole(test, &mm, 0, size)) {
KUNIT_FAIL(test, "mm does not have single hole after emptying"); goto out;
}
/* Create a small drm_mm with a couple of nodes and a few holes, and * check that the debug iterator doesn't explode over a trivial drm_mm.
*/
drm_mm_init(&mm, 0, 4096);
if (!drm_mm_hole_follows(&rsvd_lo) || !drm_mm_hole_follows(&rsvd_hi)) {
KUNIT_FAIL(test, "Expected a hole after lo and high nodes!\n"); goto err_hi;
}
memset(&node, 0, sizeof(node)); if (drm_mm_insert_node_generic(&mm, &node, 2, 0, 0, mode)) {
KUNIT_FAIL(test, "Could not insert the node into the available hole!\n"); goto err_hi;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.