- Timestamp:
- Mar 19, 2012 11:43:47 AM (13 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxGuest
- Files:
-
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/Makefile.kmk
r40511 r40533 213 213 PROGRAMS += tstVBoxGuest-solaris 214 214 tstVBoxGuest-solaris_TEMPLATE = VBOXR3TSTEXE 215 tstVBoxGuest-solaris_SOURCES = \ 216 VBoxGuest-solaris-streams.c \ 217 testcase/tstVBoxGuest-solaris.cpp 215 tstVBoxGuest-solaris_SOURCES = VBoxGuest-solaris-streams.c 218 216 tstVBoxGuest-solaris_DEFS = TESTCASE 219 217 tstVBoxGuest-solaris_LIBS = $(LIB_RUNTIME) -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris-streams.c
r40501 r40533 51 51 #ifdef TESTCASE /* Include this last as we . */ 52 52 # include "testcase/solaris.h" 53 # include "testcase/tstVBoxGuest-solaris.h"53 # include <iprt/test.h> 54 54 #endif /* TESTCASE */ 55 55 … … 312 312 #ifdef TESTCASE 313 313 /** Simple test of the flow through _init. */ 314 void test_init(RTTEST hTest)314 static void test_init(RTTEST hTest) 315 315 { 316 316 RTTestSub(hTest, "Testing _init"); … … 474 474 #ifdef TESTCASE 475 475 /** Simple test of vbgr0SolOpen and vbgr0SolClose. */ 476 void testOpenClose(RTTEST hTest)476 static void testOpenClose(RTTEST hTest) 477 477 { 478 478 queue_t aQueues[4]; … … 538 538 return 0; 539 539 } 540 541 542 #ifdef TESTCASE 543 /** Test WPut's handling of different IOCtls, which is bulk of the logic in 544 * this file. */ 545 static void testWPut(RTTEST hTest) 546 { 547 queue_t aQueues[2]; 548 dev_t device = 0; 549 struct msgb MBlk, MBlkCont; 550 struct datab DBlk; 551 struct iocblk IOCBlk; 552 int rc, cFormat = 0; 553 554 /* Single simple test to start with. We can try to make it more systematic 555 * next. */ 556 RTTestSub(hTest, "Testing vbgr0WPut"); 557 RT_ZERO(aQueues); 558 doInitQueues(&aQueues[0]); 559 rc = vbgr0SolOpen(RD(&aQueues[0]), &device, 0, 0, NULL); 560 RTTEST_CHECK(hTest, rc == 0); 561 RTTEST_CHECK(hTest, g_aOpenNodeStates[1].pWriteQueue == WR(&aQueues[0])); 562 RT_ZERO(MBlk); 563 RT_ZERO(DBlk); 564 RT_ZERO(IOCBlk); 565 RT_ZERO(MBlkCont); 566 DBlk.db_type = M_IOCTL; 567 IOCBlk.ioc_cmd = VUIDSFORMAT; 568 IOCBlk.ioc_count = sizeof(int); 569 MBlkCont.b_rptr = (unsigned char *)&cFormat; 570 MBlkCont.b_rptr = (unsigned char *)&cFormat + sizeof(cFormat); 571 MBlk.b_cont = &MBlkCont; 572 MBlk.b_rptr = (unsigned char *)&IOCBlk; 573 MBlkCont.b_rptr = (unsigned char *)&IOCBlk + sizeof(IOCBlk); 574 MBlk.b_datap = &DBlk; 575 rc = vbgr0SolWPut(WR(&aQueues[0]), &MBlk); 576 RTTEST_CHECK(hTest, rc == 0); 577 vbgr0SolClose(RD(&aQueues[1]), 0, NULL); 578 } 579 #endif 540 580 541 581 … … 698 738 return vbgr0SolHandleIOCtlData(pWriteQueue, pMBlk, pfnHandler, cCmd, 699 739 cbTransparent, enmDirection); 700 else if (pIOCBlk->ioc_count == TRANSPARENT) 740 else if ( pMBlk->b_datap->db_type == M_IOCTL 741 && pIOCBlk->ioc_count == TRANSPARENT) 701 742 return vbgr0SolHandleTransparentIOCtl(pWriteQueue, pMBlk, pfnHandler, 702 743 cCmd, cbTransparent, 703 744 enmDirection); 704 else 745 else if (pMBlk->b_datap->db_type == M_IOCTL) 705 746 return vbgr0SolHandleIStrIOCtl(pWriteQueue, pMBlk, pfnHandler, cCmd); 747 return EINVAL; 706 748 } 707 749 … … 719 761 { 720 762 struct copyresp *pCopyResp = (struct copyresp *)pMBlk->b_rptr; 721 struct iocblk *pIOCBlk = (struct iocblk *)pMBlk->b_rptr;722 763 PVBGR0STATE pState = (PVBGR0STATE)pWriteQueue->q_ptr; 723 764 724 if (pCopyResp->cp_rval) 765 if (pCopyResp->cp_rval) /* cp_rval is a pointer used as a boolean. */ 725 766 { 726 767 freemsg(pMBlk); 727 return EAGAIN; /* cp_rval is a pointer but should be the error. */768 return EAGAIN; 728 769 } 729 770 if ((pCopyResp->cp_private && enmDirection == BOTH) || enmDirection == IN) 730 771 { 731 size_t cb Buffer = pIOCBlk->ioc_count, cbData = 0;772 size_t cbData = 0; 732 773 void *pvData = NULL; 733 774 int err; … … 740 781 return EINVAL; 741 782 pvData = pMBlk->b_cont->b_rptr; 742 err = pfnHandler(pState, cCmd, pvData, cb Buffer, &cbData, NULL);783 err = pfnHandler(pState, cCmd, pvData, cbTransparent, &cbData, NULL); 743 784 if (!err && enmDirection == BOTH) 744 785 mcopyout(pMBlk, NULL, cbData, pCopyResp->cp_private, NULL); … … 1368 1409 # include "VBoxGuestIDC-unix.c.h" 1369 1410 #endif 1411 1412 #ifdef TESTCASE 1413 int main(void) 1414 { 1415 RTTEST hTest; 1416 int rc = RTTestInitAndCreate("tstVBoxGuest-solaris", &hTest); 1417 if (rc) 1418 return rc; 1419 RTTestBanner(hTest); 1420 test_init(hTest); 1421 testOpenClose(hTest); 1422 testWPut(hTest); 1423 1424 /* 1425 * Summary. 1426 */ 1427 return RTTestSummaryAndDestroy(hTest); 1428 } 1429 #endif -
trunk/src/VBox/Additions/common/VBoxGuest/testcase/solaris.h
r40501 r40533 221 221 unsigned char db_ref; 222 222 unsigned char db_type; 223 } d lk_t;223 } dblk_t; 224 224 225 225 struct iocblk
Note:
See TracChangeset
for help on using the changeset viewer.