/**
 * 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';
    }
}
예제 #2
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;
}
예제 #3
0
/**
 * Warns about CPU modes that must be skipped.
 *
 * It will try not warn about modes for which there are no tests.
 *
 * @param   paEntries       The mode test entries.
 * @param   cEntries        The number of tests.
 * @param   bCpuType        The CPU type byte (see #BS3CPU_TYPE_MASK).
 * @param   fHavePae        Whether the CPU has PAE.
 * @param   fHaveLongMode   Whether the CPU does long mode.
 */
static void bs3TestWarnAboutSkippedModes(PCBS3TESTMODEENTRY paEntries, unsigned cEntries,
        uint8_t bCpuType, bool fHavePae, bool fHaveLongMode)
{
    bool           fComplained286   = false;
    bool           fComplained386   = false;
    bool           fComplainedPAE   = false;
    bool           fComplainedAMD64 = false;
    unsigned       i;

    /*
     * Complaint run.
     */
    for (i = 0; i < cEntries; i++)
    {
        if (   !fComplained286
                &&  paEntries[i].pfnDoPE16)
        {
            if (bCpuType < BS3CPU_80286)
            {
                Bs3Printf("Only executing real-mode tests as no 80286+ CPU was detected.\n");
                break;
            }
            fComplained286 = true;
        }

        if (   !fComplained386
                &&  (   paEntries[i].pfnDoPE16_32
                        || paEntries[i].pfnDoPE16_V86
                        || paEntries[i].pfnDoPE32
                        || paEntries[i].pfnDoPE32_16
                        || paEntries[i].pfnDoPEV86
                        || paEntries[i].pfnDoPP16
                        || paEntries[i].pfnDoPP16_32
                        || paEntries[i].pfnDoPP16_V86
                        || paEntries[i].pfnDoPP32
                        || paEntries[i].pfnDoPP32_16
                        || paEntries[i].pfnDoPPV86) )
        {
            if (bCpuType < BS3CPU_80386)
            {
                Bs3Printf("80286 CPU: Only executing 16-bit protected and real mode tests.\n");
                break;
            }
            fComplained386 = true;
        }

        if (   !fComplainedPAE
                &&  (   paEntries[i].pfnDoPAE16
                        || paEntries[i].pfnDoPAE16_32
                        || paEntries[i].pfnDoPAE16_V86
                        || paEntries[i].pfnDoPAE32
                        || paEntries[i].pfnDoPAE32_16
                        || paEntries[i].pfnDoPAEV86) )
        {
            if (!fHavePae)
            {
                Bs3Printf("PAE and long mode tests will be skipped.\n");
                break;
            }
            fComplainedPAE = true;
        }

        if (   !fComplainedAMD64
                &&  (   paEntries[i].pfnDoLM16
                        || paEntries[i].pfnDoLM32
                        || paEntries[i].pfnDoLM64) )
        {
            if (!fHaveLongMode)
            {
                Bs3Printf("Long mode tests will be skipped.\n");
                break;
            }
            fComplainedAMD64 = true;
        }
    }
}