VirtualBox

Changeset 19940 in vbox for trunk


Ignore:
Timestamp:
May 23, 2009 2:17:33 PM (16 years ago)
Author:
vboxsync
Message:

tstR0ThreadPreemption: fixes.

Location:
trunk/src/VBox/Runtime/testcase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp

    r19936 r19940  
    7979        {
    8080            RTTHREADPREEMPTSTATE State = RTTHREADPREEMPTSTATE_INITIALIZER;
     81            if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD))
     82                RTStrPrintf(pszErr, cchErr, "RTThreadPreemptIsEnabled returns false by default");
    8183            RTThreadPreemptDisable(&State);
    8284            if (RTThreadPreemptIsEnabled(NIL_RTTHREAD))
     
    108110                             && cNanosElapsed < UINT64_C(60)*1000U*1000U*1000U);
    109111                    if (!fPending)
    110                         RTStrPrintf(pszErr, cchErr, "!Preempt not pending after %llu loops / %llu ns\n",
     112                        RTStrPrintf(pszErr, cchErr, "!Preempt not pending after %llu loops / %llu ns",
    111113                                    cLoops, cNanosElapsed);
    112114                    else if (cLoops == 1)
    113115                        RTStrPrintf(pszErr, cchErr, "!cLoops=0\n");
    114116                    else
    115                         RTStrPrintf(pszErr, cchErr, "RTThreadPreemptIsPending returned true after %llu loops / %llu ns\n",
     117                        RTStrPrintf(pszErr, cchErr, "RTThreadPreemptIsPending returned true after %llu loops / %llu ns",
    116118                                    cLoops, cNanosElapsed);
    117119                }
     
    127129        case TSTR0THREADPREMEPTION_NESTED:
    128130        {
     131            bool const fDefault = RTThreadPreemptIsEnabled(NIL_RTTHREAD);
    129132            RTTHREADPREEMPTSTATE State1 = RTTHREADPREEMPTSTATE_INITIALIZER;
    130133            RTThreadPreemptDisable(&State1);
     
    154157                RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 1st RTThreadPreemptDisable");
    155158            RTThreadPreemptRestore(&State1);
    156             if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD) && !*pszErr)
     159            if (RTThreadPreemptIsEnabled(NIL_RTTHREAD) != fDefault && !*pszErr)
    157160                RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns false after 3rd RTThreadPreemptRestore");
    158161            break;
     
    160163
    161164        default:
    162             RTStrPrintf(pszErr, cchErr, "!Unknown test #%d\n", uOperation);
     165            RTStrPrintf(pszErr, cchErr, "!Unknown test #%d", uOperation);
    163166            break;
    164167    }
  • trunk/src/VBox/Runtime/testcase/tstR0ThreadPreemptionDriver.cpp

    r19936 r19940  
    144144    if (RT_FAILURE(rc))
    145145        return RTTestSummaryAndDestroy(hTest);
    146     RTTESTI_CHECK_MSG(Req.szMsg[0] == '\0', ("%s", Req.szMsg));
    147146    if (Req.szMsg[0] == '!')
     147    {   
     148        RTTestIFailed("%s", &Req.szMsg[1]);
    148149        return RTTestSummaryAndDestroy(hTest);
     150    }
    149151    if (Req.szMsg[0])
    150152        RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", Req.szMsg);
     
    164166            ||  i >= 64)
    165167        {
    166             RTTESTI_CHECK_MSG(Req.szMsg[0] != '!', ("%s", Req.szMsg));
    167             if (Req.szMsg[0])
     168            if (Req.szMsg[0] == '!')
     169                RTTestIFailed("%s", &Req.szMsg[1]);
     170            else if (Req.szMsg[0])
    168171                RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", Req.szMsg);
    169172            break;
     
    182185    RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0ThreadPreemption", sizeof("tstR0ThreadPreemption") - 1,
    183186                                             TSTR0THREADPREMEPTION_NESTED, 0, &Req.Hdr), VINF_SUCCESS);
    184     RTTESTI_CHECK_MSG(Req.szMsg[0] != '!', ("%s", Req.szMsg));
    185     if (Req.szMsg[0])
     187    if (Req.szMsg[0] == '!')
     188        RTTestIFailed("%s", &Req.szMsg[1]);
     189    else if (Req.szMsg[0])
    186190        RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", Req.szMsg);
    187 
    188 
    189191
    190192    /*
     
    194196#endif
    195197}
     198
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