- Timestamp:
- Feb 9, 2015 8:21:45 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 98128
- Location:
- trunk/src/VBox/ValidationKit
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/vboxwrappers.py
r53415 r54118 1024 1024 fRc = False; 1025 1025 else: 1026 reporter.log('changed UsbHidto %s for "%s"' % (fEnable, self.sName));1026 reporter.log('changed OHCI to %s for "%s"' % (fEnable, self.sName)); 1027 1027 self.oTstDrv.processPendingEvents(); 1028 1028 return fRc; … … 1049 1049 else: 1050 1050 if self.fpApiVer >= 4.3: 1051 cEhciCtls = self.o.machine.getUSBControllerCountByType(vboxcon.USBControllerType_E CI);1051 cEhciCtls = self.o.machine.getUSBControllerCountByType(vboxcon.USBControllerType_EHCI); 1052 1052 if cEhciCtls == 1: 1053 1053 self.o.machine.RemoveUSBController('EHCI'); … … 1058 1058 fRc = False; 1059 1059 else: 1060 reporter.log('changed UsbHidto %s for "%s"' % (fEnable, self.sName));1060 reporter.log('changed EHCI to %s for "%s"' % (fEnable, self.sName)); 1061 1061 self.oTstDrv.processPendingEvents(); 1062 1062 return fRc; 1063 1063 1064 def enableUsbXhci(self, fEnable): 1065 """ 1066 Enables or disables the USB XHCI controller. Error information is logged. 1067 """ 1068 fRc = True; 1069 try: 1070 if fEnable: 1071 cXhciCtls = self.o.machine.getUSBControllerCountByType(vboxcon.USBControllerType_XHCI); 1072 if cXhciCtls == 0: 1073 self.o.machine.addUSBController('XHCI', vboxcon.USBControllerType_XHCI); 1074 else: 1075 cXhciCtls = self.o.machine.getUSBControllerCountByType(vboxcon.USBControllerType_XHCI); 1076 if cXhciCtls == 1: 1077 self.o.machine.RemoveUSBController('XHCI'); 1078 except: 1079 reporter.errorXcpt('failed to change XHCI to %s for "%s"' % (fEnable, self.sName)); 1080 fRc = False; 1081 else: 1082 reporter.log('changed XHCI to %s for "%s"' % (fEnable, self.sName)); 1083 self.oTstDrv.processPendingEvents(); 1084 return fRc; 1064 1085 1065 1086 def setFirmwareType(self, eType): -
trunk/src/VBox/ValidationKit/tests/usb/tdUsb1.py
r52776 r54118 34 34 import os; 35 35 import sys; 36 import socket; 36 37 37 38 # Only the main script needs to modify the path. … … 54 55 USB benchmark. 55 56 """ 57 58 # The available test devices 59 # 60 # The first key is the hostname of the host the test is running on. 61 # It contains a new dictionary with the attached gadgets based on the 62 # USB speed we want to test (Low, Full, High, Super). 63 # The parameters consist of the hostname of the gadget in the network 64 # and the hardware type. 65 kdGadgetParams = { 66 # The following is for local testing and not for the test lab. 67 'adaris': { 68 'Low': ('beaglebone', 'BeagleBoneBlack'), 69 'Full': ('beaglebone', 'BeagleBoneBlack'), 70 'High': ('beaglebone', 'BeagleBoneBlack'), 71 'Super': ('odroidxu3', 'ODroid-XU3') 72 }, 73 }; 74 75 # Mappings of USB controllers to supported USB device speeds. 76 kdUsbSpeedMappings = { 77 'OHCI': ['Low', 'Full'], 78 'EHCI': ['High'], 79 'XHCI': ['Low', 'Full', 'High', 'Super'] 80 }; 56 81 57 82 def __init__(self): … … 61 86 self.oGuestToGuestSess = None; 62 87 self.oGuestToGuestTxs = None; 63 self.asTestVMsDef = ['tst- debian', 'tst-arch'];88 self.asTestVMsDef = ['tst-arch']; 64 89 self.asTestVMs = self.asTestVMsDef; 65 90 self.asSkipVMs = []; 66 self.asVirtModesDef = ['hwvirt', 'hwvirt-np', 'raw' ,]67 self.asVirtModes = self.asVirtModesDef 68 self.acCpusDef = [1, 2,] 91 self.asVirtModesDef = ['hwvirt', 'hwvirt-np', 'raw']; 92 self.asVirtModes = self.asVirtModesDef; 93 self.acCpusDef = [1, 2,]; 69 94 self.acCpus = self.acCpusDef; 95 self.asUsbCtrlsDef = ['OHCI', 'EHCI', 'XHCI']; 96 self.asUsbCtrls = self.asUsbCtrlsDef; 97 self.asUsbSpeedDef = ['Low', 'Full', 'High', 'Super']; 98 self.asUsbSpeed = self.asUsbSpeedDef; 99 self.sHostname = socket.gethostname().lower(); 70 100 71 101 # … … 86 116 reporter.log(' --skip-vms <vm1[:vm2[:...]]>'); 87 117 reporter.log(' Skip the specified VMs when testing.'); 118 reporter.log(' --usb-ctrls <u1[:u2[:]]'); 119 reporter.log(' Default: %s' % (':'.join(str(c) for c in self.asUsbCtrlsDef))); 120 reporter.log(' --usb-speed <s1[:s2[:]]'); 121 reporter.log(' Default: %s' % (':'.join(str(c) for c in self.asUsbSpeedDef))); 88 122 return rc; 89 123 … … 121 155 if s not in self.asTestVMsDef: 122 156 reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s)); 157 elif asArgs[iArg] == '--usb-ctrls': 158 iArg += 1; 159 if iArg >= len(asArgs): raise base.InvalidOption('The "--usb-ctrls" takes a colon separated list of USB controllers'); 160 self.asUsbCtrls = asArgs[iArg].split(':'); 161 for s in self.asUsbCtrls: 162 if s not in self.asUsbCtrlsDef: 163 reporter.log('warning: The "--usb-ctrls" value "%s" is not a valid USB controller.' % (s)); 164 elif asArgs[iArg] == '--usb-speed': 165 iArg += 1; 166 if iArg >= len(asArgs): raise base.InvalidOption('The "--usb-speed" takes a colon separated list of USB speeds'); 167 self.asUsbSpeed = asArgs[iArg].split(':'); 168 for s in self.asUsbSpeed: 169 if s not in self.asUsbSpeedDef: 170 reporter.log('warning: The "--usb-speed" value "%s" is not a valid USB speed.' % (s)); 123 171 else: 124 172 return vbox.TestDriver.parseOption(self, asArgs, iArg); … … 137 185 if self.asRsrcs is None: 138 186 self.asRsrcs = []; 139 if 'tst-debian' in self.asTestVMs:140 self.asRsrcs.append('4.2/storage/debian.vdi');141 187 142 188 if 'tst-arch' in self.asTestVMs: … … 180 226 181 227 # Linux VMs 182 if 'tst-debian' in self.asTestVMs:183 oVM = self.createTestVM('tst-debian', 1, '4.2/storage/debian.vdi', sKind = 'Debian_64', fIoApic = True, \184 eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \185 sDvdImage = sVBoxValidationKit_iso);186 if oVM is None:187 return False;188 189 228 if 'tst-arch' in self.asTestVMs: 190 229 oVM = self.createTestVM('tst-arch', 1, '4.2/usb/tst-arch.vdi', sKind = 'ArchLinux_64', fIoApic = True, \ … … 203 242 return fRc; 204 243 244 def getGadgetParams(self, sHostname, sSpeed): 245 """ 246 Returns the gadget hostname and type from the 247 given hostname the test is running on and device speed we want to test. 248 """ 249 kdGadgetsConfigured = self.kdGadgetParams.get(sHostname); 250 if kdGadgetsConfigured is not None: 251 return kdGadgetsConfigured.get(sSpeed); 252 253 return None; 205 254 206 255 # 207 256 # Test execution helpers. 208 257 # 209 def testUsbCompliance(self, oSession, oTxsSession, sVmName): 210 """ 211 Test VirtualBoxs autostart feature in a VM. 212 """ 213 reporter.testStart('USB ' + sVmName); 258 def testUsbCompliance(self, oSession, oTxsSession, sVmName, sSpeed): 259 """ 260 Test VirtualBoxs USB stack in a VM. 261 """ 262 # Get configured USB test devices from hostname we are running on 263 sGadgetHost, sGadgetType = self.getGadgetParams(self.sHostname, sSpeed); 214 264 215 265 # Create device filter … … 217 267 if fRc is True: 218 268 oUsbGadget = UsbGadget(); 219 fRc = oUsbGadget.connectTo(30 * 1000, '192.168.2.213');269 fRc = oUsbGadget.connectTo(30 * 1000, sGadgetType, sGadgetHost); 220 270 if fRc is True: 221 271 fRc = oUsbGadget.impersonate('Test'); … … 223 273 224 274 # Wait a moment to let the USB device appear 225 self.sleep(2); 226 227 reporter.testStart('USB Test'); 228 229 fRc = self.txsRunTest(oTxsSession, 'USB compliance test', 240 * 1000, \ 275 self.sleep(3); 276 277 fRc = self.txsRunTest(oTxsSession, 'Compliance', 3600 * 1000, \ 230 278 '${CDROM}/${OS/ARCH}/UsbTest${EXESUFF}', ('UsbTest', )); 231 279 232 reporter.testDone();233 280 else: 234 281 reporter.testFailure('Failed to impersonate test device'); … … 240 287 reporter.testFailure('Failed to create USB device filter'); 241 288 242 reporter.testDone(not fRc); 243 return fRc; 244 245 def testUsbOneCfg(self, sVmName): 289 return fRc; 290 291 def testUsbOneCfg(self, sVmName, sUsbCtrl, sSpeed): 246 292 """ 247 293 Runs the specified VM thru test #1. … … 258 304 fRc = fRc and oSession.enableVirtEx(True); 259 305 fRc = fRc and oSession.enableNestedPaging(True); 260 fRc = fRc and oSession.enableUsbEhci(True); 306 307 # Make sure controllers are disabled initially. 308 fRc = fRc and oSession.enableUsbOhci(False); 309 fRc = fRc and oSession.enableUsbEhci(False); 310 fRc = fRc and oSession.enableUsbXhci(False); 311 312 if sUsbCtrl == 'OHCI': 313 fRc = fRc and oSession.enableUsbOhci(True); 314 elif sUsbCtrl == 'EHCI': 315 fRc = fRc and oSession.enableUsbEhci(True); 316 elif sUsbCtrl == 'XHCI': 317 fRc = fRc and oSession.enableUsbXhci(True); 261 318 fRc = fRc and oSession.saveSettings(); 262 319 fRc = oSession.close() and fRc and True; # pychecker hack. … … 275 332 self.sleep(5); 276 333 277 fRc = self.testUsbCompliance(oSession, oTxsSession, sVmName );334 fRc = self.testUsbCompliance(oSession, oTxsSession, sVmName, sSpeed); 278 335 279 336 # cleanup. … … 289 346 """ 290 347 reporter.testStart(sVmName); 291 fRc = True; 292 self.testUsbOneCfg(sVmName); 348 for sUsbCtrl in self.asUsbCtrls: 349 reporter.testStart(sUsbCtrl) 350 for sUsbSpeed in self.asUsbSpeed: 351 asSupportedSpeeds = self.kdUsbSpeedMappings.get(sUsbCtrl); 352 if sUsbSpeed in asSupportedSpeeds: 353 reporter.testStart(sUsbSpeed) 354 fRc = self.testUsbOneCfg(sVmName, sUsbCtrl, sUsbSpeed); 355 reporter.testDone(not fRc); 356 reporter.testDone(); 293 357 reporter.testDone(); 294 358 return fRc; … … 296 360 def testUsb(self): 297 361 """ 298 Executes autostart test. 299 """ 362 Executes USB test. 363 """ 364 365 reporter.log("Running on host: " + self.sHostname); 300 366 301 367 # Loop thru the test VMs. -
trunk/src/VBox/ValidationKit/tests/usb/usbgadget.py
r52776 r54118 45 45 self.oTxsSession = None; 46 46 self.sImpersonation = 'Invalid'; 47 self.sGadgetType = 'Invalid'; 47 48 48 49 def _loadModule(self, sModule): … … 55 56 if self.oTxsSession is not None: 56 57 fRc = self.oTxsSession.syncExecEx('/usr/bin/modprobe', ('/usr/bin/modprobe', sModule)); 58 # 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': 60 fRc = self.oTxsSession.syncExecEx('/usr/bin/sh', ('/usr/bin/sh', '-c', 'echo connect > /sys/class/udc/12400000.dwc3/soft_connect')); 57 61 58 62 return fRc; … … 66 70 fRc = False; 67 71 if self.oTxsSession is not None: 72 # For the ODroid-XU3 gadget we do a soft disconnect before unloading the gadget driver. 73 if self.sGadgetType == 'ODroid-XU3': 74 fRc = self.oTxsSession.syncExecEx('/usr/bin/sh', ('/usr/bin/sh', '-c', 'echo disconnect > /sys/class/udc/12400000.dwc3/soft_connect')); 68 75 fRc = self.oTxsSession.syncExecEx('/usr/bin/rmmod', ('/usr/bin/rmmod', sModule)); 69 76 … … 119 126 return False; 120 127 121 def connectTo(self, cMsTimeout, s Hostname, uPort = None):128 def connectTo(self, cMsTimeout, sGadgetType, sHostname, uPort = None): 122 129 """ 123 130 Connects to the specified target device. … … 139 146 fRc = False; 140 147 148 if fRc is True: 149 self.sGadgetType = sGadgetType; 150 141 151 return fRc; 142 152
Note:
See TracChangeset
for help on using the changeset viewer.