VirtualBox

Changeset 97275 in vbox for trunk/src/VBox/HostServices


Ignore:
Timestamp:
Oct 24, 2022 10:00:13 AM (2 years ago)
Author:
vboxsync
Message:

Shared Clipboard/testcase: Also enabled building reading host clipboard data from the guest side (also wrt overflow handling) with the HGCM mocking framework on Windows and Solaris. Also contains some Windows-related build adjustments.

Location:
trunk/src/VBox/HostServices/SharedClipboard/testcase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedClipboard/testcase/Makefile.kmk

    r97272 r97275  
    4040#       without #ifdef modifications to the core code!
    4141#
    42 PROGRAMS.linux += tstClipboardMockHGCM
    4342tstClipboardMockHGCM_TEMPLATE = VBOXR3TSTEXE
    4443tstClipboardMockHGCM_DEFS     = VBOX_WITH_HGCM VBOX_WITH_SHARED_CLIPBOARD
     
    5150tstClipboardMockHGCM_LIBS     = $(LIB_RUNTIME)
    5251
    53 if1of ($(KBUILD_TARGET), linux)
    54  tstClipboardMockHGCM_SOURCES.linux  += \
     52if1of ($(KBUILD_TARGET), linux solaris)
     53 PROGRAMS += tstClipboardMockHGCM
     54 tstClipboardMockHGCM_SOURCES += \
    5555        $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp \
    5656        ../VBoxSharedClipboardSvc-x11.cpp
    57  tstClipboardMockHGCM_LIBPATH = \
     57 tstClipboardMockHGCM_LIBPATH  = \
    5858        $(VBOX_LIBPATH_X11)
    59  tstClipboardMockHGCM_LIBS   += \
     59 tstClipboardMockHGCM_LIBS    += \
    6060        Xt \
    6161        X11
    6262endif
     63if1of ($(KBUILD_TARGET), win)
     64 PROGRAMS += tstClipboardMockHGCM
     65 tstClipboardMockHGCM_SOURCES += \
     66        $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-win.cpp \
     67        ../VBoxSharedClipboardSvc-win.cpp
     68endif
    6369
    64 tstClipboardMockHGCM_SOURCES.darwin += ../VBoxSharedClipboardSvc-darwin.cpp
    65 tstClipboardMockHGCM_SOURCES.win    += ../VBoxSharedClipboardSvc-win.cpp
    66 
    67 tstClipboardMockHGCM_CLEAN           = $(tstClipboardMockHGCM_0_OUTDIR)/tstClipboardMockHGCM.run
     70tstClipboardMockHGCM_CLEAN = $(tstClipboardMockHGCM_0_OUTDIR)/tstClipboardMockHGCM.run
    6871
    6972if defined(VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS)
  • trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardMockHGCM.cpp

    r97274 r97275  
    369369 * Test: Guest reading from host                                                                                                 *
    370370 ********************************************************************************************************************************/
    371 #if defined(RT_OS_LINUX)
     371#if defined (RT_OS_LINUX) || defined (RT_OS_SOLARIS)
    372372/* Called from SHCLX11 thread. */
    373373static DECLCALLBACK(int) tstTestReadFromHost_ReportFormatsCallback(PSHCLCONTEXT pCtx, uint32_t fFormats, void *pvUser)
     
    402402    return VINF_SUCCESS;
    403403}
    404 #endif /* RT_OS_LINUX */
     404#endif /* (RT_OS_LINUX) || defined (RT_OS_SOLARIS) */
    405405
    406406typedef struct TSTUSERMOCK
     
    475475          *      It in turn returns VINF_BUFFER_OVERFLOW when the supplied buffer was too small. */
    476476
    477         uint32_t cbChunk    = RTRandU32Ex(1, pTask->cbData / cChunkedReads);
     477        uint32_t cbChunk    = RTRandU32Ex(1, (uint32_t)(pTask->cbData / cChunkedReads));
    478478        uint32_t cbRead     = 0;
    479479        RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Guest trying to read %RU32 bytes\n", cbChunk);
     
    493493    RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Reading full data (%zu)\n", pTask->cbData);
    494494    uint32_t cbRead = 0;
    495     int vrc2 = VbglR3ClipboardReadData(pCmdCtx->idClient, pTask->enmFmtGst, pabDst, cbDst, &cbRead);
     495    int vrc2 = VbglR3ClipboardReadData(pCmdCtx->idClient, pTask->enmFmtGst, pabDst, (uint32_t)cbDst, &cbRead);
    496496    RTTEST_CHECK_MSG(g_hTest, vrc2 == VINF_SUCCESS, (g_hTest, "Got %Rrc, expected VINF_SUCCESS\n", vrc2));
    497497    RTTEST_CHECK_MSG(g_hTest, cbRead == cbToRead, (g_hTest, "Read %RU32 bytes, expected %zu\n", cbRead, cbToRead));
     
    554554    RT_NOREF(ppvCtx);
    555555
     556#if defined (RT_OS_LINUX) || defined (RT_OS_SOLARIS)
    556557    /* Initialize the Shared Clipboard backend callbacks. */
    557558    PSHCLBACKEND pBackend = ShClSvcGetBackend();
     
    562563    ShClCallbacks.pfnOnClipboardRead = tstTestReadFromHost_OnClipboardReadCallback;
    563564    ShClBackendSetCallbacks(pBackend, &ShClCallbacks);
     565#endif /* defined (RT_OS_LINUX) || defined (RT_OS_SOLARIS) */
    564566
    565567    /* Set the right clipboard mode, so that the guest can read from the host. */
     
    583585    pTask->cbData++; /* Add terminating zero. */
    584586#else
    585     pTask->pvData      = tstGenerateUtf16StringA(pTask->cbData / sizeof(RTUTF16));
     587    pTask->pvData      = tstGenerateUtf16StringA((uint32_t)(pTask->cbData / sizeof(RTUTF16)));
    586588    pTask->cbData     += sizeof(RTUTF16); /* Add terminating zero. */
    587589#endif
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