diff --git a/tests/test.c b/tests/test.c index 8bd13e9..6ebb120 100644 --- a/tests/test.c +++ b/tests/test.c @@ -33,7 +33,8 @@ void testPhymem(void) } printf("%d pages freed\n", freeCount); - assertmsg((page = (struct mem_desc *)allocPhyPage()) != NULL, "Cannot allocate memory\n"); + assertmsg((page = (struct mem_desc *)allocPhyPage()) != NULL, + "Cannot allocate memory\n"); unrefPhyPage((ulong)page); } @@ -68,15 +69,16 @@ static void testPaging(void) while ((page = (struct mem_desc *)allocPhyPage()) != NULL) { assertmsg(pageMap((vaddr_t)page, (paddr_t)page, PAGING_MEM_WRITE) == 0, - "Fail to map page %d\n", allocCount); - page->phy_addr = allocCount; + "Fail to map page %d\n", allocCount); + memset(page, allocCount, PAGE_SIZE); allocCount++; list_add_tail(allocated_page_list, page); } printf("%d pages allocated\n", allocCount); while ((page = list_pop_head(allocated_page_list)) != NULL) { - assertmsg(page->phy_addr == (ulong)freeCount, "page modified"); + assertmsg((char)page->phy_addr == (char)freeCount, + "page modified %d but is %d\n", freeCount, page->phy_addr); assertmsg(unrefPhyPage((ulong)page) >= 0, "Failed to free page %d\n", (ulong)page); pageUnmap((vaddr_t)page); @@ -84,7 +86,8 @@ static void testPaging(void) } printf("%d pages freed\n", freeCount); - assertmsg((page = (struct mem_desc *)allocPhyPage()) != NULL, "Cannot allocate memory\n"); + assertmsg((page = (struct mem_desc *)allocPhyPage()) != NULL, + "Cannot allocate memory\n"); unrefPhyPage((ulong)page); }