Changeset 60522 in vbox for trunk/src/VBox/ValidationKit/tests
- Timestamp:
- Apr 15, 2016 2:34:35 PM (9 years ago)
- Location:
- trunk/src/VBox/ValidationKit/tests/usb
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/usb/tdUsb1.py
r60493 r60522 64 64 # and the hardware type. 65 65 kdGadgetParams = { 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 #},73 66 'adaris': { 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)67 'Low': ('usbtest.de.oracle.com', None), 68 'Full': ('usbtest.de.oracle.com', None), 69 'High': ('usbtest.de.oracle.com', None), 70 'Super': ('usbtest.de.oracle.com', None) 78 71 }, 79 72 }; … … 105 98 self.cUsbReattachCycles = self.cUsbReattachCyclesDef; 106 99 self.sHostname = socket.gethostname().lower(); 100 self.sGadgetHostnameDef = 'usbtest.de.oracle.com'; 101 self.uGadgetPortDef = None; 107 102 108 103 # … … 131 126 reporter.log(' --usb-reattach-cycles <cycles>'); 132 127 reporter.log(' Default: %s' % (self.cUsbReattachCyclesDef)); 128 reporter.log(' --hostname: <hostname>'); 129 reporter.log(' Default: %s' % (self.sHostname)); 130 reporter.log(' --default-gadget-host <hostname>'); 131 reporter.log(' Default: %s' % (self.sGadgetHostnameDef)); 132 reporter.log(' --default-gadget-port <port>'); 133 reporter.log(' Default: %s' % (6042)); 133 134 return rc; 134 135 … … 196 197 raise base.InvalidOption('The "--usb-reattach-cycles" value "%s" is zero or negative.' \ 197 198 % (self.cUsbReattachCycles,)); 199 elif asArgs[iArg] == '--hostname': 200 iArg += 1; 201 if iArg >= len(asArgs): raise base.InvalidOption('The "--hostname" takes a hostname'); 202 self.sHostname = asArgs[iArg]; 203 elif asArgs[iArg] == '--default-gadget-host': 204 iArg += 1; 205 if iArg >= len(asArgs): raise base.InvalidOption('The "--default-gadget-host" takes a hostname'); 206 self.sGadgetHostnameDef = asArgs[iArg]; 207 elif asArgs[iArg] == '--default-gadget-port': 208 iArg += 1; 209 if iArg >= len(asArgs): raise base.InvalidOption('The "--default-gadget-port" takes port number'); 210 try: self.uGadgetPortDef = int(asArgs[iArg]); 211 except: raise base.InvalidOption('The "--default-gadget-port" value "%s" is not an integer' \ 212 % (asArgs[iArg],)); 213 if self.uGadgetPortDef <= 0: 214 raise base.InvalidOption('The "--default-gadget-port" value "%s" is zero or negative.' \ 215 % (self.uGadgetPortDef,)); 198 216 else: 199 217 return vbox.TestDriver.parseOption(self, asArgs, iArg); … … 271 289 def getGadgetParams(self, sHostname, sSpeed): 272 290 """ 273 Returns the gadget hostname and typefrom the291 Returns the gadget hostname and port from the 274 292 given hostname the test is running on and device speed we want to test. 275 293 """ … … 278 296 return kdGadgetsConfigured.get(sSpeed); 279 297 280 return ( None, None);298 return (self.sGadgetHostnameDef, self.uGadgetPortDef); 281 299 282 300 # … … 288 306 """ 289 307 # Get configured USB test devices from hostname we are running on 290 sGadgetHost, _= self.getGadgetParams(self.sHostname, sSpeed);308 sGadgetHost, uGadgetPort = self.getGadgetParams(self.sHostname, sSpeed); 291 309 292 310 oUsbGadget = usbgadget2.UsbGadget(); 293 311 reporter.log('Connecting to UTS: ' + sGadgetHost); 294 fRc = oUsbGadget.connectTo(30 * 1000, sGadgetHost );312 fRc = oUsbGadget.connectTo(30 * 1000, sGadgetHost, uPort = uGadgetPort); 295 313 if fRc is True: 296 314 reporter.log('Connect succeeded'); -
trunk/src/VBox/ValidationKit/tests/usb/tst-utsgadget.py
r60488 r60522 37 37 sys.path.insert(0, '.'); 38 38 sys.path.insert(0, '..'); 39 sys.path.insert(0, '../..'); 39 40 import usbgadget2 as usbgadget; 40 41 import testdriver.reporter as reporter … … 98 99 99 100 if fStdTests: 101 if oGadget.getUsbIpPort() is not None: 102 rc = True; 103 else: 104 rc = False; 105 print '%s: getUsbIpPort() -> %s' % (boolRes(rc), oGadget.getUsbIpPort()); 100 106 107 rc = oGadget.impersonate(usbgadget.g_ksGadgetImpersonationTest); 108 print '%s: impersonate()' % (boolRes(rc)); 109 110 rc = oGadget.disconnectUsb(); 111 print '%s: disconnectUsb()' % (boolRes(rc)); 112 113 rc = oGadget.connectUsb(); 114 print '%s: connectUsb()' % (boolRes(rc)); 115 116 rc = oGadget.clearImpersonation(); 117 print '%s: clearImpersonation()' % (boolRes(rc)); 101 118 102 119 # Done 103 120 rc = oGadget.disconnectFrom(); 104 print '%s: disconnect () -> %s' % (boolRes(rc), rc);121 print '%s: disconnectFrom() -> %s' % (boolRes(rc), rc); 105 122 106 123 if g_cFailures != 0: -
trunk/src/VBox/ValidationKit/tests/usb/usbgadget2.py
r60493 r60522 758 758 def taskGadgetDestroy(self, iGadgetId): 759 759 """Destroys the given gadget handle on UTS""" 760 fRc = self.sendMsg("GDGTDTOR", (iGadgetId, ));760 fRc = self.sendMsg("GDGTDTOR", (iGadgetId, zeroByteArray(12))); 761 761 if fRc is True: 762 762 fRc = self.recvAckLogged("GDGTDTOR"); … … 765 765 def taskGadgetConnect(self, iGadgetId): 766 766 """Connects the given gadget handle on UTS""" 767 fRc = self.sendMsg("GDGTCNCT", (iGadgetId, ));767 fRc = self.sendMsg("GDGTCNCT", (iGadgetId, zeroByteArray(12))); 768 768 if fRc is True: 769 769 fRc = self.recvAckLogged("GDGTCNCT"); … … 772 772 def taskGadgetDisconnect(self, iGadgetId): 773 773 """Disconnects the given gadget handle from UTS""" 774 fRc = self.sendMsg("GDGTDCNT", (iGadgetId, ));774 fRc = self.sendMsg("GDGTDCNT", (iGadgetId, zeroByteArray(12))); 775 775 if fRc is True: 776 776 fRc = self.recvAckLogged("GDGTDCNT"); … … 877 877 """ 878 878 return self.startTask(cMsTimeout, fIgnoreErrors, "GadgetConnect", self.taskGadgetConnect, \ 879 ( long(iGadgetId), ));879 (iGadgetId, )); 880 880 881 881 def syncGadgetConnect(self, iGadgetId, cMsTimeout = 30000, fIgnoreErrors = False): … … 892 892 """ 893 893 return self.startTask(cMsTimeout, fIgnoreErrors, "GadgetDisconnect", self.taskGadgetDisconnect, \ 894 ( long(iGadgetId), ));894 (iGadgetId, )); 895 895 896 896 def syncGadgetDisconnect(self, iGadgetId, cMsTimeout = 30000, fIgnoreErrors = False): … … 1297 1297 self.iUsbIpPort = None; 1298 1298 1299 def _clearImpersonation(self):1299 def clearImpersonation(self): 1300 1300 """ 1301 1301 Removes the current impersonation of the gadget. … … 1305 1305 if self.idGadget is not None: 1306 1306 fRc = self.oUtsSession.syncGadgetDestroy(self.idGadget); 1307 self.idGadget = None; 1307 1308 1308 1309 return fRc; … … 1327 1328 1328 1329 # Clear any previous impersonation 1329 self. _clearImpersonation();1330 self.clearImpersonation(); 1330 1331 self.sImpersonation = sImpersonation; 1331 1332 1332 1333 fRc = False; 1333 1334 if sImpersonation == g_ksGadgetImpersonationTest: 1334 fRc = self.oUtsSession.syncGadgetCreate(g_kiGadgetTypeTest, g_kiGadgetAccessUsbIp); 1335 fDone = self.oUtsSession.syncGadgetCreate(g_kiGadgetTypeTest, g_kiGadgetAccessUsbIp); 1336 if fDone is True and self.oUtsSession.isSuccess(): 1337 # Get the gadget ID. 1338 _, _, abPayload = self.oUtsSession.getLastReply(); 1339 1340 fRc = True; 1341 self.idGadget = getU32(abPayload, 16); 1335 1342 else: 1336 1343 reporter.log('Invalid or unsupported impersonation'); … … 1388 1395 fRc = True; 1389 1396 1390 self. _clearImpersonation();1397 self.clearImpersonation(); 1391 1398 if self.oUtsSession is not None: 1392 1399 fRc = self.oUtsSession.syncDisconnect();
Note:
See TracChangeset
for help on using the changeset viewer.