本文整理汇总了C++中RTTestSummaryAndDestroy函数的典型用法代码示例。如果您正苦于以下问题:C++ RTTestSummaryAndDestroy函数的具体用法?C++ RTTestSummaryAndDestroy怎么用?C++ RTTestSummaryAndDestroy使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RTTestSummaryAndDestroy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
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);
}
示例2: main
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);
}
示例3: main
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);
}
示例4: main
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);
}
示例5: main
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);
}
示例6: main
int main()
{
/*
* Init.
*/
RTTEST hTest;
int rc;
if ( RT_FAILURE(rc = RTR3InitExeNoArguments(0))
|| RT_FAILURE(rc = RTTestCreate("tstVMMR0CallHost-1", &hTest)))
{
RTStrmPrintf(g_pStdErr, "tstVMMR0CallHost-1: Fatal error during init: %Rrc\n", rc);
return 1;
}
RTTestBanner(hTest);
g_Jmp.pvSavedStack = (RTR0PTR)RTTestGuardedAllocTail(hTest, VMM_STACK_SIZE);
/*
* Run two test with about 1000 long jumps each.
*/
RTTestSub(hTest, "Increasing stack usage");
tst(0, 7000, 1);
RTTestSub(hTest, "Decreasing stack usage");
tst(7599, 0, -1);
return RTTestSummaryAndDestroy(hTest);
}
示例7: main
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);
}
示例8: main
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);
}
示例9: main
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);
}
示例10: main
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);
}
示例11: main
int main(int argc, char **argv)
{
RTTEST hTest;
RTEXITCODE rcExit = RTTestInitExAndCreate(argc, &argv, 0 /*fRtInit*/, "tstRTIsoFs", &hTest);
if (rcExit != RTEXITCODE_SUCCESS)
return rcExit;
if (argc <= 1)
return RTTestSkipAndDestroy(hTest, "no input");
/*
* First argument is the ISO to open.
*/
RTISOFSFILE IsoFs;
int rc = RTIsoFsOpen(&IsoFs, argv[1]);
if (RT_SUCCESS(rc))
{
/*
* Remaining arguments specifies files in the ISO that we wish information
* about and optionally extract.
*/
for (int i = 2; i < argc; i++)
{
char *pszFile = argv[i];
char chSaved = 0;
char *pszDst = strchr(pszFile, '=');
if (pszDst)
{
chSaved = *pszDst;
*pszDst = '\0';
}
uint32_t offFile = UINT32_MAX / 2;
size_t cbFile = UINT32_MAX / 2;
rc = RTIsoFsGetFileInfo(&IsoFs, pszFile, &offFile, &cbFile);
if (RT_SUCCESS(rc))
{
RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "%s: %u bytes at %#x\n", pszFile, (uint32_t)cbFile, offFile);
if (pszDst)
{
rc = RTIsoFsExtractFile(&IsoFs, pszFile, pszDst);
if (RT_SUCCESS(rc))
RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "%s: saved as '%s'.\n", pszFile, pszDst);
else
RTTestFailed(hTest, "RTIsoFsExtractFile failed to extract '%s' to '%s': %Rrc", pszFile, pszDst, rc);
}
}
else
RTTestFailed(hTest, "RTIsoFsGetFileInfo failed for '%s': %Rrc", pszFile, rc);
if (pszDst)
pszDst[-1] = chSaved;
}
RTIsoFsClose(&IsoFs);
}
else
RTTestFailed(hTest, "RTIsoFsOpen failed to open '%s': %Rrc", argv[1], rc);
return RTTestSummaryAndDestroy(hTest);
}
示例12: main
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);
}
示例13: main
int main()
{
RTEXITCODE rcExit = RTTestInitAndCreate("tstRTThreadExecutionTime", &g_hTest);
if (rcExit != RTEXITCODE_SUCCESS)
return rcExit;
test1();
return RTTestSummaryAndDestroy(g_hTest);
}
开发者ID:stefano-garzarella,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:9,代码来源:tstRTThreadExecutionTime.cpp
示例14: main
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);
}
示例15: main
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);
}