Changeset 70761 in vbox for trunk/src/VBox/ValidationKit/utils/serial/SerialTest.cpp
- Timestamp:
- Jan 28, 2018 8:19:53 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/serial/SerialTest.cpp
r70652 r70761 138 138 139 139 static DECLCALLBACK(int) serialTestRunReadWrite(PSERIALTEST pSerialTest); 140 static DECLCALLBACK(int) serialTestRunWrite(PSERIALTEST pSerialTest); 140 141 141 142 /** Implemented tests. */ 142 143 static const SERIALTESTDESC g_aSerialTests[] = 143 144 { 144 {"readwrite", "Simple Read/Write test", serialTestRunReadWrite } 145 {"readwrite", "Simple Read/Write test on the same serial port", serialTestRunReadWrite }, 146 {"write", "Simple write test (verification done somewhere else)", serialTestRunWrite }, 145 147 }; 146 148 … … 364 366 if ( RT_SUCCESS(rc) 365 367 && (fEvts & RTSERIALPORT_EVT_F_DATA_TX)) 368 rc = serialTestTxBufSend(pSerialTest->hSerialPort, &SerBufTx); 369 } 370 371 uint64_t tsRuntime = RTTimeMilliTS() - tsStart; 372 tsRuntime /= 1000; /* Seconds */ 373 RTTestValue(pSerialTest->hTest, "Throughput", g_cbTx / tsRuntime, RTTESTUNIT_BYTES_PER_SEC); 374 375 return rc; 376 } 377 378 379 /** 380 * Runs a simple write test without doing any verification. 381 * 382 * @returns IPRT status code. 383 * @param pSerialTest The serial test configuration. 384 */ 385 static DECLCALLBACK(int) serialTestRunWrite(PSERIALTEST pSerialTest) 386 { 387 uint64_t tsStart = RTTimeMilliTS(); 388 SERIALTESTTXRXBUFCNT SerBufTx; 389 390 serialTestTxBufInit(&SerBufTx, g_cbTx); 391 392 int rc = serialTestTxBufSend(pSerialTest->hSerialPort, &SerBufTx); 393 while ( RT_SUCCESS(rc) 394 && SerBufTx.cbTxRxLeft) 395 { 396 uint32_t fEvts = 0; 397 398 rc = RTSerialPortEvtPoll(pSerialTest->hSerialPort, RTSERIALPORT_EVT_F_DATA_TX, &fEvts, RT_INDEFINITE_WAIT); 399 if (RT_FAILURE(rc)) 400 break; 401 402 if (fEvts & RTSERIALPORT_EVT_F_DATA_TX) 366 403 rc = serialTestTxBufSend(pSerialTest->hSerialPort, &SerBufTx); 367 404 } … … 645 682 { 646 683 RTTestSub(g_hTest, "Setting serial port configuration for loopback device"); 647 rc = RTSerialPortCfgSet(g_hSerialPortLoopback, &g_SerialPortCfg ,NULL);684 rc = RTSerialPortCfgSet(g_hSerialPortLoopback, &g_SerialPortCfg, NULL); 648 685 if (RT_FAILURE(rc)) 649 686 RTTestFailed(g_hTest, "Setting configuration of loopback device \"%s\" failed with %Rrc\n", pszDevice, rc);
Note:
See TracChangeset
for help on using the changeset viewer.