VirtualBox

Changeset 20109 in vbox


Ignore:
Timestamp:
May 27, 2009 10:49:29 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
47863
Message:

RTTestSkipAndDestroy.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/test.h

    r19952 r20109  
    203203
    204204/**
     205 * Skips the test, destroys the test instance and return an exit code.
     206 *
     207 * @returns Test program exit code.
     208 * @param   hTest           The test handle. If NIL_RTTEST we'll use the one
     209 *                          associated with the calling thread.
     210 * @param   pszReasonFmt    Text explaining why, optional (NULL).
     211 * @param   va              Arguments for the reason format string.
     212 */
     213RTR3DECL(int) RTTestSkipAndDestroyV(RTTEST hTest, const char *pszReason, va_list va);
     214
     215/**
     216 * Skips the test, destroys the test instance and return an exit code.
     217 *
     218 * @returns Test program exit code.
     219 * @param   hTest           The test handle. If NIL_RTTEST we'll use the one
     220 *                          associated with the calling thread.
     221 * @param   pszReasonFmt    Text explaining why, optional (NULL).
     222 * @param   va              Arguments for the reason format string.
     223 */
     224RTR3DECL(int) RTTestSkipAndDestroy(RTTEST hTest, const char *pszReason, ...);
     225
     226/**
    205227 * Starts a sub-test.
    206228 *
  • trunk/src/VBox/Runtime/r3/test.cpp

    r19952 r20109  
    166166*******************************************************************************/
    167167static void rtTestGuardedFreeOne(PRTTESTGUARDEDMEM pMem);
     168static int rtTestPrintf(PRTTESTINT pTest, const char *pszFormat, ...);
    168169
    169170
     
    304305
    305306    /*
     307     * Make sure we end with a new line.
     308     */
     309    if (!pTest->fNewLine)
     310        rtTestPrintf(pTest, "\n");
     311
     312    /*
    306313     * Clean up.
    307314     */
     
    786793    }
    787794
    788 
    789795    RTTestDestroy(pTest);
     796    return rc;
     797}
     798
     799
     800RTR3DECL(int) RTTestSkipAndDestroyV(RTTEST hTest, const char *pszReason, va_list va)
     801{
     802    PRTTESTINT pTest = hTest;
     803    RTTEST_GET_VALID_RETURN_RC(pTest, 2);
     804
     805    RTCritSectEnter(&pTest->Lock);
     806    rtTestSubTestReport(pTest);
     807    RTCritSectLeave(&pTest->Lock);
     808
     809    int rc;
     810    if (!pTest->cErrors)
     811    {
     812        if (pszReason)
     813            RTTestPrintfNlV(hTest, RTTESTLVL_FAILURE, pszReason, va);
     814        RTTestPrintfNl(hTest, RTTESTLVL_ALWAYS, "SKIPPED\n", pTest->cErrors);
     815        rc = 2;
     816    }
     817    else
     818    {
     819        RTTestPrintfNl(hTest, RTTESTLVL_ALWAYS, "FAILURE - %u errors\n", pTest->cErrors);
     820        rc = 1;
     821    }
     822
     823    RTTestDestroy(pTest);
     824    return rc;
     825}
     826
     827
     828RTR3DECL(int) RTTestSkipAndDestroy(RTTEST hTest, const char *pszReason, ...)
     829{
     830    va_list va;
     831    va_start(va, pszReason);
     832    int rc = RTTestSkipAndDestroyV(hTest, pszReason, va);
     833    va_end(va);
    790834    return rc;
    791835}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette