VirtualBox

Changeset 47553 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 6, 2013 10:03:55 AM (11 years ago)
Author:
vboxsync
Message:

Fix R0 timer testcase on darwin and make it possible to skip R0 tests when the feature is not supported (for the timer testcase it is the RTTIMER_FLAGS_CPU_ALL flag which is not supported on darwin)

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstRTR0Common.h

    r33540 r47553  
    177177    } while (0)
    178178
     179/**
     180 * Macro for skipping a test in the ring-0 testcase.
     181 */
     182#define RTR0TESTR0_SKIP() \
     183    do { \
     184        RTR0TestR0Skip("line %u: SKIPPED", __LINE__); \
     185    } while (0)
     186
     187/**
     188 * Same as RTR0TESTR0_SKIP + break.
     189 */
     190#define RTR0TESTR0_SKIP_BREAK() \
     191    if (1) \
     192    { \
     193        RTR0TestR0Skip("line %u: SKIPPED", __LINE__); \
     194        break; \
     195    } else do { } while (0)
     196
    179197
    180198/**
     
    245263}
    246264
     265
     266/**
     267 * Report an error.
     268 */
     269void RTR0TestR0Skip(const char *pszFormat, ...)
     270{
     271    size_t off = RTStrNLen(g_szErr, sizeof(g_szErr) - 1);
     272    size_t cbLeft = sizeof(g_szErr) - off;
     273    if (cbLeft > 10)
     274    {
     275        char *psz = &g_szErr[off];
     276        if (off)
     277        {
     278            *psz++  = '\n';
     279            *psz++  = '\n';
     280            cbLeft -= 2;
     281        }
     282        *psz++ = '$';
     283        cbLeft--;
     284
     285        va_list va;
     286        va_start(va, pszFormat);
     287        RTStrPrintfV(psz, cbLeft, pszFormat, va);
     288        va_end(va);
     289    }
     290    ASMAtomicIncU32(&g_cErrors);
     291}
     292
     293
    247294/**
    248295 * Checks if we have any error reports.
  • trunk/src/VBox/Runtime/testcase/tstRTR0CommonDriver.h

    r32736 r47553  
    178178     * We can have multiple failures and info messages packed into szMsg.  They
    179179     * are separated by a double newline.  The kind of message is indicated by
    180      * the first character, '!' means error and '?' means info message.
     180     * the first character, '!' means error and '?' means info message. '$' means
     181     * the test was skipped because a feature is not supported on the host.
    181182     */
    182183    bool fRc = true;
     
    190191            char *pszCur = pszNext;
    191192            do
    192                 pszNext = strpbrk(pszNext + 1, "!?");
     193                pszNext = strpbrk(pszNext + 1, "!?$");
    193194            while (pszNext && (pszNext[-1] != '\n' || pszNext[-2] != '\n'));
    194195
     
    203204                fRc = false;
    204205            }
     206            else if (*pszCur == '$')
     207            {
     208                RTTestSkipped(g_hTest, "%s", pszCur + 1);
     209            }
    205210            else
    206211                RTTestPrintfNl(g_hTest, RTTESTLVL_ALWAYS, "%s", pszCur + 1);
  • trunk/src/VBox/Runtime/testcase/tstRTR0Timer.cpp

    r44528 r47553  
    481481                {
    482482                    RTR0TESTR0_CHECK_RC_BREAK(RTTimerStart(pTimer, cNsSysHz * iTest), VINF_SUCCESS);
    483                     for (uint32_t i = 0; i < 1000 && ASMAtomicUoReadU32(&State.cShots) < 1; i++)
     483                    for (uint32_t i = 0; i < 1000 && (ASMAtomicUoReadU32(&State.cShots) < 1 || State.rc == VERR_IPE_UNINITIALIZED_STATUS); i++)
    484484                        RTThreadSleep(5);
    485485                    RTR0TESTR0_CHECK_MSG_BREAK(ASMAtomicReadU32(&State.cShots) == 1, ("cShots=%u\n", State.cShots));
     
    724724            uint32_t        fFlags = (TSTRTR0TIMER_IS_HIRES(uOperation) ? RTTIMER_FLAGS_HIGH_RES : 0)
    725725                                   | RTTIMER_FLAGS_CPU_ALL;
    726             RTR0TESTR0_CHECK_RC_BREAK(RTTimerCreateEx(&pTimer, cNsInterval, fFlags, tstRTR0TimerCallbackOmni, paStates),
    727                                       VINF_SUCCESS);
     726            int             rc = RTTimerCreateEx(&pTimer, cNsInterval, fFlags, tstRTR0TimerCallbackOmni, paStates);
     727            if (rc == VERR_NOT_SUPPORTED)
     728                RTR0TESTR0_SKIP_BREAK();
     729            RTR0TESTR0_CHECK_RC_BREAK(rc, VINF_SUCCESS);
    728730
    729731            for (uint32_t iTest = 0; iTest < 3 && !RTR0TestR0HaveErrors(); iTest++)
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