Changeset 58303 in vbox
- Timestamp:
- Oct 18, 2015 10:46:23 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 103499
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/mangling.h
r58300 r58303 1659 1659 # define RTTestChangeName RT_MANGLER(RTTestChangeName) 1660 1660 # define RTTestCreate RT_MANGLER(RTTestCreate) 1661 # define RTTestCreateChild RT_MANGLER(RTTestCreateChild) 1661 1662 # define RTTestCreateEx RT_MANGLER(RTTestCreateEx) 1662 1663 # define RTTestDestroy RT_MANGLER(RTTestDestroy) -
trunk/include/iprt/test.h
r57944 r58303 80 80 RTR3DECL(int) RTTestCreate(const char *pszTest, PRTTEST phTest); 81 81 82 /** 83 * Creates a test instance for a child process. 84 * 85 * This differs from RTTestCreate in that it disabled result reporting to file 86 * and pipe in order to avoid producing invalid XML. 87 * 88 * @returns IPRT status code. 89 * @param pszTest The test name. 90 * @param phTest Where to store the test instance handle. 91 */ 92 RTR3DECL(int) RTTestCreateChild(const char *pszTest, PRTTEST phTest); 93 82 94 /** @name RTTEST_C_XXX - Flags for RTTestCreateEx. 83 95 * @{ */ … … 111 123 * this flag is incompatible with using the RTTestIXxxx variant of the API. */ 112 124 #define RTTEST_C_NO_TLS RT_BIT(3) 125 /** Don't report to the pipe (IPRT_TEST_PIPE or other). */ 126 #define RTTEST_C_NO_XML_REPORTING_PIPE RT_BIT(4) 127 /** Don't report to the results file (IPRT_TEST_FILE or other). */ 128 #define RTTEST_C_NO_XML_REPORTING_FILE RT_BIT(4) 129 /** No XML reporting to pipes, file or anything. 130 * Child processes may want to use this so they don't garble the output of 131 * the main test process. */ 132 #define RTTEST_C_NO_XML_REPORTING (RTTEST_C_NO_XML_REPORTING_PIPE | RTTEST_C_NO_XML_REPORTING_FILE) 113 133 /** Mask containing the valid bits. */ 114 #define RTTEST_C_VALID_MASK UINT32_C(0x000000 0f)134 #define RTTEST_C_VALID_MASK UINT32_C(0x0000003f) 115 135 /** @} */ 116 136 -
trunk/src/VBox/Runtime/r3/test.cpp
r57944 r58303 315 315 * Any test driver we are connected or should connect to? 316 316 */ 317 if ( (fFlags & RTTEST_C_USE_ENV) && iNativeTestPipe == -1)317 if (!(fFlags & RTTEST_C_NO_XML_REPORTING_PIPE)) 318 318 { 319 rc = RTEnvGetEx(RTENV_DEFAULT, "IPRT_TEST_PIPE", szEnvVal, sizeof(szEnvVal), NULL);320 if (RT_SUCCESS(rc))319 if ( (fFlags & RTTEST_C_USE_ENV) 320 && iNativeTestPipe == -1) 321 321 { 322 rc = RTEnvGetEx(RTENV_DEFAULT, "IPRT_TEST_PIPE", szEnvVal, sizeof(szEnvVal), NULL); 323 if (RT_SUCCESS(rc)) 324 { 322 325 #if ARCH_BITS == 64 323 rc = RTStrToInt64Full(szEnvVal, 0, &iNativeTestPipe);326 rc = RTStrToInt64Full(szEnvVal, 0, &iNativeTestPipe); 324 327 #else 325 rc = RTStrToInt32Full(szEnvVal, 0, &iNativeTestPipe);328 rc = RTStrToInt32Full(szEnvVal, 0, &iNativeTestPipe); 326 329 #endif 327 if (RT_FAILURE(rc)) 330 if (RT_FAILURE(rc)) 331 { 332 RTStrmPrintf(g_pStdErr, "%s: test pipe error: RTStrToInt32Full(\"%s\") -> %Rrc\n", 333 pszTest, szEnvVal, rc); 334 iNativeTestPipe = -1; 335 } 336 } 337 else if (rc != VERR_ENV_VAR_NOT_FOUND) 338 RTStrmPrintf(g_pStdErr, "%s: test pipe error: RTEnvGetEx(IPRT_TEST_PIPE) -> %Rrc\n", pszTest, rc); 339 } 340 if (iNativeTestPipe != -1) 341 { 342 rc = RTPipeFromNative(&pTest->hXmlPipe, iNativeTestPipe, RTPIPE_N_WRITE); 343 if (RT_SUCCESS(rc)) 344 pTest->fXmlEnabled = true; 345 else 328 346 { 329 RTStrmPrintf(g_pStdErr, "%s: test pipe error: RT StrToInt32Full(\"%s\") -> %Rrc\n",330 pszTest, szEnvVal, rc);331 iNativeTestPipe = -1;347 RTStrmPrintf(g_pStdErr, "%s: test pipe error: RTPipeFromNative(,%p,WRITE) -> %Rrc\n", 348 pszTest, iNativeTestPipe, rc); 349 pTest->hXmlPipe = NIL_RTPIPE; 332 350 } 333 }334 else if (rc != VERR_ENV_VAR_NOT_FOUND)335 RTStrmPrintf(g_pStdErr, "%s: test pipe error: RTEnvGetEx(IPRT_TEST_PIPE) -> %Rrc\n", pszTest, rc);336 }337 if (iNativeTestPipe != -1)338 {339 rc = RTPipeFromNative(&pTest->hXmlPipe, iNativeTestPipe, RTPIPE_N_WRITE);340 if (RT_SUCCESS(rc))341 pTest->fXmlEnabled = true;342 else343 {344 RTStrmPrintf(g_pStdErr, "%s: test pipe error: RTPipeFromNative(,%p,WRITE) -> %Rrc\n",345 pszTest, iNativeTestPipe, rc);346 pTest->hXmlPipe = NIL_RTPIPE;347 351 } 348 352 } … … 351 355 * Any test file we should write the test report to? 352 356 */ 353 if ( (fFlags & RTTEST_C_USE_ENV) && pszXmlFile == NULL)357 if (!(fFlags & RTTEST_C_NO_XML_REPORTING_FILE)) 354 358 { 355 rc = RTEnvGetEx(RTENV_DEFAULT, "IPRT_TEST_FILE", szEnvVal, sizeof(szEnvVal), NULL); 356 if (RT_SUCCESS(rc)) 357 pszXmlFile = szEnvVal; 358 else if (rc != VERR_ENV_VAR_NOT_FOUND) 359 RTStrmPrintf(g_pStdErr, "%s: test pipe error: RTEnvGetEx(IPRT_TEST_MAX_LEVEL) -> %Rrc\n", pszTest, rc); 360 } 361 if (pszXmlFile && *pszXmlFile) 362 { 363 rc = RTFileOpen(&pTest->hXmlFile, pszXmlFile, 364 RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_OPEN_CREATE | RTFILE_O_TRUNCATE); 365 if (RT_SUCCESS(rc)) 366 pTest->fXmlEnabled = true; 367 else 359 if ((fFlags & RTTEST_C_USE_ENV) && pszXmlFile == NULL) 368 360 { 369 RTStrmPrintf(g_pStdErr, "%s: test file error: RTFileOpen(,\"%s\",) -> %Rrc\n", pszTest, pszXmlFile, rc); 370 pTest->hXmlFile = NIL_RTFILE; 361 rc = RTEnvGetEx(RTENV_DEFAULT, "IPRT_TEST_FILE", szEnvVal, sizeof(szEnvVal), NULL); 362 if (RT_SUCCESS(rc)) 363 pszXmlFile = szEnvVal; 364 else if (rc != VERR_ENV_VAR_NOT_FOUND) 365 RTStrmPrintf(g_pStdErr, "%s: test file error: RTEnvGetEx(IPRT_TEST_MAX_LEVEL) -> %Rrc\n", pszTest, rc); 366 } 367 if (pszXmlFile && *pszXmlFile) 368 { 369 rc = RTFileOpen(&pTest->hXmlFile, pszXmlFile, 370 RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_OPEN_CREATE | RTFILE_O_TRUNCATE); 371 if (RT_SUCCESS(rc)) 372 pTest->fXmlEnabled = true; 373 else 374 { 375 RTStrmPrintf(g_pStdErr, "%s: test file error: RTFileOpen(,\"%s\",) -> %Rrc\n", 376 pszTest, pszXmlFile, rc); 377 pTest->hXmlFile = NIL_RTFILE; 378 } 371 379 } 372 380 } 373 else if (rc != VERR_ENV_VAR_NOT_FOUND)374 RTStrmPrintf(g_pStdErr, "%s: test file error: RTEnvGetEx(IPRT_TEST_FILE) -> %Rrc\n", pszTest, rc);375 381 376 382 /* … … 405 411 { 406 412 return RTTestCreateEx(pszTest, RTTEST_C_USE_ENV, RTTESTLVL_INVALID, -1 /*iNativeTestPipe*/, NULL /*pszXmlFile*/, phTest); 413 } 414 415 416 RTR3DECL(int) RTTestCreateChild(const char *pszTest, PRTTEST phTest) 417 { 418 return RTTestCreateEx(pszTest, RTTEST_C_USE_ENV | RTTEST_C_NO_XML_REPORTING, 419 RTTESTLVL_INVALID, -1 /*iNativeTestPipe*/, NULL /*pszXmlFile*/, phTest); 407 420 } 408 421
Note:
See TracChangeset
for help on using the changeset viewer.