VirtualBox

Changeset 19944 in vbox for trunk


Ignore:
Timestamp:
May 23, 2009 9:48:08 PM (16 years ago)
Author:
vboxsync
Message:

iprt: Some more RTTest stuff.

Location:
trunk
Files:
3 edited

Legend:

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

    r19882 r19944  
    211211 * @param   hTest       The test handle. If NIL_RTTEST we'll use the one
    212212 *                      associated with the calling thread.
    213  * @param   pszSubTest  The sub-test name
     213 * @param   pszSubTest  The sub-test name.
    214214 */
    215215RTR3DECL(int) RTTestSub(RTTEST hTest, const char *pszSubTest);
     216
     217/**
     218 * Format string version of RTTestSub.
     219 *
     220 * See RTTestSub for details.
     221 *
     222 * @returns Number of chars printed.
     223 * @param   hTest           The test handle. If NIL_RTTEST we'll use the one
     224 *                          associated with the calling thread.
     225 * @param   pszSubTestFmt   The sub-test name format string.
     226 * @param   ...             Arguments.
     227 */
     228RTR3DECL(int) RTTestSubF(RTTEST hTest, const char *pszSubTestFmt, ...);
     229
     230/**
     231 * Format string version of RTTestSub.
     232 *
     233 * See RTTestSub for details.
     234 *
     235 * @returns Number of chars printed.
     236 * @param   hTest           The test handle. If NIL_RTTEST we'll use the one
     237 *                          associated with the calling thread.
     238 * @param   pszSubTestFmt   The sub-test name format string.
     239 * @param   ...             Arguments.
     240 */
     241RTR3DECL(int) RTTestSubV(RTTEST hTest, const char *pszSubTestFmt, va_list va);
    216242
    217243/**
     
    473499
    474500/**
     501 * Starts a sub-test.
     502 *
     503 * This will perform an implicit RTTestSubDone() call if that has not been done
     504 * since the last RTTestSub call.
     505 *
     506 * @returns Number of chars printed.
     507 * @param   pszSubTest  The sub-test name.
     508 */
     509RTR3DECL(int) RTTestISub(const char *pszSubTest);
     510
     511/**
     512 * Format string version of RTTestSub.
     513 *
     514 * See RTTestSub for details.
     515 *
     516 * @returns Number of chars printed.
     517 * @param   pszSubTestFmt   The sub-test name format string.
     518 * @param   ...             Arguments.
     519 */
     520RTR3DECL(int) RTTestISubF(const char *pszSubTestFmt, ...);
     521
     522/**
     523 * Format string version of RTTestSub.
     524 *
     525 * See RTTestSub for details.
     526 *
     527 * @returns Number of chars printed.
     528 * @param   pszSubTestFmt   The sub-test name format string.
     529 * @param   ...             Arguments.
     530 */
     531RTR3DECL(int) RTTestISubV(const char *pszSubTestFmt, va_list va);
     532
     533/**
     534 * Completes a sub-test.
     535 *
     536 * @returns Number of chars printed.
     537 */
     538RTR3DECL(int) RTTestISubDone(void);
     539
     540/**
    475541 * Prints an extended PASSED message, optional.
    476542 *
  • trunk/src/VBox/Runtime/r3/test.cpp

    r19939 r19944  
    3434*******************************************************************************/
    3535#include <iprt/test.h>
     36
     37#include <iprt/asm.h>
     38#include <iprt/critsect.h>
     39#include <iprt/env.h>
     40#include <iprt/err.h>
    3641#include <iprt/mem.h>
     42#include <iprt/once.h>
    3743#include <iprt/param.h>
    3844#include <iprt/string.h>
    3945#include <iprt/stream.h>
    40 #include <iprt/critsect.h>
    41 #include <iprt/once.h>
    42 #include <iprt/err.h>
    43 #include <iprt/asm.h>
    4446
    4547#include "internal/magics.h"
     
    247249            if (RT_SUCCESS(rc))
    248250            {
     251                /*
     252                 * Finally, pick up overrides from the environment.
     253                 */
     254                char szMaxLevel[80];
     255                rc = RTEnvGetEx(RTENV_DEFAULT, "IPRT_TEST_MAX_LEVEL", szMaxLevel, sizeof(szMaxLevel), NULL);
     256                if (RT_SUCCESS(rc))
     257                {
     258                    char *pszMaxLevel = RTStrStrip(szMaxLevel);
     259                    if (!strcmp(pszMaxLevel, "all"))
     260                        pTest->enmMaxLevel = RTTESTLVL_DEBUG;
     261                    if (!strcmp(pszMaxLevel, "quiet"))
     262                        pTest->enmMaxLevel = RTTESTLVL_FAILURE;
     263                    else if (!strcmp(pszMaxLevel, "debug"))
     264                        pTest->enmMaxLevel = RTTESTLVL_DEBUG;
     265                    else if (!strcmp(pszMaxLevel, "info"))
     266                        pTest->enmMaxLevel = RTTESTLVL_INFO;
     267                    else if (!strcmp(pszMaxLevel, "sub_test"))
     268                        pTest->enmMaxLevel = RTTESTLVL_SUB_TEST;
     269                    else if (!strcmp(pszMaxLevel, "failure"))
     270                        pTest->enmMaxLevel = RTTESTLVL_FAILURE;
     271                }
     272
    249273                *phTest = pTest;
    250274                return VINF_SUCCESS;
     
    807831
    808832/**
     833 * Format string version of RTTestSub.
     834 *
     835 * See RTTestSub for details.
     836 *
     837 * @returns Number of chars printed.
     838 * @param   hTest           The test handle. If NIL_RTTEST we'll use the one
     839 *                          associated with the calling thread.
     840 * @param   pszSubTestFmt   The sub-test name format string.
     841 * @param   ...             Arguments.
     842 */
     843RTR3DECL(int) RTTestSubF(RTTEST hTest, const char *pszSubTestFmt, ...)
     844{
     845    va_list va;
     846    va_start(va, pszSubTestFmt);
     847    int cch = RTTestSubV(hTest, pszSubTestFmt, va);
     848    va_end(va);
     849    return cch;
     850}
     851
     852
     853/**
     854 * Format string version of RTTestSub.
     855 *
     856 * See RTTestSub for details.
     857 *
     858 * @returns Number of chars printed.
     859 * @param   hTest           The test handle. If NIL_RTTEST we'll use the one
     860 *                          associated with the calling thread.
     861 * @param   pszSubTestFmt   The sub-test name format string.
     862 * @param   ...             Arguments.
     863 */
     864RTR3DECL(int) RTTestSubV(RTTEST hTest, const char *pszSubTestFmt, va_list va)
     865{
     866    char *pszSubTest;
     867    RTStrAPrintfV(&pszSubTest, pszSubTestFmt, va);
     868    if (pszSubTest)
     869    {
     870        int cch = RTTestSub(hTest, pszSubTest);
     871        RTStrFree(pszSubTest);
     872        return cch;
     873    }
     874    return 0;
     875}
     876
     877
     878/**
    809879 * Completes a sub-test.
    810880 *
  • trunk/src/VBox/Runtime/r3/testi.cpp

    r18847 r19944  
    5050    va_end(va);
    5151    return cch;
     52}
     53
     54
     55RTR3DECL(int) RTTestISub(const char *pszSubTest)
     56{
     57    return RTTestSub(NIL_RTTEST, pszSubTest);
     58}
     59
     60
     61RTR3DECL(int) RTTestISubF(const char *pszSubTestFmt, ...)
     62{
     63    va_list va;
     64    va_start(va, pszSubTestFmt);
     65    int cch = RTTestSubV(NIL_RTTEST, pszSubTestFmt, va);
     66    va_end(va);
     67    return cch;
     68}
     69
     70
     71RTR3DECL(int) RTTestISubV(const char *pszSubTestFmt, va_list va)
     72{
     73    return RTTestSubV(NIL_RTTEST, pszSubTestFmt, va);
     74}
     75
     76
     77RTR3DECL(int) RTTestISubDone(void)
     78{
     79    return RTTestSubDone(NIL_RTTEST);
    5280}
    5381
Note: See TracChangeset for help on using the changeset viewer.

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