Changeset 60488 in vbox for trunk/src/VBox/ValidationKit/tests/usb/tdUsb1.py
- Timestamp:
- Apr 14, 2016 10:33:11 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/usb/tdUsb1.py
r59884 r60488 49 49 50 50 # USB gadget control import 51 import usbgadget ;51 import usbgadget2; 52 52 53 53 class tdUsbBenchmark(vbox.TestDriver): # pylint: disable=R0902 … … 65 65 kdGadgetParams = { 66 66 # The following is for local testing and not for the test lab. 67 #'adaris': { 68 # 'Low': ('beaglebone',), 69 # 'Full': ('beaglebone',), 70 # 'High': ('beaglebone',), 71 # 'Super': ('odroidxu3',) 72 #}, 67 73 'adaris': { 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 }, 73 'archusb': { 74 'Low': ('beaglebone', usbgadget.g_ksGadgetTypeBeaglebone), 75 'Full': ('beaglebone', usbgadget.g_ksGadgetTypeBeaglebone), 76 'High': ('beaglebone', usbgadget.g_ksGadgetTypeBeaglebone), 77 'Super': ('odroidxu3', usbgadget.g_ksGadgetTypeODroidXu3) 74 'Low': ('127.0.0.1', 0), 75 'Full': ('127.0.0.1', 0), 76 'High': ('127.0.0.1', 0), 77 'Super': ('127.0.0.1', 0) 78 78 }, 79 79 }; … … 105 105 self.cUsbReattachCycles = self.cUsbReattachCyclesDef; 106 106 self.sHostname = socket.gethostname().lower(); 107 self.fUseTxs = True;108 107 109 108 # … … 132 131 reporter.log(' --usb-reattach-cycles <cycles>'); 133 132 reporter.log(' Default: %s' % (self.cUsbReattachCyclesDef)); 134 reporter.log(' --local');135 reporter.log(' Don\'t use TXS for communication with the gadget but do everything');136 reporter.log(' on this host');137 133 return rc; 138 134 … … 200 196 raise base.InvalidOption('The "--usb-reattach-cycles" value "%s" is zero or negative.' \ 201 197 % (self.cUsbReattachCycles,)); 202 elif asArgs[iArg] == '--local':203 self.fUseTxs = False;204 198 else: 205 199 return vbox.TestDriver.parseOption(self, asArgs, iArg); … … 294 288 """ 295 289 # Get configured USB test devices from hostname we are running on 296 if self.fUseTxs is True: 297 sGadgetHost, sGadgetType = self.getGadgetParams(self.sHostname, sSpeed); 298 else: 299 sGadgetHost = 'dummy'; 300 sGadgetType = usbgadget.g_ksGadgetTypeDummyHcd; 301 302 # Create device filter 303 fRc = oSession.addUsbDeviceFilter('Compliance device', '0525', 'a4a0'); 290 sGadgetHost, _ = self.getGadgetParams(self.sHostname, sSpeed); 291 292 oUsbGadget = usbgadget2.UsbGadget(); 293 reporter.log('Connecting to UTS: ' + sGadgetHost); 294 fRc = oUsbGadget.connectTo(30 * 1000, sGadgetHost); 304 295 if fRc is True: 305 oUsbGadget = usbgadget.UsbGadget(); 306 reporter.log('Connecting to gadget: ' + sGadgetType); 307 fRc = oUsbGadget.connectTo(30 * 1000, sGadgetType, self.fUseTxs, sGadgetHost); 296 reporter.log('Connect succeeded'); 297 self.oVBox.host.addUSBDeviceSource('USBIP', sGadgetHost, sGadgetHost, [], []); 298 299 # Create device filter 300 fRc = oSession.addUsbDeviceFilter('Compliance device', '0525', 'a4a0'); 308 301 if fRc is True: 309 reporter.log('Connect succeeded'); 310 fRc = oUsbGadget.impersonate(usbgadget.g_ksGadgetImpersonationTest); 302 fRc = oUsbGadget.impersonate(usbgadget2.g_ksGadgetImpersonationTest); 311 303 if fRc is True: 312 304 313 305 # Wait a moment to let the USB device appear 314 self.sleep( 3);306 self.sleep(10); 315 307 316 308 tupCmdLine = ('UsbTest', ); … … 329 321 oUsbGadget.disconnectFrom(); 330 322 else: 331 reporter.testFailure('Failed to connect to USB gadget'); 323 reporter.testFailure('Failed to create USB device filter'); 324 325 self.oVBox.host.removeUSBDeviceSource(sGadgetHost); 332 326 else: 333 reporter.testFailure('Failed to c reate USB device filter');327 reporter.testFailure('Failed to connect to USB gadget'); 334 328 335 329 return fRc; … … 340 334 """ 341 335 # Get configured USB test devices from hostname we are running on 342 if self.fUseTxs is True: 343 sGadgetHost, sGadgetType = self.getGadgetParams(self.sHostname, sSpeed); 344 else: 345 sGadgetHost = 'dummy'; 346 sGadgetType = usbgadget.g_ksGadgetTypeDummyHcd; 347 348 # Create device filter 349 fRc = oSession.addUsbDeviceFilter('Compliance device', '0525', 'a4a0'); 336 sGadgetHost, _ = self.getGadgetParams(self.sHostname, sSpeed); 337 338 oUsbGadget = usbgadget2.UsbGadget(); 339 reporter.log('Connecting to UTS: ' + sGadgetHost); 340 fRc = oUsbGadget.connectTo(30 * 1000, sGadgetHost); 350 341 if fRc is True: 351 oUsbGadget = usbgadget.UsbGadget(); 352 reporter.log('Connecting to gadget: ' + sGadgetType); 353 fRc = oUsbGadget.connectTo(30 * 1000, sGadgetType, self.fUseTxs, sGadgetHost); 342 reporter.log('Connect succeeded'); 343 self.oVBox.host.addUSBDeviceSource('USBIP', sGadgetHost, sGadgetHost, [], []); 344 345 # Create device filter 346 fRc = oSession.addUsbDeviceFilter('Compliance device', '0525', 'a4a0'); 354 347 if fRc is True: 355 reporter.log('Connect succeeded'); 356 fRc = oUsbGadget.impersonate(usbgadget.g_ksGadgetImpersonationTest); 348 fRc = oUsbGadget.impersonate(usbgadget2.g_ksGadgetImpersonationTest); 357 349 if fRc is True: 358 350
Note:
See TracChangeset
for help on using the changeset viewer.