- Timestamp:
- Jan 28, 2020 3:52:02 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardServiceHost.cpp
r82887 r82890 5 5 6 6 /* 7 * Copyright (C) 2011-20 19Oracle Corporation7 * Copyright (C) 2011-2020 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 36 36 }; 37 37 38 /** Don't let assertions in the host service panic (core dump) the test cases. */ 39 RTDECL(bool) RTAssertShouldPanic(void) 40 { 41 #ifndef DEBUG_andy 42 return false; 43 #else 44 return true; 45 #endif 46 } 47 38 48 /** Call completion callback for guest calls. */ 39 49 static DECLCALLBACK(int) callComplete(VBOXHGCMCALLHANDLE callHandle, int32_t rc) … … 128 138 129 139 /* 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 */);140 static void testMsgAddReadData(PSHCLCLIENT pClient, SHCLFORMATS fFormats) 141 { 142 int rc = ShClSvcDataReadRequest(pClient, fFormats, NULL /* pidEvent */); 133 143 RTTESTI_CHECK_RC_OK(rc); 134 144 } … … 156 166 HGCMSvcSetU32(&parms[0], 0); 157 167 HGCMSvcSetU32(&parms[1], 0); 158 call.rc = VERR_ TRY_AGAIN;168 call.rc = VERR_IPE_UNINITIALIZED_STATUS; 159 169 table.pfnConnect(NULL, 1 /* clientId */, &g_Client, 0, 0); 160 170 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. */ 162 172 testMsgAddReadData(&g_Client, VBOX_SHCL_FMT_UNICODETEXT); 163 173 RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA); 164 174 RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_UNICODETEXT); 165 175 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); 169 180 170 181 RTTestISub("Testing one format, no waiting guest calls."); 171 shClSvcClientReset(&g_Client);182 table.pfnConnect(NULL, 1 /* clientId */, &g_Client, 0, 0); 172 183 testMsgAddReadData(&g_Client, VBOX_SHCL_FMT_HTML); 173 184 HGCMSvcSetU32(&parms[0], 0); 174 185 HGCMSvcSetU32(&parms[1], 0); 175 call.rc = VERR_ TRY_AGAIN;186 call.rc = VERR_IPE_UNINITIALIZED_STATUS; 176 187 table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0); 177 188 RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA); 178 189 RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_HTML); 179 190 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); 183 195 184 196 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); 192 198 HGCMSvcSetU32(&parms[0], 0); 193 199 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. */ 197 203 testMsgAddReadData(&g_Client, VBOX_SHCL_FMT_UNICODETEXT | VBOX_SHCL_FMT_HTML); 198 /** @todo r=bird: The 6.1+ is buggy in that it returns both199 * VBOX_SHCL_FMT_UNICODETEXT and VBOX_SHCL_FMT_HTML here, rather than200 * separating them. This is relevant on OS X hosts where the host code201 * would request both formats in one go, but since the clients will only202 * handle one of them at the time, they need to be split up like the203 * testcase checks for here. (This is, btw, why it's nice to have204 * interface testcases like this. Good work Michael.) */205 204 RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA); 206 205 RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_UNICODETEXT); 207 206 RTTESTI_CHECK_RC_OK(call.rc); 208 call.rc = VERR_ TRY_AGAIN;207 call.rc = VERR_IPE_UNINITIALIZED_STATUS; 209 208 table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0); 210 209 RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA); 211 210 RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_HTML); 212 211 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); 216 216 217 217 RTTestISub("Testing two formats, no waiting guest calls."); 218 shClSvcClientReset(&g_Client);218 table.pfnConnect(NULL, 1 /* clientId */, &g_Client, 0, 0); 219 219 testMsgAddReadData(&g_Client, VBOX_SHCL_FMT_UNICODETEXT | VBOX_SHCL_FMT_HTML); 220 220 HGCMSvcSetU32(&parms[0], 0); 221 221 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); 226 225 RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_UNICODETEXT); 227 226 RTTESTI_CHECK_RC_OK(call.rc); 228 call.rc = VERR_ TRY_AGAIN;227 call.rc = VERR_IPE_UNINITIALIZED_STATUS; 229 228 table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0); 230 229 RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA); 231 230 RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_HTML); 232 231 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. */ 236 235 table.pfnDisconnect(NULL, 1 /* clientId */, &g_Client); 237 236 table.pfnUnload(NULL);
Note:
See TracChangeset
for help on using the changeset viewer.