VirtualBox

Changeset 82890 in vbox for trunk


Ignore:
Timestamp:
Jan 28, 2020 3:52:02 PM (5 years ago)
Author:
vboxsync
Message:

Shared Clipboard: Fixed testcases. bugref:9437

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardServiceHost.cpp

    r82887 r82890  
    55
    66/*
    7  * Copyright (C) 2011-2019 Oracle Corporation
     7 * Copyright (C) 2011-2020 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3636};
    3737
     38/** Don't let assertions in the host service panic (core dump) the test cases. */
     39RTDECL(bool) RTAssertShouldPanic(void)
     40{
     41#ifndef DEBUG_andy
     42    return false;
     43#else
     44    return true;
     45#endif
     46}
     47
    3848/** Call completion callback for guest calls. */
    3949static DECLCALLBACK(int) callComplete(VBOXHGCMCALLHANDLE callHandle, int32_t rc)
     
    128138
    129139/* Adds a host data read request message to the client's message queue. */
    130 static void testMsgAddReadData(PSHCLCLIENT pClient, uint32_t fFormat)
    131 {
    132     int rc = ShClSvcDataReadRequest(pClient, fFormat, NULL /* pidEvent */);
     140static void testMsgAddReadData(PSHCLCLIENT pClient, SHCLFORMATS fFormats)
     141{
     142    int rc = ShClSvcDataReadRequest(pClient, fFormats, NULL /* pidEvent */);
    133143    RTTESTI_CHECK_RC_OK(rc);
    134144}
     
    156166    HGCMSvcSetU32(&parms[0], 0);
    157167    HGCMSvcSetU32(&parms[1], 0);
    158     call.rc = VERR_TRY_AGAIN;
     168    call.rc = VERR_IPE_UNINITIALIZED_STATUS;
    159169    table.pfnConnect(NULL, 1 /* clientId */, &g_Client, 0, 0);
    160170    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    161     RTTESTI_CHECK_RC(call.rc, VERR_TRY_AGAIN);  /* This should get updated only when the guest call completes. */
     171    RTTESTI_CHECK_RC(call.rc, VERR_IPE_UNINITIALIZED_STATUS);  /* This should get updated only when the guest call completes. */
    162172    testMsgAddReadData(&g_Client, VBOX_SHCL_FMT_UNICODETEXT);
    163173    RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA);
    164174    RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_UNICODETEXT);
    165175    RTTESTI_CHECK_RC_OK(call.rc);
    166     call.rc = VERR_TRY_AGAIN;
    167     table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    168     RTTESTI_CHECK_RC(call.rc, VERR_TRY_AGAIN);  /* This call should not complete yet. */
     176    call.rc = VERR_IPE_UNINITIALIZED_STATUS;
     177    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
     178    RTTESTI_CHECK_RC(call.rc, VERR_IPE_UNINITIALIZED_STATUS);  /* This call should not complete yet. */
     179    table.pfnDisconnect(NULL, 1 /* clientId */, &g_Client);
    169180
    170181    RTTestISub("Testing one format, no waiting guest calls.");
    171     shClSvcClientReset(&g_Client);
     182    table.pfnConnect(NULL, 1 /* clientId */, &g_Client, 0, 0);
    172183    testMsgAddReadData(&g_Client, VBOX_SHCL_FMT_HTML);
    173184    HGCMSvcSetU32(&parms[0], 0);
    174185    HGCMSvcSetU32(&parms[1], 0);
    175     call.rc = VERR_TRY_AGAIN;
     186    call.rc = VERR_IPE_UNINITIALIZED_STATUS;
    176187    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    177188    RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA);
    178189    RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_HTML);
    179190    RTTESTI_CHECK_RC_OK(call.rc);
    180     call.rc = VERR_TRY_AGAIN;
    181     table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    182     RTTESTI_CHECK_RC(call.rc, VERR_TRY_AGAIN);  /* This call should not complete yet. */
     191    call.rc = VERR_IPE_UNINITIALIZED_STATUS;
     192    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
     193    RTTESTI_CHECK_RC(call.rc, VERR_IPE_UNINITIALIZED_STATUS);  /* This call should not complete yet. */
     194    table.pfnDisconnect(NULL, 1 /* clientId */, &g_Client);
    183195
    184196    RTTestISub("Testing two formats, waiting guest call.");
    185     shClSvcClientReset(&g_Client); /** @todo r=bird: These reset calls are a little bogus... Especially since they don't do what you need them to anyway. */
    186     /** @todo r=bird: There is already a pending wait call here from 5 lines above.
    187      *        The code in 6.0 and earlier would overwrite the previous call, leaking
    188      *        HGCM resources.  6.1+ code rejects the 2nd call, completing it
    189      *        with VERR_RESOURCE_BUSY.  If any client depends on this (doubtful),
    190      *        we'll assert in debug builds. Need to fix the test and temporarily
    191      *        disble assertions around it. */
     197    table.pfnConnect(NULL, 1 /* clientId */, &g_Client, 0, 0);
    192198    HGCMSvcSetU32(&parms[0], 0);
    193199    HGCMSvcSetU32(&parms[1], 0);
    194     call.rc = VERR_TRY_AGAIN;
    195     table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    196     RTTESTI_CHECK_RC(call.rc, VERR_TRY_AGAIN);  /* This should get updated only when the guest call completes. */
     200    call.rc = VERR_IPE_UNINITIALIZED_STATUS;
     201    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
     202    RTTESTI_CHECK_RC(call.rc, VERR_IPE_UNINITIALIZED_STATUS);  /* This should get updated only when the guest call completes. */
    197203    testMsgAddReadData(&g_Client, VBOX_SHCL_FMT_UNICODETEXT | VBOX_SHCL_FMT_HTML);
    198     /** @todo r=bird: The 6.1+ is buggy in that it returns both
    199      *        VBOX_SHCL_FMT_UNICODETEXT and VBOX_SHCL_FMT_HTML here, rather than
    200      *        separating them.  This is relevant on OS X hosts where the host code
    201      *        would request both formats in one go, but since the clients will only
    202      *        handle one of them at the time, they need to be split up like the
    203      *        testcase checks for here.  (This is, btw, why it's nice to have
    204      *        interface testcases like this.  Good work Michael.) */
    205204    RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA);
    206205    RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_UNICODETEXT);
    207206    RTTESTI_CHECK_RC_OK(call.rc);
    208     call.rc = VERR_TRY_AGAIN;
     207    call.rc = VERR_IPE_UNINITIALIZED_STATUS;
    209208    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    210209    RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA);
    211210    RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_HTML);
    212211    RTTESTI_CHECK_RC_OK(call.rc);
    213     call.rc = VERR_TRY_AGAIN;
    214     table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    215     RTTESTI_CHECK_RC(call.rc, VERR_TRY_AGAIN);  /* This call should not complete yet. */
     212    call.rc = VERR_IPE_UNINITIALIZED_STATUS;
     213    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
     214    RTTESTI_CHECK_RC(call.rc, VERR_IPE_UNINITIALIZED_STATUS);  /* This call should not complete yet. */
     215    table.pfnDisconnect(NULL, 1 /* clientId */, &g_Client);
    216216
    217217    RTTestISub("Testing two formats, no waiting guest calls.");
    218     shClSvcClientReset(&g_Client);
     218    table.pfnConnect(NULL, 1 /* clientId */, &g_Client, 0, 0);
    219219    testMsgAddReadData(&g_Client, VBOX_SHCL_FMT_UNICODETEXT | VBOX_SHCL_FMT_HTML);
    220220    HGCMSvcSetU32(&parms[0], 0);
    221221    HGCMSvcSetU32(&parms[1], 0);
    222     call.rc = VERR_TRY_AGAIN;
    223     table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    224     RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA);
    225     /** @todo r=bird: Same problems with two formats as described above. */
     222    call.rc = VERR_IPE_UNINITIALIZED_STATUS;
     223    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
     224    RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA);
    226225    RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_UNICODETEXT);
    227226    RTTESTI_CHECK_RC_OK(call.rc);
    228     call.rc = VERR_TRY_AGAIN;
     227    call.rc = VERR_IPE_UNINITIALIZED_STATUS;
    229228    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    230229    RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA);
    231230    RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_HTML);
    232231    RTTESTI_CHECK_RC_OK(call.rc);
    233     call.rc = VERR_TRY_AGAIN;
    234     table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    235     RTTESTI_CHECK_RC(call.rc, VERR_TRY_AGAIN);  /* This call should not complete yet. */
     232    call.rc = VERR_IPE_UNINITIALIZED_STATUS;
     233    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
     234    RTTESTI_CHECK_RC(call.rc, VERR_IPE_UNINITIALIZED_STATUS);  /* This call should not complete yet. */
    236235    table.pfnDisconnect(NULL, 1 /* clientId */, &g_Client);
    237236    table.pfnUnload(NULL);
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