int main(int argc, char **argv)
{
    RTEXITCODE rcExit = RTTestInitAndCreate("tstNtQueryStuff", &g_hTest);
    if (rcExit != RTEXITCODE_SUCCESS)
        return rcExit;
    RTTestBanner(g_hTest);

    g_hProcess = GetCurrentProcess();
    if (argc >= 2 && argv[1][0] != '-')
    {
        const char *pszPid = argv[1];
        uint32_t idPid = RTStrToInt32(pszPid);

        uint32_t fAccess = PROCESS_QUERY_INFORMATION;
        if (argc >= 3)
            fAccess = RTStrToInt32(argv[2]);

        g_hProcess = OpenProcess(fAccess, FALSE, idPid);
        if (g_hProcess == NULL)
        {
            RTTestIFailed("Error %u opening process %u (%s)\n", GetLastError(), idPid, pszPid);
            return RTTestSummaryAndDestroy(g_hTest);
        }
    }

    tstQueryVirtualMemory();
    tstQueryInformationProcess();

    return RTTestSummaryAndDestroy(g_hTest);
}
Exemplo n.º 2
0
static RTEXITCODE mainChild(int argc, char **argv)
{
    if (argc < 3) /* Safety first. */
        return RTEXITCODE_FAILURE;
    /* Note: We assume argv[2] always contains the actual test type to perform. */
    RTTEST hTest;
    RTEXITCODE rcExit = RTTestInitAndCreate(argv[2], &hTest);
    if (rcExit)
        return rcExit;
    RTTestBanner(hTest);

    RTAssertSetMayPanic(false);
#ifdef DEBUG_andy
    RTAssertSetQuiet(false);
#endif

    if (!RTStrICmp(argv[2], "tstRTLocalIpcSessionConnectionFork"))
        rcExit = testSessionConnectionChild(argc, argv, hTest);
    else if (!RTStrICmp(argv[2], "tstRTLocalIpcSessionWaitFork"))
        rcExit = testSessionWaitChild(argc, argv, hTest);
    else if (!RTStrICmp(argv[2], "tstRTLocalIpcSessionDataFork"))
        rcExit = testSessionDataChild(argc, argv, hTest);

    return RTTestSummaryAndDestroy(hTest);
}
int main()
{
    RTTEST hTest;
    RTEXITCODE rcExit = RTTestInitAndCreate("tstRTDirCreateUniqueNumbered", &hTest);
    if (rcExit)
        return rcExit;
    RTTestBanner(hTest);

    /*
     * Get the temp directory (this is essential to the testcase).
     */
    int rc;
    RTTESTI_CHECK_RC(rc = RTPathTemp(g_szTempPath, sizeof(g_szTempPath)), VINF_SUCCESS);
    if (RT_FAILURE(rc))
        return RTTestSummaryAndDestroy(hTest);

    /*
     * Create some test directories.
     */
    tst1(1, 1, 0  );
    tst1(2, 1, '-');
    tst1(3, 2, 0  );
    tst1(4, 2, '-');

    /*
     * Summary.
     */
    return RTTestSummaryAndDestroy(hTest);
}
Exemplo n.º 4
0
int main(int argc, char **argv)
{
    RTTEST hTest;
    RTEXITCODE rcExit = RTTestInitAndCreate("tstDisasm", &hTest);
    if (rcExit)
        return rcExit;
    RTTestBanner(hTest);

    static const struct
    {
        const char     *pszDesc;
        uint8_t const  *pbStart;
        uintptr_t       uEndPtr;
        DISCPUMODE      enmCpuMode;
    } aSnippets[] =
    {
        { "32-bit",     (uint8_t const *)(uintptr_t)TestProc32, (uintptr_t)&TestProc32_EndProc, DISCPUMODE_32BIT },
        { "64-bit",     (uint8_t const *)(uintptr_t)TestProc64, (uintptr_t)&TestProc64_EndProc, DISCPUMODE_64BIT },
    };

    for (unsigned i = 0; i < RT_ELEMENTS(aSnippets); i++)
        testDisas(aSnippets[i].pszDesc, aSnippets[i].pbStart, aSnippets[i].uEndPtr, aSnippets[i].enmCpuMode);

    if (RTTestIErrorCount() == 0)
    {
        for (unsigned i = 0; i < RT_ELEMENTS(aSnippets); i++)
            testPerformance(aSnippets[i].pszDesc, aSnippets[i].pbStart, aSnippets[i].uEndPtr, aSnippets[i].enmCpuMode);
    }

    return RTTestSummaryAndDestroy(hTest);
}
Exemplo n.º 5
0
int main()
{
    RTTEST hTest;
    int rc = RTTestInitAndCreate("tstRTTemp", &hTest);
    if (rc)
        return rc;
    RTTestBanner(hTest);

    /*
     * Get the temp directory (this is essential to the testcase).
     */
    RTTESTI_CHECK_RC(rc = RTPathTemp(g_szTempPath, sizeof(g_szTempPath)), VINF_SUCCESS);
    if (RT_FAILURE(rc))
        return RTTestSummaryAndDestroy(hTest);

    /*
     * Create N temporary files and directories using RT(File|Dir)CreateTemp.
     */
    tstBothCreateTemp("#1 (standard)",   "rtRTTemp-XXXXXX",              0700, 128, false /*fSkipXCheck*/);
    tstBothCreateTemp("#2 (long)",       "rtRTTemp-XXXXXXXXXXXXXXXXX",   0700, 128, false /*fSkipXCheck*/);
    tstBothCreateTemp("#3 (short)",      "rtRTTemp-XX",                  0777, 128, false /*fSkipXCheck*/);
    tstBothCreateTemp("#4 (very short)", "rtRTTemp-X",                 0100, 26+10, false /*fSkipXCheck*/);
    tstBothCreateTemp("#5 (in-name)",    "rtRTTemp-XXXt",                  0301, 2, false /*fSkipXCheck*/);
    tstBothCreateTemp("#6 (in-name)",    "XXX-rtRTTemp",                   0355, 2, false /*fSkipXCheck*/);
    tstBothCreateTemp("#7 (in-name)",    "rtRTTemp-XXXXXXXXX.tmp",       0755, 128, false /*fSkipXCheck*/);
    tstBothCreateTemp("#8 (in-name)",    "rtRTTemp-XXXXXXX-X.tmp",       0700, 128, true /*fSkipXCheck*/);
    tstBothCreateTemp("#9 (in-name)",    "rtRTTemp-XXXXXX-XX.tmp",       0700, 128, true /*fSkipXCheck*/);

    /*
     * Summary.
     */
    return RTTestSummaryAndDestroy(hTest);
}
Exemplo n.º 6
0
int main(int argc, char **argv)
{
    RTR3InitExe(argc, &argv, 0);

    /*
     * Initialize IPRT and create the test.
     */
    RTTEST hTest;
    int rc = RTTestInitAndCreate("tstAudioMixBuffer", &hTest);
    if (rc)
        return rc;
    RTTestBanner(hTest);

    rc = tstSingle(hTest);
    if (RT_SUCCESS(rc))
        rc = tstParentChild(hTest);
    if (RT_SUCCESS(rc))
        rc = tstConversion8(hTest);
    if (RT_SUCCESS(rc))
        rc = tstConversion16(hTest);
    if (RT_SUCCESS(rc))
        rc = tstVolume(hTest);

    /*
     * Summary
     */
    return RTTestSummaryAndDestroy(hTest);
}
Exemplo n.º 7
0
int main()
{
    RTTEST hTest;
    int rc = RTTestInitAndCreate("tstRTPoll", &hTest);
    if (rc)
        return rc;
    RTTestBanner(hTest);

    /*
     * The tests.
     */
    tstRTPoll1();
    if (RTTestErrorCount(hTest) == 0)
    {
        bool fMayPanic = RTAssertMayPanic();
        bool fQuiet    = RTAssertAreQuiet();
        RTAssertSetMayPanic(false);
        RTAssertSetQuiet(true);
        tstRTPoll2();
        RTAssertSetQuiet(fQuiet);
        RTAssertSetMayPanic(fMayPanic);
    }

    /*
     * Summary.
     */
    return RTTestSummaryAndDestroy(hTest);
}
Exemplo n.º 8
0
int main(int argc, char **argv)
{
    RTTEST hTest;
    int rc = RTTestInitAndCreate("tstRTFileGetSize-1", &hTest);
    if (rc)
        return rc;
    RTTestBanner(hTest);

    for (int i = 0; i < argc; i++)
    {
        char *pszNm = RTPathFilename(argv[i]);
        if (!pszNm)
            pszNm = argv[i];
        test1(pszNm, argv[i]);
    }

#ifdef RT_OS_WINDOWS
    test1("//./PhysicalDrive0", "//./PhysicalDrive0");
    test1("//./HarddiskVolume1", "//./HarddiskVolume1");
    test1("//./null", "//./nul");
#else
    test1("/dev/null", "/dev/null");
# ifdef RT_OS_LINUX
    test1("/dev/sda",  "/dev/sda");
    test1("/dev/sda1", "/dev/sda1");
    test1("/dev/sda5", "/dev/sda5");
# endif
#endif

    /*
     * Summary.
     */
    return RTTestSummaryAndDestroy(hTest);
}
Exemplo n.º 9
0
int main()
{
    int rc = RTTestInitAndCreate("tstRTFileAio", &g_hTest);
    if (rc)
        return rc;

    /* Check if the API is available. */
    RTTestSub(g_hTest, "RTFileAioGetLimits");
    RTFILEAIOLIMITS AioLimits;
    RT_ZERO(AioLimits);
    RTTESTI_CHECK_RC(rc = RTFileAioGetLimits(&AioLimits), VINF_SUCCESS);
    if (RT_SUCCESS(rc))
    {
        RTTestSub(g_hTest, "Write");
        RTFILE hFile;
        RTTESTI_CHECK_RC(rc = RTFileOpen(&hFile, "tstFileAio#1.tst",
                                         RTFILE_O_READWRITE | RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_NONE | RTFILE_O_ASYNC_IO),
                         VINF_SUCCESS);
        if (RT_SUCCESS(rc))
        {
            uint8_t *pbTestBuf = (uint8_t *)RTTestGuardedAllocTail(g_hTest, TSTFILEAIO_BUFFER_SIZE);
            for (unsigned i = 0; i < TSTFILEAIO_BUFFER_SIZE; i++)
                pbTestBuf[i] = i % 256;

            uint32_t cReqsMax = AioLimits.cReqsOutstandingMax < TSTFILEAIO_MAX_REQS_IN_FLIGHT
                              ? AioLimits.cReqsOutstandingMax
                              : TSTFILEAIO_MAX_REQS_IN_FLIGHT;

            /* Basic write test. */
            RTTestIPrintf(RTTESTLVL_ALWAYS, "Preparing test file, this can take some time and needs quite a bit of harddisk space...\n");
            tstFileAioTestReadWriteBasic(hFile, true /*fWrite*/, pbTestBuf, TSTFILEAIO_BUFFER_SIZE, 100*_1M, cReqsMax);

            /* Reopen the file before doing the next test. */
            RTTESTI_CHECK_RC(RTFileClose(hFile), VINF_SUCCESS);
            if (RTTestErrorCount(g_hTest) == 0)
            {
                RTTestSub(g_hTest, "Read/Write");
                RTTESTI_CHECK_RC(rc = RTFileOpen(&hFile, "tstFileAio#1.tst",
                                                 RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_ASYNC_IO),
                                 VINF_SUCCESS);
                if (RT_SUCCESS(rc))
                {
                    tstFileAioTestReadWriteBasic(hFile, false /*fWrite*/, pbTestBuf, TSTFILEAIO_BUFFER_SIZE, 100*_1M, cReqsMax);
                    RTFileClose(hFile);
                }
            }

            /* Cleanup */
            RTFileDelete("tstFileAio#1.tst");
        }
    }

    /*
     * Summary
     */
    return RTTestSummaryAndDestroy(g_hTest);
}
int main()
{
    /* How many integer test items should be created. */
    static const size_t s_cTestCount = 1000;

    RTTEST hTest;
    RTEXITCODE rcExit = RTTestInitAndCreate("tstIprtList", &hTest);
    if (rcExit)
        return rcExit;
    RTTestBanner(hTest);

    /*
     * Native types.
     */
    uint8_t au8TestInts[s_cTestCount];
    for (size_t i = 0; i < RT_ELEMENTS(au8TestInts); ++i)
        au8TestInts[i] = (uint8_t)RTRandU32Ex(1, UINT8_MAX);
    test1<RTCList,   uint8_t, uint8_t, uint8_t>("ST: Native type", au8TestInts, RT_ELEMENTS(au8TestInts));
    test1<RTCMTList, uint8_t, uint8_t, uint8_t>("MT: Native type", au8TestInts, RT_ELEMENTS(au8TestInts));

    uint16_t au16TestInts[s_cTestCount];
    for (size_t i = 0; i < RT_ELEMENTS(au16TestInts); ++i)
        au16TestInts[i] = (uint16_t)RTRandU32Ex(1, UINT16_MAX);
    test1<RTCList,   uint16_t, uint16_t, uint16_t>("ST: Native type", au16TestInts, RT_ELEMENTS(au16TestInts));
    test1<RTCMTList, uint16_t, uint16_t, uint16_t>("MT: Native type", au16TestInts, RT_ELEMENTS(au16TestInts));

    uint32_t au32TestInts[s_cTestCount];
    for (size_t i = 0; i < RT_ELEMENTS(au32TestInts); ++i)
        au32TestInts[i] = RTRandU32Ex(1, UINT32_MAX);
    test1<RTCList,   uint32_t, uint32_t, uint32_t>("ST: Native type", au32TestInts, RT_ELEMENTS(au32TestInts));
    test1<RTCMTList, uint32_t, uint32_t, uint32_t>("MT: Native type", au32TestInts, RT_ELEMENTS(au32TestInts));

    /*
     * Specialized type.
     */
    uint64_t au64TestInts[s_cTestCount];
    for (size_t i = 0; i < RT_ELEMENTS(au64TestInts); ++i)
        au64TestInts[i] = RTRandU64Ex(1, UINT64_MAX);
    test1<RTCList,   uint64_t, uint64_t, uint64_t>("ST: Specialized type", au64TestInts, RT_ELEMENTS(au64TestInts));
    test1<RTCMTList, uint64_t, uint64_t, uint64_t>("MT: Specialized type", au64TestInts, RT_ELEMENTS(au64TestInts));

    /*
     * Big size type (translate to internal pointer list).
     */
    test1<RTCList,   RTCString, RTCString *, const char *>("ST: Class type", g_apszTestStrings, RT_ELEMENTS(g_apszTestStrings));
    test1<RTCMTList, RTCString, RTCString *, const char *>("MT: Class type", g_apszTestStrings, RT_ELEMENTS(g_apszTestStrings));

    /*
     * Multi-threading test.
     */
    test2();

    /*
     * Summary.
     */
    return RTTestSummaryAndDestroy(hTest);
}
int main(int argc, char **argv)
{
    RT_NOREF_PV(argv);
    int rc = RTTestInitAndCreate("tstRTCritSectRw", &g_hTest);
    if (rc)
        return 1;
    RTTestBanner(g_hTest);

    if (Test1())
    {
        RTCPUID cCores = RTMpGetOnlineCoreCount();
        if (argc == 1)
        {
            TestNegative();

            /*    threads, seconds, writePercent,  yield,  quiet */
            Test4(      1,       1,            0,   true,  false);
            Test4(      1,       1,            1,   true,  false);
            Test4(      1,       1,            5,   true,  false);
            Test4(      2,       1,            3,   true,  false);
            Test4(     10,       1,            5,   true,  false);
            Test4(     10,      10,           10,  false,  false);

            if (cCores > 1)
            {
                RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "benchmarking (%u CPU cores)...\n", cCores);
                for (unsigned cThreads = 1; cThreads < 32; cThreads++)
                Test4(cThreads,  2,            1,  false,   true);
            }
            else
                RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "skipping benchmarking (only %u core available)\n", cCores);

            /** @todo add a testcase where some stuff times out. */
        }
        else
        {
            if (cCores > 1)
            {
                /*    threads, seconds, writePercent,  yield,  quiet */
                RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "benchmarking (%u CPU cores)...\n", cCores);
                Test4(      1,       3,            1,  false,   true);
                Test4(      1,       3,            1,  false,   true);
                Test4(      1,       3,            1,  false,   true);
                Test4(      2,       3,            1,  false,   true);
                Test4(      2,       3,            1,  false,   true);
                Test4(      2,       3,            1,  false,   true);
                Test4(      3,       3,            1,  false,   true);
                Test4(      3,       3,            1,  false,   true);
                Test4(      3,       3,            1,  false,   true);
            }
            else
                RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "skipping benchmarking (only %u core available)\n", cCores);
        }
    }

    return RTTestSummaryAndDestroy(g_hTest);
}
int main()
{
    RTEXITCODE rcExit = RTTestInitAndCreate("tstRTThreadExecutionTime", &g_hTest);
    if (rcExit != RTEXITCODE_SUCCESS)
        return rcExit;
    test1();

    return RTTestSummaryAndDestroy(g_hTest);
}
int main(int argc, char **argv)
{
    RTEXITCODE rcExit = RTTestInitAndCreate(RTPathFilename(argv[0]),
                                            &g_hTest);
    if (rcExit != RTEXITCODE_SUCCESS)
        return rcExit;
    RTTestBanner(g_hTest);
    testAPI(g_hTest);
    return RTTestSummaryAndDestroy(g_hTest);
}
int main()
{
    RTTEST hTest;
    int rc = RTTestInitAndCreate("tstRTFileAppend-1", &hTest);
    if (rc)
        return rc;
    RTTestBanner(hTest);
    tstFileAppend1(hTest);
    RTFileDelete("tstFileAppend-1.tst");
    return RTTestSummaryAndDestroy(hTest);
}
Exemplo n.º 15
0
/**
 * The parent main routine.
 * @param   argv0       The executable name (or whatever).
 */
static int mainParent(const char *argv0)
{
    /*
     * Init.
     */
    RTTEST hTest;
    int rc = RTTestInitAndCreate("tstSupSem-Zombie", &hTest);
    if (rc)
        return rc;
    RTTestBanner(hTest);

    /*
     * Spin of the child process which may or may not turn into a zombie
     */
    for (uint32_t iPass = 0; iPass < 32; iPass++)
    {
        RTTestSubF(hTest, "Pass %u", iPass);

        RTPROCESS hProcess;
        const char *apszArgs[3] = { argv0, "--child", NULL };
        RTTESTI_CHECK_RC_OK(rc = RTProcCreate(argv0, apszArgs, RTENV_DEFAULT, 0 /*fFlags*/, &hProcess));
        if (RT_SUCCESS(rc))
        {
            /*
             * Wait for 60 seconds then give up.
             */
            RTPROCSTATUS    Status;
            uint64_t        StartTS = RTTimeMilliTS();
            for (;;)
            {
                rc = RTProcWait(hProcess, RTPROCWAIT_FLAGS_NOBLOCK, &Status);
                if (RT_SUCCESS(rc))
                    break;
                uint64_t cElapsed = RTTimeMilliTS() - StartTS;
                if (cElapsed > 60*1000)
                    break;
                RTThreadSleep(cElapsed < 60 ? 30 : cElapsed < 200 ? 10 : 100);
            }
            RTTESTI_CHECK_RC_OK(rc);
            if (    RT_SUCCESS(rc)
                &&  (   Status.enmReason != RTPROCEXITREASON_NORMAL
                     || Status.iStatus != 0))
            {
                RTTestIFailed("child %d (%#x) reason %d\n", Status.iStatus, Status.iStatus, Status.enmReason);
                rc = VERR_PERMISSION_DENIED;
            }
        }
        /* one zombie process is enough. */
        if (RT_FAILURE(rc))
            break;
    }

    return RTTestSummaryAndDestroy(hTest);
}
int main(int argc, char **argv)
{
    RTTEST hTest;
    RTEXITCODE rcExit = RTTestInitAndCreate("tstRTDarwinMachKernel", &hTest);
    if (rcExit != RTEXITCODE_SUCCESS)
        return rcExit;
    RTTestBanner(hTest);

    dotest();

    return RTTestSummaryAndDestroy(hTest);
}
int main(int argc, char **argv)
{
    RTTEST hTest;
    int rc = RTTestInitAndCreate("tstRTSymlink", &hTest);
    if (rc)
        return rc;
    RTTestBanner(hTest);

    test1(hTest, ".");

    return RTTestSummaryAndDestroy(hTest);
}
/**
 * Formalities...
 */
int main()
{
    RTTEST hTest;
    RTEXITCODE rcExit = RTTestInitAndCreate("tstIEMCheckMc", &hTest);
    if (rcExit == RTEXITCODE_SUCCESS)
    {
        RTTestBanner(hTest);
        RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "(this is only a compile test.)");
        rcExit = RTTestSummaryAndDestroy(hTest);
    }
    return rcExit;
}
Exemplo n.º 19
0
int main()
{
    RTTEST hTest;
    RTEXITCODE rcExit = RTTestInitAndCreate("memwipe", &hTest);
    if (rcExit != RTEXITCODE_SUCCESS)
        return rcExit;
    RTTestBanner(hTest);

    doMemWipeThoroughly(hTest);

    return RTTestSummaryAndDestroy(hTest);
}
Exemplo n.º 20
0
int main()
{
    RTTEST hTest;
    int rc = RTTestInitAndCreate("tstRTStrAlloc", &hTest);
    if (rc)
        return rc;
    RTTestBanner(hTest);

    tst1();

    return RTTestSummaryAndDestroy(hTest);
}
Exemplo n.º 21
0
int main(int argc, char *argv[])
{
    /*
     * Init IPRT and globals.
     */
    int rc = RTTestInitAndCreate("UsbTest", &g_hTest);
    if (rc)
        return rc;

    /*
     * Default values.
     */
    const char *pszDevice = NULL;

    RTGETOPTUNION ValueUnion;
    RTGETOPTSTATE GetState;
    RTGetOptInit(&GetState, argc, argv, g_aCmdOptions, RT_ELEMENTS(g_aCmdOptions), 1, 0 /* fFlags */);
    while ((rc = RTGetOpt(&GetState, &ValueUnion)))
    {
        switch (rc)
        {
            case 'h':
                usbTestUsage(g_pStdOut);
                return RTEXITCODE_SUCCESS;
            case 'd':
                pszDevice = ValueUnion.psz;
                break;
            default:
                return RTGetOptPrintError(rc, &ValueUnion);
        }
    }

    /*
     * Start testing.
     */
    RTTestBanner(g_hTest);

    /* Find the first test device if none was given. */
    if (!pszDevice)
        pszDevice = usbTestFindDevice();

    if (pszDevice)
        usbTestExec(pszDevice);
    else
    {
        RTTestPrintf(g_hTest, RTTESTLVL_FAILURE, "Failed to find a test device\n");
        RTTestErrorInc(g_hTest);
    }

    RTEXITCODE rcExit = RTTestSummaryAndDestroy(g_hTest);
    return rcExit;
}
Exemplo n.º 22
0
int main()
{
    RTTEST hTest;
    RTEXITCODE rcExit = RTTestInitAndCreate("tstVector", &hTest);
    if (rcExit != RTEXITCODE_SUCCESS)
        return rcExit;

    testVectorSimple(hTest);
    testVectorDelete(hTest);
    testVectorDeleteValue(hTest);

    return RTTestSummaryAndDestroy(hTest);
}
Exemplo n.º 23
0
int main()
{
    RTEXITCODE rcExit = RTTestInitAndCreate("tstRTUdp-1", &g_hTest);
    if (rcExit != RTEXITCODE_SUCCESS)
        return rcExit;
    RTTestBanner(g_hTest);

    test1();

    /** @todo test the full RTUdp API. */

    return RTTestSummaryAndDestroy(g_hTest);
}
Exemplo n.º 24
0
int main(int argc, char **argv)
{
    int rc = RTTestInitAndCreate("tstIntNetR0", &g_hTest);
    if (rc)
        return rc;

    /*
     * Parse the arguments.
     */
    static RTGETOPTDEF const s_aOptions[] =
    {
        { "--recv-buffer",   'r', RTGETOPT_REQ_UINT32 },
        { "--send-buffer",   's', RTGETOPT_REQ_UINT32 },
        { "--transfer-size", 'l', RTGETOPT_REQ_UINT32 },
    };

    uint32_t cbSend = 1536*2 + 4;
    uint32_t cbRecv = 0x8000;

    int ch;
    RTGETOPTUNION Value;
    RTGETOPTSTATE GetState;
    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
    while ((ch = RTGetOpt(&GetState, &Value)))
        switch (ch)
        {
            case 'l':
                g_cbTransfer = Value.u32;
                break;

            case 'r':
                cbRecv = Value.u32;
                break;

            case 's':
                cbSend = Value.u32;
                break;

            default:
                return RTGetOptPrintError(ch, &Value);
        }

    /*
     * Do the testing and report summary.
     */
    TSTSTATE This;
    RT_ZERO(This);
    doTest(&This, cbRecv, cbSend);

    return RTTestSummaryAndDestroy(g_hTest);
}
int main(int argc, char **argv)
{
    /*
     * Initialize IPRT and create the test.
     */
    RTTEST hTest;
    int rc = RTTestInitAndCreate("tstRTDvm", &hTest);
    if (rc)
        return rc;
    RTTestBanner(hTest);

    /*
     * If no args, display usage.
     */
    if (argc < 2)
    {
        RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "Syntax: %s <image>\n", argv[0]);
        return RTTestSkipAndDestroy(hTest, "Missing required arguments\n");
    }

    /* Open image. */
    RTFILE hFile;
    uint64_t cb = 0;
    rc = RTFileOpen(&hFile, argv[1], RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_READWRITE);
    if (RT_FAILURE(rc))
    {
        RTTestIFailed("RTFileOpen -> %Rrc", rc);
        return RTTestSummaryAndDestroy(hTest);
    }

    rc = RTFileGetSize(hFile, &cb);
    if (   RT_FAILURE(rc)
        || cb % 512 != 0) /* Assume 512 byte sector size. */
    {
        RTTestIFailed("RTFileGetSize -> %Rrc", rc);
        return RTTestSummaryAndDestroy(hTest);
    }

    TSTRTDVMDISK Disk;

    Disk.fUseImage = true;
    Disk.hImage    = hFile;
    rc = tstRTDvmVolume(hTest, &Disk, cb, 0);

    RTTESTI_CHECK(rc == VINF_SUCCESS);

    /*
     * Summary
     */
    return RTTestSummaryAndDestroy(hTest);
}
Exemplo n.º 26
0
int main()
{
    RTTEST hTest;
    RTEXITCODE rcExit = RTTestInitAndCreate("tstRTStrCatCopy", &hTest);
    if (rcExit != RTEXITCODE_SUCCESS)
        return rcExit;

    testCopy1(hTest);
    testCopyEx1(hTest);
    testCat1(hTest);
    testCatEx1(hTest);

    return RTTestSummaryAndDestroy(hTest);
}
int main()
{
    RTEXITCODE rcExit = RTTestInitAndCreate("tstRTThreadPoke", &g_hTest);
    if (rcExit != RTEXITCODE_SUCCESS)
        return rcExit;
#ifdef RT_OS_WINDOWS
    return RTTestSkipAndDestroy(g_hTest, "No RTThreadPoke on Windows");

#else
    test1();

    return RTTestSummaryAndDestroy(g_hTest);
#endif
}
int main(int argc, char **argv)
{
    RTEXITCODE rcExit = RTTestInitAndCreate("tstRTSemEventMulti", &g_hTest);
    if (rcExit != RTEXITCODE_SUCCESS)
        return rcExit;

    testBasics();
    if (!RTTestErrorCount(g_hTest))
    {
        test1();
    }

    return RTTestSummaryAndDestroy(g_hTest);
}
Exemplo n.º 29
0
int main()
{
    RTTEST      hTest;
    RTEXITCODE  rcExit = RTTestInitAndCreate("tstIprtMiniString", &hTest);
    if (rcExit == RTEXITCODE_SUCCESS)
    {
        RTTestBanner(hTest);

        test1(hTest);
        test2(hTest);

        rcExit = RTTestSummaryAndDestroy(hTest);
    }
    return rcExit;
}
Exemplo n.º 30
0
int main(int argc, char **argv)
{
    /*
     * Initialize IPRT and create the test.
     */
    RTTEST hTest;
    int rc = RTTestInitAndCreate("tstRTFilesystem", &hTest);
    if (rc)
        return rc;
    RTTestBanner(hTest);

    /*
     * If no args, display usage.
     */
    if (argc < 2)
    {
        RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "Syntax: %s <image>\n", argv[0]);
        return RTTestSkipAndDestroy(hTest, "Missing required arguments\n");
    }

    /* Open image. */
    RTFILE hFile;
    RTVFSFILE hVfsFile;
    rc = RTFileOpen(&hFile, argv[1], RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_READ);
    if (RT_FAILURE(rc))
    {
        RTTestIFailed("RTFileOpen -> %Rrc", rc);
        return RTTestSummaryAndDestroy(hTest);
    }

    rc = RTVfsFileFromRTFile(hFile, 0, false, &hVfsFile);
    if (RT_FAILURE(rc))
    {
        RTTestIFailed("RTVfsFileFromRTFile -> %Rrc", rc);
        return RTTestSummaryAndDestroy(hTest);
    }

    rc = tstRTFilesystem(hTest, hVfsFile);

    RTTESTI_CHECK(rc == VINF_SUCCESS);

    RTVfsFileRelease(hVfsFile);

    /*
     * Summary
     */
    return RTTestSummaryAndDestroy(hTest);
}