- Timestamp:
- Nov 29, 2015 5:06:00 PM (9 years ago)
- Location:
- trunk/src/VBox/ValidationKit
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/usb/tdUsb1.py
r58899 r58907 49 49 50 50 # USB gadget control import 51 from usbgadget import UsbGadget;51 import usbgadget; 52 52 53 53 class tdUsbBenchmark(vbox.TestDriver): # pylint: disable=R0902 … … 66 66 # The following is for local testing and not for the test lab. 67 67 'adaris': { 68 'Low': ('beaglebone', 'BeagleBoneBlack'),69 'Full': ('beaglebone', 'BeagleBoneBlack'),70 'High': ('beaglebone', 'BeagleBoneBlack'),71 'Super': ('odroidxu3', 'ODroid-XU3')68 'Low': ('beaglebone', usbgadget.g_ksGadgetTypeBeaglebone), 69 'Full': ('beaglebone', usbgadget.g_ksGadgetTypeBeaglebone), 70 'High': ('beaglebone', usbgadget.g_ksGadgetTypeBeaglebone), 71 'Super': ('odroidxu3', usbgadget.g_ksGadgetTypeODroidXu3) 72 72 }, 73 73 'archusb': { 74 'Low': (' odroidxu3', 'ODroid-XU3'),75 'Full': (' odroidxu3', 'ODroid-XU3'),76 'High': (' odroidxu3', 'ODroid-XU3'),77 'Super': ('odroidxu3', 'ODroid-XU3')74 'Low': ('beaglebone', usbgadget.g_ksGadgetTypeBeaglebone), 75 'Full': ('beaglebone', usbgadget.g_ksGadgetTypeBeaglebone), 76 'High': ('beaglebone', usbgadget.g_ksGadgetTypeBeaglebone), 77 'Super': ('odroidxu3', usbgadget.g_ksGadgetTypeODroidXu3) 78 78 }, 79 79 }; … … 89 89 vbox.TestDriver.__init__(self); 90 90 self.asRsrcs = None; 91 self.oGuestToGuestVM = None;92 self.oGuestToGuestSess = None;93 self.oGuestToGuestTxs = None;94 91 self.asTestVMsDef = ['tst-arch']; 95 92 self.asTestVMs = self.asTestVMsDef; … … 262 259 # Test execution helpers. 263 260 # 264 def testUsbCompliance(self, oSession, oTxsSession, s Speed):261 def testUsbCompliance(self, oSession, oTxsSession, sUsbCtrl, sSpeed): 265 262 """ 266 263 Test VirtualBoxs USB stack in a VM. … … 272 269 fRc = oSession.addUsbDeviceFilter('Compliance device', '0525', 'a4a0'); 273 270 if fRc is True: 274 oUsbGadget = UsbGadget(); 271 oUsbGadget = usbgadget.UsbGadget(); 272 reporter.log('Connecting to gadget: ' + sGadgetType); 275 273 fRc = oUsbGadget.connectTo(30 * 1000, sGadgetType, sGadgetHost); 276 274 if fRc is True: 277 fRc = oUsbGadget.impersonate('Test'); 275 reporter.log('Connect succeeded'); 276 fRc = oUsbGadget.impersonate(usbgadget.g_ksGadgetImpersonationTest); 278 277 if fRc is True: 279 278 … … 281 280 self.sleep(3); 282 281 282 tupCmdLine = ('UsbTest', ); 283 # Exclude a few tests which hang and cause a timeout, need investigation. 284 if sUsbCtrl is 'XHCI': 285 tupCmdLine = tupCmdLine + ('--exclude', '10', '--exclude', '24'); 286 283 287 fRc = self.txsRunTest(oTxsSession, 'Compliance', 3600 * 1000, \ 284 '${CDROM}/${OS/ARCH}/UsbTest${EXESUFF}', ('UsbTest', ));288 '${CDROM}/${OS/ARCH}/UsbTest${EXESUFF}', tupCmdLine); 285 289 286 290 else: … … 338 342 self.sleep(5); 339 343 340 fRc = self.testUsbCompliance(oSession, oTxsSession, s Speed);344 fRc = self.testUsbCompliance(oSession, oTxsSession, sUsbCtrl, sSpeed); 341 345 342 346 # cleanup. … … 359 363 reporter.testStart(sUsbSpeed) 360 364 fRc = self.testUsbOneCfg(sVmName, sUsbCtrl, sUsbSpeed); 361 reporter.testDone( not fRc);365 reporter.testDone(); 362 366 reporter.testDone(); 363 367 reporter.testDone(); … … 374 378 for sVM in self.asTestVMs: 375 379 # run test on the VM. 376 if not self.testUsbForOneVM(sVM): 377 fRc = False; 378 else: 379 fRc = True; 380 fRc = self.testUsbForOneVM(sVM); 380 381 381 382 return fRc; -
trunk/src/VBox/ValidationKit/tests/usb/usbgadget.py
r56295 r58907 35 35 import testdriver.reporter as reporter; 36 36 37 ## @name USB gadget type string constants. 38 ## @{ 39 g_ksGadgetTypeInvalid = 'Invalid'; 40 g_ksGadgetTypeBeaglebone = 'BeagleBone'; 41 g_ksGadgetTypeODroidXu3 = 'ODroidXu3'; 42 ## @} 43 44 ## @name USB gadget imeprsonation string constants. 45 ## @{ 46 g_ksGadgetImpersonationInvalid = 'Invalid'; 47 g_ksGadgetImpersonationTest = 'Test'; 48 g_ksGadgetImpersonationMsd = 'Msd'; 49 g_ksGadgetImpersonationWebcam = 'Webcam'; 50 g_ksGadgetImpersonationEther = 'Ether'; 51 ## @} 52 37 53 class UsbGadget(object): 38 54 """ … … 44 60 def __init__(self): 45 61 self.oTxsSession = None; 46 self.sImpersonation = 'Invalid';47 self.sGadgetType = 'Invalid';62 self.sImpersonation = g_ksGadgetImpersonationInvalid; 63 self.sGadgetType = g_ksGadgetTypeInvalid; 48 64 49 65 def _loadModule(self, sModule): … … 57 73 fRc = self.oTxsSession.syncExecEx('/usr/bin/modprobe', ('/usr/bin/modprobe', sModule)); 58 74 # For the ODroid-XU3 gadget we have to do a soft connect for the attached host to recognise the device. 59 if self.sGadgetType == 'ODroid-XU3':75 if self.sGadgetType == g_ksGadgetTypeODroidXu3: 60 76 fRc = self.oTxsSession.syncExecEx('/usr/bin/sh', \ 61 77 ('/usr/bin/sh', '-c', 'echo connect > /sys/class/udc/12400000.dwc3/soft_connect')); 62 78 elif self.sGadgetType == g_ksGadgetTypeBeaglebone: 79 # Do a soft disconnect/reconnect cycle or the device will not be recognised as high speed after the first test. 80 fRc = self.oTxsSession.syncExecEx('/usr/bin/sh', \ 81 ('/usr/bin/sh', '-c', 'echo disconnect > /sys/class/udc/musb-hdrc.0.auto/soft_connect')); 82 if fRc: 83 fRc = self.oTxsSession.syncExecEx('/usr/bin/sh', \ 84 ('/usr/bin/sh', '-c', 'echo connect > /sys/class/udc/musb-hdrc.0.auto/soft_connect')); 63 85 return fRc; 64 86 … … 72 94 if self.oTxsSession is not None: 73 95 # For the ODroid-XU3 gadget we do a soft disconnect before unloading the gadget driver. 74 if self.sGadgetType == 'ODroid-XU3':96 if self.sGadgetType == g_ksGadgetTypeODroidXu3: 75 97 fRc = self.oTxsSession.syncExecEx('/usr/bin/sh', \ 76 98 ('/usr/bin/sh', '-c', 'echo disconnect > /sys/class/udc/12400000.dwc3/soft_connect')); 99 elif self.sGadgetType == g_ksGadgetTypeBeaglebone: 100 fRc = self.oTxsSession.syncExecEx('/usr/bin/sh', \ 101 ('/usr/bin/sh', '-c', 'echo disconnect > /sys/class/udc/musb-hdrc.0.auto/soft_connect')); 102 77 103 fRc = self.oTxsSession.syncExecEx('/usr/bin/rmmod', ('/usr/bin/rmmod', sModule)); 78 104 … … 83 109 Removes the current impersonation of the gadget. 84 110 """ 85 if self.sImpersonation == 'Invalid':111 if self.sImpersonation == g_ksGadgetImpersonationInvalid: 86 112 self._unloadModule('g_zero'); 87 113 self._unloadModule('g_mass_storage'); … … 89 115 self._unloadModule('g_ether'); 90 116 return True; 91 elif self.sImpersonation == 'Test':117 elif self.sImpersonation == g_ksGadgetImpersonationTest: 92 118 return self._unloadModule('g_zero'); 93 elif self.sImpersonation == 'Msd':119 elif self.sImpersonation == g_ksGadgetImpersonationMsd: 94 120 return self._unloadModule('g_mass_storage'); 95 elif self.sImpersonation == 'Webcam':121 elif self.sImpersonation == g_ksGadgetImpersonationWebcam: 96 122 return self._unloadModule('g_webcam'); 97 elif self.sImpersonation == 'Network':123 elif self.sImpersonation == g_ksGadgetImpersonationEther: 98 124 return self._unloadModule('g_ether'); 99 125 else: … … 111 137 self.sImpersonation = sImpersonation; 112 138 113 if sImpersonation == 'Invalid':139 if sImpersonation == g_ksGadgetImpersonationInvalid: 114 140 return False; 115 elif sImpersonation == 'Test':141 elif sImpersonation == g_ksGadgetImpersonationTest: 116 142 return self._loadModule('g_zero'); 117 elif sImpersonation == 'Msd':143 elif sImpersonation == g_ksGadgetImpersonationMsd: 118 144 # @todo: Not complete 119 145 return self._loadModule('g_mass_storage'); 120 elif sImpersonation == 'Webcam':146 elif sImpersonation == g_ksGadgetImpersonationWebcam: 121 147 # @todo: Not complete 122 148 return self._loadModule('g_webcam'); 123 elif sImpersonation == 'Network':149 elif sImpersonation == g_ksGadgetImpersonationEther: 124 150 return self._loadModule('g_ether'); 125 151 else: -
trunk/src/VBox/ValidationKit/utils/usb/UsbTest.cpp
r57358 r58907 56 56 *********************************************************************************************************************************/ 57 57 58 /** Number of tests implemented at the moment. */59 #define USBTEST_TEST_CASES 2560 61 62 58 /********************************************************************************************************************************* 63 59 * Structures and Typedefs * … … 121 117 { 122 118 {"--device", 'd', RTGETOPT_REQ_STRING }, 123 {"--help", 'h', RTGETOPT_REQ_NOTHING} 119 {"--help", 'h', RTGETOPT_REQ_NOTHING}, 120 {"--exclude", 'e', RTGETOPT_REQ_UINT32} 124 121 }; 125 122 126 /** (Sort of) Descriptive test descriptions. */ 127 static const char *g_apszTests[] = 128 { 129 "NOP", 130 "Non-queued Bulk write", 131 "Non-queued Bulk read", 132 "Non-queued Bulk write variabe size", 133 "Non-queued Bulk read variabe size", 134 "Queued Bulk write", 135 "Queued Bulk read", 136 "Queued Bulk write variabe size", 137 "Queued Bulk read variabe size", 138 "Chapter 9 Control Test", 139 "Queued control messaging", 140 "Unlink reads", 141 "Unlink writes", 142 "Set/Clear halts", 143 "Control writes", 144 "Isochronous write", 145 "Isochronous read", 146 "Bulk write unaligned (DMA)", 147 "Bulk read unaligned (DMA)", 148 "Bulk write unaligned (no DMA)", 149 "Bulk read unaligned (no DMA)", 150 "Control writes unaligned", 151 "Isochronous write unaligned", 152 "Isochronous read unaligned", 153 "Unlink queued Bulk" 123 /** 124 * USB test descriptor. 125 */ 126 typedef struct USBTESTDESC 127 { 128 /** (Sort of) Descriptive test name. */ 129 const char *pszName; 130 /** Flag whether the test is excluded. */ 131 bool fExcluded; 132 } USBTESTDESC; 133 /** Pointer a USB test descriptor. */ 134 typedef USBTESTDESC *PUSBTESTDESC; 135 136 static USBTESTDESC g_aTests[] = 137 { 138 /* pszTest fExcluded */ 139 {"NOP", false}, 140 {"Non-queued Bulk write", false}, 141 {"Non-queued Bulk read", false}, 142 {"Non-queued Bulk write variabe size", false}, 143 {"Non-queued Bulk read variabe size", false}, 144 {"Queued Bulk write", false}, 145 {"Queued Bulk read", false}, 146 {"Queued Bulk write variabe size", false}, 147 {"Queued Bulk read variabe size", false}, 148 {"Chapter 9 Control Test", false}, 149 {"Queued control messaging", false}, 150 {"Unlink reads", false}, 151 {"Unlink writes", false}, 152 {"Set/Clear halts", false}, 153 {"Control writes", false}, 154 {"Isochronous write", false}, 155 {"Isochronous read", false}, 156 {"Bulk write unaligned (DMA)", false}, 157 {"Bulk read unaligned (DMA)", false}, 158 {"Bulk write unaligned (no DMA)", false}, 159 {"Bulk read unaligned (no DMA)", false}, 160 {"Control writes unaligned", false}, 161 {"Isochronous write unaligned", false}, 162 {"Isochronous read unaligned", false}, 163 {"Unlink queued Bulk", false} 154 164 }; 155 AssertCompile(RT_ELEMENTS(g_apszTests) == USBTEST_TEST_CASES);156 165 157 166 /** The test handle. */ … … 178 187 case 'd': 179 188 pszHelp = "Use the specified test device"; 189 break; 190 case 'e': 191 pszHelp = "Exclude the given test id from the list"; 180 192 break; 181 193 default: … … 289 301 Params.cSgLength = 32; 290 302 291 for (unsigned i = 0; i < USBTEST_TEST_CASES; i++)303 for (unsigned i = 0; i < RT_ELEMENTS(g_aTests); i++) 292 304 { 293 RTTestSub(g_hTest, g_apszTests[i]); 305 RTTestSub(g_hTest, g_aTests[i].pszName); 306 307 if (g_aTests[i].fExcluded) 308 { 309 RTTestSkipped(g_hTest, "Excluded from list"); 310 continue; 311 } 294 312 295 313 Params.idxTest = i; … … 347 365 pszDevice = ValueUnion.psz; 348 366 break; 367 case 'e': 368 if (ValueUnion.u32 < RT_ELEMENTS(g_aTests)) 369 g_aTests[ValueUnion.u32].fExcluded = true; 370 else 371 { 372 RTTestPrintf(g_hTest, RTTESTLVL_FAILURE, "Failed to find a test device\n"); 373 RTTestErrorInc(g_hTest); 374 return RTGetOptPrintError(VERR_INVALID_PARAMETER, &ValueUnion); 375 } 376 break; 349 377 default: 350 378 return RTGetOptPrintError(rc, &ValueUnion);
Note:
See TracChangeset
for help on using the changeset viewer.