Changeset 65731 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- Feb 10, 2017 1:25:41 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 113445
- Location:
- trunk/src/VBox/ValidationKit/tests/storage
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/storage/remoteexecutor.py
r64847 r65731 89 89 90 90 def __init__(self, oTxsSession = None, asBinaryPaths = None, sScratchPath = None): 91 self.oTxsSession = oTxsSession; 92 self.asPaths = asBinaryPaths; 91 self.oTxsSession = oTxsSession; 92 self.asPaths = asBinaryPaths; 93 self.sScratchPath = sScratchPath; 93 94 if self.asPaths is None: 94 95 self.asPaths = [ ]; 95 self.sScratchPath = sScratchPath96 96 97 97 def _isFile(self, sFile): … … 123 123 reporter.log('Executing [sudo]: %s' % (asArgs, )); 124 124 reporter.flushall(); 125 fRc = False; 126 sOutput = ''; 127 sError = ''; 125 128 try: 126 129 oProcess = utils.sudoProcessPopen(asArgs, stdout=subprocess.PIPE, stdin=subprocess.PIPE, 127 s hell = False, close_fds = False);128 129 sOutput, _= oProcess.communicate(sInput);130 stderr=subprocess.PIPE, shell = False, close_fds = False); 131 132 sOutput, sError = oProcess.communicate(sInput); 130 133 iExitCode = oProcess.poll(); 131 134 132 135 if iExitCode is not 0: 133 print(sOutput); 134 raise subprocess.CalledProcessError(iExitCode, asArgs); 136 fRc = False; 135 137 except: 136 138 reporter.errorXcpt(); 137 return (False, None);138 reporter.log('Exit code [sudo]: %s (%s)' % ( True, asArgs));139 return ( True, str(sOutput));139 fRc = False; 140 reporter.log('Exit code [sudo]: %s (%s)' % (fRc, asArgs)); 141 return (fRc, str(sOutput), str(sError)); 140 142 141 143 def _execLocallyOrThroughTxs(self, sExec, asArgs, sInput, cMsTimeout): … … 148 150 if self.oTxsSession is not None: 149 151 oStdOut = StdInOutBuffer(); 152 oStdErr = StdInOutBuffer(); 150 153 oStdIn = None; 151 154 if sInput is not None: … … 155 158 fRc = self.oTxsSession.syncExecEx(sExec, (sExec,) + asArgs, 156 159 oStdIn = oStdIn, oStdOut = oStdOut, 157 cMsTimeout = cMsTimeout);160 oStdErr = oStdErr, cMsTimeout = cMsTimeout); 158 161 sOutput = oStdOut.getOutput(); 159 else: 160 fRc, sOutput = self._sudoExecuteSync([sExec, ] + list(asArgs), sInput); 161 return (fRc, sOutput); 162 sError = oStdErr.getOutput(); 163 else: 164 fRc, sOutput, sError = self._sudoExecuteSync([sExec, ] + list(asArgs), sInput); 165 return (fRc, sOutput, sError); 162 166 163 167 def execBinary(self, sExec, asArgs, sInput = None, cMsTimeout = 3600000): … … 171 175 fRc = True; 172 176 sOutput = None; 177 sError = None; 173 178 sBinary = self._getBinaryPath(sExec); 174 179 if sBinary is not None: 175 fRc, sOutput = self._execLocallyOrThroughTxs(sBinary, asArgs, sInput, cMsTimeout);180 fRc, sOutput, sError = self._execLocallyOrThroughTxs(sBinary, asArgs, sInput, cMsTimeout); 176 181 else: 177 182 fRc = False; 178 return (fRc, sOutput );183 return (fRc, sOutput, sError); 179 184 180 185 def execBinaryNoStdOut(self, sExec, asArgs, sInput = None): … … 184 189 returning whether the process exited successfully. 185 190 """ 186 fRc, _ = self.execBinary(sExec, asArgs, sInput);191 fRc, _, _ = self.execBinary(sExec, asArgs, sInput); 187 192 return fRc; 188 193 -
trunk/src/VBox/ValidationKit/tests/storage/storagecfg.py
r64847 r65731 150 150 fRc = True; 151 151 if sZPoolRaid is not None: 152 fRc = oExec.execBinary ('zpool', ('create', '-f', sPool, sZPoolRaid,) + tuple(asDisks));152 fRc = oExec.execBinaryNoStdOut('zpool', ('create', '-f', sPool, sZPoolRaid,) + tuple(asDisks)); 153 153 else: 154 154 fRc = False; … … 163 163 fRc = True; 164 164 if cbVol is not None: 165 fRc , _ = oExec.execBinary('zfs', ('create', '-o', 'mountpoint='+sMountPoint, '-V', cbVol, sPool + '/' + sVol));166 else: 167 fRc , _ = oExec.execBinary('zfs', ('create', '-o', 'mountpoint='+sMountPoint, sPool + '/' + sVol));165 fRc = oExec.execBinaryNoStdOut('zfs', ('create', '-o', 'mountpoint='+sMountPoint, '-V', cbVol, sPool + '/' + sVol)); 166 else: 167 fRc = oExec.execBinaryNoStdOut('zfs', ('create', '-o', 'mountpoint='+sMountPoint, sPool + '/' + sVol)); 168 168 169 169 return fRc; … … 173 173 Destroys the given volume. 174 174 """ 175 fRc , _ = oExec.execBinary('zfs', ('destroy', sPool + '/' + sVol));175 fRc = oExec.execBinaryNoStdOut('zfs', ('destroy', sPool + '/' + sVol)); 176 176 return fRc; 177 177 … … 180 180 Destroys the given storage pool. 181 181 """ 182 fRc , _ = oExec.execBinary('zpool', ('destroy', sPool));182 fRc = oExec.execBinaryNoStdOut('zpool', ('destroy', sPool)); 183 183 return fRc; 184 184 … … 289 289 if cbVol is not None: 290 290 sFdiskScript = ',' + str(cbVol / 512) + '\n'; # Get number of sectors 291 fRc , _ = oExec.execBinary('sfdisk', ('--no-reread', '--wipe', 'always', '-q', '-f', sDiskPath), sFdiskScript);291 fRc = oExec.execBinaryNoStdOut('sfdisk', ('--no-reread', '--wipe', 'always', '-q', '-f', sDiskPath), sFdiskScript); 292 292 if fRc: 293 293 if sDiskPath.find('nvme') is not -1: … … 318 318 # Unmount first 319 319 sMountPoint = self.dMounts[sPool + '/' + sVol]; 320 fRc , _ = oExec.execBinary('umount', (sMountPoint,));320 fRc = oExec.execBinaryNoStdOut('umount', (sMountPoint,)); 321 321 self.dMounts.pop(sPool + '/' + sVol); 322 322 oExec.rmDir(sMountPoint); -
trunk/src/VBox/ValidationKit/tests/storage/tdStorageBenchmark1.py
r65722 r65731 84 84 self.sCfgFileId = None; 85 85 self.dCfg = dCfg; 86 self.sError = None; 87 self.sResult = None; 86 88 87 89 def prepare(self, cMsTimeout = 30000): … … 127 129 """ Runs the testcase """ 128 130 _ = cMsTimeout 129 fRc, sOutput = self.oExecutor.execBinary('fio', (self.sCfgFileId,), cMsTimeout = cMsTimeout); 130 # @todo: Parse output. 131 _ = sOutput; 131 fRc, sOutput, sError = self.oExecutor.execBinary('fio', (self.sCfgFileId,), cMsTimeout = cMsTimeout); 132 if fRc: 133 self.sResult = sOutput; 134 else: 135 self.sError = ('Binary: fio\n' + 136 '\nOutput:\n\n' + 137 sOutput + 138 '\nError:\n\n' + 139 sError); 132 140 return fRc; 133 141 … … 140 148 """ 141 149 return True; 150 151 def getErrorReport(self): 152 """ 153 Returns the error report in case the testcase failed. 154 """ 155 return self.sError; 142 156 143 157 class IozoneTest(object): … … 148 162 self.oExecutor = oExecutor; 149 163 self.sResult = None; 164 self.sError = None; 150 165 self.lstTests = [ ('initial writers', 'FirstWrite'), 151 166 ('rewriters', 'Rewrite'), … … 182 197 if self.fDirectIo: 183 198 tupArgs += ('-I',); 184 fRc, sOutput = self.oExecutor.execBinary('iozone', tupArgs, cMsTimeout = cMsTimeout);199 fRc, sOutput, sError = self.oExecutor.execBinary('iozone', tupArgs, cMsTimeout = cMsTimeout); 185 200 if fRc: 186 201 self.sResult = sOutput; 202 else: 203 self.sError = ('Binary: iozone\n' + 204 '\nOutput:\n\n' + 205 sOutput + 206 '\nError:\n\n' + 207 sError); 187 208 188 209 _ = cMsTimeout; … … 233 254 return fRc; 234 255 256 def getErrorReport(self): 257 """ 258 Returns the error report in case the testcase failed. 259 """ 260 return self.sError; 235 261 236 262 class StorTestCfgMgr(object): … … 894 920 else: 895 921 reporter.testFailure('Running the testcase failed'); 922 reporter.addLogString(oTst.getErrorReport(), sBenchmark + '.log', 923 'log/release/client', 'Benchmark raw output'); 896 924 else: 897 925 reporter.testFailure('Preparing the testcase failed');
Note:
See TracChangeset
for help on using the changeset viewer.