VirtualBox

Changeset 19935 in vbox


Ignore:
Timestamp:
May 23, 2009 1:50:33 AM (16 years ago)
Author:
vboxsync
Message:

tstR0ThreadPreemption: Test nesting and fix enum.

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

Legend:

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

    r19933 r19935  
    8888        case TSTR0THREADPREMEPTION_IS_PENDING:
    8989        {
     90            /* This isn't 100% proof... */
    9091            RTTHREADPREEMPTSTATE State = RTTHREADPREEMPTSTATE_INITIALIZER;
    9192            RTThreadPreemptDisable(&State);
     
    121122        }
    122123
     124        case TSTR0THREADPREMEPTION_NESTED:
     125        {
     126            RTTHREADPREEMPTSTATE State1 = RTTHREADPREEMPTSTATE_INITIALIZER;
     127            RTThreadPreemptDisable(&State1);
     128            if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD))
     129            {
     130                RTTHREADPREEMPTSTATE State2 = RTTHREADPREEMPTSTATE_INITIALIZER;
     131                RTThreadPreemptDisable(&State2);
     132                if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD))
     133                {
     134                    RTTHREADPREEMPTSTATE State3 = RTTHREADPREEMPTSTATE_INITIALIZER;
     135                    RTThreadPreemptDisable(&State3);
     136                    if (RTThreadPreemptIsEnabled(NIL_RTTHREAD))
     137                        RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 3rd RTThreadPreemptDisable");
     138
     139                    RTThreadPreemptRestore(&State3);
     140                    if (RTThreadPreemptIsEnabled(NIL_RTTHREAD) && !*pszErr)
     141                        RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 1st RTThreadPreemptRestore");
     142                }
     143                else
     144                    RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 2nd RTThreadPreemptDisable");
     145
     146                RTThreadPreemptRestore(&State2);
     147                if (RTThreadPreemptIsEnabled(NIL_RTTHREAD) && !*pszErr)
     148                    RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 2nd RTThreadPreemptRestore");
     149            }
     150            else
     151                RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 1st RTThreadPreemptDisable");
     152            RTThreadPreemptRestore(&State1);
     153            if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD) && !*pszErr)
     154                RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns false after 3rd RTThreadPreemptRestore");
     155            break;
     156        }
     157
    123158        default:
    124159            RTStrPrintf(pszErr, cchErr, "!Unknown test #%d\n", uOperation);
  • trunk/src/VBox/Runtime/testcase/tstR0ThreadPreemption.h

    r19934 r19935  
    4242    TSTR0THREADPREMEPTION_BASIC,
    4343    TSTR0THREADPREMEPTION_IS_PENDING,
     44    TSTR0THREADPREMEPTION_NESTED
    4445} TSTR0THREADPREMEPTION;
    4546
  • trunk/src/VBox/Runtime/testcase/tstR0ThreadPreemptionDriver.cpp

    r19933 r19935  
    163163
    164164    /*
     165     * Stay in ring-0 until preemption is pending.
     166     */
     167    RTTestSub(hTest, "Nested");
     168    Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;
     169    Req.Hdr.cbReq = sizeof(Req);
     170    Req.szMsg[0] = '\0';
     171    RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0ThreadPreemption", sizeof("tstR0ThreadPreemption") - 1,
     172                                             TSTR0THREADPREMEPTION_NESTED, 0, &Req.Hdr), VINF_SUCCESS);
     173    RTTESTI_CHECK_MSG(Req.szMsg[0] != '!', ("%s", Req.szMsg));
     174    if (Req.szMsg[0])
     175        RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", Req.szMsg);
     176
     177
     178
     179    /*
    165180     * Done.
    166181     */
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