/** * Equivalent to rtTestSubCleanup + rtTestSubTestReport. */ BS3_DECL(void) bs3TestSubCleanup(void) { if (g_szBs3SubTest[0] != '\0') { if (!g_fbBs3SubTestReported) { size_t cch; uint16_t cErrors = g_cusBs3TestErrors - g_cusBs3SubTestAtErrors; /* Tell VMMDev. */ bs3TestSendCmdWithU32(VMMDEV_TESTING_CMD_SUB_DONE, cErrors); /* Print result to the console. */ Bs3PrintStr(g_szBs3SubTest); Bs3PrintChr(':'); cch = Bs3StrLen(g_szBs3SubTest); do Bs3PrintChr(' '); while (cch++ < 49); if (!cErrors) Bs3PrintStr(!g_fbBs3SubTestSkipped ? "PASSED\n" : "SKIPPED\n"); else { g_cusBs3SubTestsFailed++; Bs3Printf("FAILED (%u errors)\n", g_szBs3SubTest, cErrors); } } /* Reset the sub-test. */ g_fbBs3SubTestReported = true; g_fbBs3SubTestSkipped = false; g_szBs3SubTest[0] = '\0'; } }
/* Just a sample. */ BS3_DECL(void) Main_pe16(void) { void BS3_FAR *pvTmp1; void BS3_FAR *pvTmp2; void BS3_FAR *pvTmp3; void BS3_FAR *pvTmp4; Bs3TestInit("bs3-shutdown"); Bs3PrintStr("Bs3PrintX32:"); Bs3PrintX32(UINT32_C(0xfdb97531)); Bs3PrintStr("\r\n"); Bs3Printf("Bs3Printf: RX32=%#'RX32 string='%s' d=%d p=%p\n", UINT32_C(0xfdb97531), "my string", 42, Main_pe16); pvTmp2 = Bs3MemAlloc(BS3MEMKIND_REAL, _4K); Bs3PrintStr("pvTmp2="); Bs3PrintX32((uintptr_t)pvTmp2); Bs3PrintStr("\r\n"); pvTmp3 = Bs3MemAlloc(BS3MEMKIND_REAL, _4K); Bs3PrintStr("pvTmp3="); Bs3PrintX32((uintptr_t)pvTmp3); Bs3PrintStr("\r\n"); Bs3MemFree(pvTmp2, _4K); pvTmp4 = Bs3MemAlloc(BS3MEMKIND_REAL, _4K); Bs3PrintStr("pvTmp4="); Bs3PrintX32((uintptr_t)pvTmp4); Bs3PrintStr("\r\n"); Bs3PrintStr("\r\n"); pvTmp1 = Bs3MemAlloc(BS3MEMKIND_REAL, 31); Bs3PrintStr("pvTmp1="); Bs3PrintX32((uintptr_t)pvTmp1); Bs3PrintStr("\r\n"); pvTmp2 = Bs3MemAlloc(BS3MEMKIND_REAL, 17); Bs3PrintStr("pvTmp2="); Bs3PrintX32((uintptr_t)pvTmp2); Bs3PrintStr("\r\n"); Bs3MemFree(pvTmp1, 31); pvTmp3 = Bs3MemAlloc(BS3MEMKIND_REAL, 17); Bs3PrintStr("pvTmp3="); Bs3PrintX32((uintptr_t)pvTmp3); Bs3PrintStr("\r\n"); Bs3Panic(); Bs3Shutdown(); return; }