Changeset 80225 in vbox for trunk/src/VBox/ValidationKit/tests
- Timestamp:
- Aug 12, 2019 5:39:41 PM (5 years ago)
- Location:
- trunk/src/VBox/ValidationKit/tests/storage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/storage/remoteexecutor.py
r79663 r80225 103 103 self.asPaths = [ ]; 104 104 105 def _isFile(self, sFile):106 """107 Checks whether a file exists.108 """109 if self.oTxsSession is not None:110 return self.oTxsSession.syncIsFile(sFile);111 return os.path.isfile(sFile);112 113 105 def _getBinaryPath(self, sBinary): 114 106 """ … … 118 110 for sPath in self.asPaths: 119 111 sFile = sPath + '/' + sBinary; 120 if self. _isFile(sFile):112 if self.isFile(sFile): 121 113 return sFile; 122 return None;114 return sBinary; 123 115 124 116 def _sudoExecuteSync(self, asArgs, sInput): … … 160 152 oStdOut = StdInOutBuffer(); 161 153 oStdErr = StdInOutBuffer(); 154 oTestPipe = reporter.FileWrapperTestPipe(); 162 155 oStdIn = None; 163 156 if sInput is not None: … … 167 160 fRc = self.oTxsSession.syncExecEx(sExec, (sExec,) + asArgs, 168 161 oStdIn = oStdIn, oStdOut = oStdOut, 169 oStdErr = oStdErr, cMsTimeout = cMsTimeout); 162 oStdErr = oStdErr, oTestPipe = oTestPipe, 163 cMsTimeout = cMsTimeout); 170 164 sOutput = oStdOut.getOutput(); 171 165 sError = oStdErr.getOutput(); … … 293 287 return fRc; 294 288 289 def isFile(self, sPath, cMsTimeout = 30000): 290 """ 291 Checks that the given file exists. 292 """ 293 fRc = True; 294 if self.oTxsSession is not None: 295 fRc = self.oTxsSession.syncIsFile(sPath, cMsTimeout); 296 else: 297 try: 298 os.path.isFile(sPath); 299 except: 300 fRc = False; 301 302 return fRc; 303 -
trunk/src/VBox/ValidationKit/tests/storage/tdStorageBenchmark1.py
r79608 r80225 86 86 cfgBuf = StringIO(); 87 87 cfgBuf.write('[global]\n'); 88 cfgBuf.write('bs=' + self.dCfg.get('RecordSize', '4k') + '\n');88 cfgBuf.write('bs=' + str(self.dCfg.get('RecordSize', 4096)) + '\n'); 89 89 cfgBuf.write('ioengine=' + sIoEngine + '\n'); 90 cfgBuf.write('iodepth=' + self.dCfg.get('QueueDepth', '32') + '\n');91 cfgBuf.write('size=' + self.dCfg.get('TestsetSize', '2g') + '\n');90 cfgBuf.write('iodepth=' + str(self.dCfg.get('QueueDepth', 32)) + '\n'); 91 cfgBuf.write('size=' + str(self.dCfg.get('TestsetSize', 2147483648)) + '\n'); 92 92 if fDirectIo: 93 93 cfgBuf.write('direct=1\n'); … … 166 166 ('freaders', 'FRead'), 167 167 ('readers', 'FirstRead')]; 168 self.sRecordSize = dCfg.get('RecordSize', '4k');169 self.sTestsetSize = dCfg.get('TestsetSize', '2g');170 self.sQueueDepth = dCfg.get('QueueDepth', '32');168 self.sRecordSize = str(int(dCfg.get('RecordSize', 4096) / 1024)); 169 self.sTestsetSize = str(int(dCfg.get('TestsetSize', 2147483648) / 1024)); 170 self.sQueueDepth = str(int(dCfg.get('QueueDepth', 32))); 171 171 self.sFilePath = dCfg.get('FilePath', '/mnt/iozone'); 172 172 self.fDirectIo = True; … … 250 250 return self.sError; 251 251 252 class IoPerfTest(object): 253 """ 254 IoPerf testcase. 255 """ 256 def __init__(self, oExecutor, dCfg = None): 257 self.oExecutor = oExecutor; 258 self.sResult = None; 259 self.sError = None; 260 self.sRecordSize = str(dCfg.get('RecordSize', 4094)); 261 self.sTestsetSize = str(dCfg.get('TestsetSize', 2147483648)); 262 self.sQueueDepth = str(dCfg.get('QueueDepth', 32)); 263 self.sFilePath = dCfg.get('FilePath', '/mnt'); 264 self.fDirectIo = True; 265 self.asGstIoPerfPaths = [ 266 '${CDROM}/vboxvalidationkit/${OS/ARCH}/IoPerf${EXESUFF}', 267 '${CDROM}/${OS/ARCH}/IoPerf${EXESUFF}', 268 ]; 269 270 sTargetOs = dCfg.get('TargetOs'); 271 if sTargetOs == 'solaris': 272 self.fDirectIo = False; 273 274 def _locateGstIoPerf(self): 275 """ 276 Returns guest side path to FsPerf. 277 """ 278 for sIoPerfPath in self.asGstIoPerfPaths: 279 if self.oExecutor.isFile(sIoPerfPath): 280 return sIoPerfPath; 281 reporter.log('Unable to find guest FsPerf in any of these places: %s' % ('\n '.join(self.asGstIoPerfPaths),)); 282 return self.asGstIoPerfPaths[0]; 283 284 def prepare(self, cMsTimeout = 30000): 285 """ Prepares the testcase """ 286 _ = cMsTimeout; 287 return True; # Nothing to do. 288 289 def run(self, cMsTimeout = 30000): 290 """ Runs the testcase """ 291 tupArgs = ('--block-size', self.sRecordSize, '--test-set-size', self.sTestsetSize, \ 292 '--maximum-requests', self.sQueueDepth, '--dir', self.sFilePath + '/ioperfdir-1'); 293 if self.fDirectIo: 294 tupArgs += ('--use-cache', 'off'); 295 fRc, sOutput, sError = self.oExecutor.execBinary(self._locateGstIoPerf(), tupArgs, cMsTimeout = cMsTimeout); 296 if fRc: 297 self.sResult = sOutput; 298 else: 299 if sError is None: 300 sError = ''; 301 if sOutput is None: 302 sOutput = ''; 303 self.sError = ('Binary: IoPerf\n' + 304 '\nOutput:\n\n' + 305 sOutput + 306 '\nError:\n\n' + 307 sError); 308 return fRc; 309 310 def cleanup(self): 311 """ Cleans up any leftovers from the testcase. """ 312 return True; 313 314 def reportResult(self): 315 """ 316 Reports the test results to the test manager. 317 """ 318 # Should be done using the test pipe already. 319 return True; 320 321 def getErrorReport(self): 322 """ 323 Returns the error report in case the testcase failed. 324 """ 325 return self.sError; 326 252 327 class StorTestCfgMgr(object): 253 328 """ … … 395 470 # Global storage configs for the testbox 396 471 kdStorageCfgs = { 397 # Testbox configs 398 'testboxstor1.de.oracle.com': storagecfg.DiskCfg('solaris', storagecfg.g_ksDiskCfgRegExp, r'c[3-9]t\dd0\Z'),472 # Testbox configs (Flag whether to test raw mode on the testbox, disk configuration) 473 'testboxstor1.de.oracle.com': (True, storagecfg.DiskCfg('solaris', storagecfg.g_ksDiskCfgRegExp, r'c[3-9]t\dd0\Z')), 399 474 # Windows testbox doesn't return testboxstor2.de.oracle.com from socket.getfqdn() 400 'testboxstor2': storagecfg.DiskCfg('win', storagecfg.g_ksDiskCfgStatic, 'D:\\StorageTest'),475 'testboxstor2': (False, storagecfg.DiskCfg('win', storagecfg.g_ksDiskCfgStatic, 'D:\\StorageTest')), 401 476 402 477 # Local test configs for the testcase developer 403 'adaris': storagecfg.DiskCfg('linux', storagecfg.g_ksDiskCfgList, [ '/dev/sda' ]), 404 'daedalus': storagecfg.DiskCfg('darwin', storagecfg.g_ksDiskCfgStatic, \ 405 '/Volumes/VirtualBox/Testsuite/StorageScratch'), 406 'windows10': storagecfg.DiskCfg('win', storagecfg.g_ksDiskCfgStatic, \ 407 'L:\\Testsuite\\StorageTest'), 478 'adaris': (True, storagecfg.DiskCfg('linux', storagecfg.g_ksDiskCfgStatic, \ 479 '/home/alexander/StorageScratch')), 480 'daedalus': (True, storagecfg.DiskCfg('darwin', storagecfg.g_ksDiskCfgStatic, \ 481 '/Volumes/VirtualBox/Testsuite/StorageScratch')), 482 'windows10': (True, storagecfg.DiskCfg('win', storagecfg.g_ksDiskCfgStatic, \ 483 'L:\\Testsuite\\StorageTest')), 408 484 }; 409 485 … … 412 488 # Mostly for developing and debugging the testcase. 413 489 'Fast': { 414 'RecordSize': '64k',415 'TestsetSize': '100m',416 'QueueDepth': '32',490 'RecordSize': 65536, 491 'TestsetSize': 104857600, # 100 MiB 492 'QueueDepth': 32, 417 493 'DiskSizeGb': 2 418 494 }, 419 495 # For quick functionality tests where benchmark results are not required. 420 496 'Functionality': { 421 'RecordSize': '64k',422 'TestsetSize': '2g',423 'QueueDepth': '32',497 'RecordSize': 65536, 498 'TestsetSize': 2147483648, # 2 GiB 499 'QueueDepth': 32, 424 500 'DiskSizeGb': 10 425 501 }, 426 502 # For benchmarking the I/O stack. 427 503 'Benchmark': { 428 'RecordSize': '64k',429 'TestsetSize': '20g',430 'QueueDepth': '32',504 'RecordSize': 65536, 505 'TestsetSize': 21474836480, # 20 Gib 506 'QueueDepth': 32, 431 507 'DiskSizeGb': 30 432 508 }, 433 509 # For stress testing which takes a lot of time. 434 510 'Stress': { 435 'RecordSize': '64k',436 'TestsetSize': '2t',437 'QueueDepth': '32',511 'RecordSize': 65536, 512 'TestsetSize': 2199023255552, # 2 TiB 513 'QueueDepth': 32, 438 514 'DiskSizeGb': 10000 439 515 }, … … 486 562 self.asDiskVariantsDef = ['Dynamic', 'Fixed', 'DynamicSplit2G', 'FixedSplit2G', 'Network']; 487 563 self.asDiskVariants = self.asDiskVariantsDef; 488 self.asTestsDef = ['iozone', 'fio' ];564 self.asTestsDef = ['iozone', 'fio', 'ioperf']; 489 565 self.asTests = self.asTestsDef; 490 566 self.asTestSetsDef = ['Fast', 'Functionality', 'Benchmark', 'Stress']; … … 498 574 self.fRecreateStorCfg = True; 499 575 self.fReportBenchmarkResults = True; 576 self.fTestRawMode = False; 500 577 self.oStorCfg = None; 501 578 self.sIoLogPathDef = self.sScratchPath; … … 709 786 oVM = self.createTestVM('tst-storage', 1, '5.0/storage/tst-storage.vdi', sKind = 'ArchLinux_64', fIoApic = True, \ 710 787 eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \ 711 eNic0Type = vboxcon.NetworkAdapterType_Am79C973); 788 eNic0Type = vboxcon.NetworkAdapterType_Am79C973, \ 789 sDvdImage = self.sVBoxValidationKitIso); 712 790 if oVM is None: 713 791 return False; … … 716 794 oVM = self.createTestVM('tst-storage32', 1, '5.0/storage/tst-storage32.vdi', sKind = 'ArchLinux', fIoApic = True, \ 717 795 eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \ 718 eNic0Type = vboxcon.NetworkAdapterType_Am79C973); 796 eNic0Type = vboxcon.NetworkAdapterType_Am79C973, \ 797 sDvdImage = self.sVBoxValidationKitIso); 719 798 if oVM is None: 720 799 return False; … … 780 859 return lstDisks; 781 860 861 def mountValidationKitIso(self, oVmExec): 862 """ 863 Hack to get the vlaidation kit ISO mounted in the guest as it was left out 864 originally and I don't feel like respinning the disk image. 865 """ 866 fRc = oVmExec.mkDir('/media'); 867 if fRc: 868 fRc = oVmExec.mkDir('/media/cdrom'); 869 if fRc: 870 fRc = oVmExec.execBinaryNoStdOut('mount', ('/dev/sr0', '/media/cdrom')); 871 872 return fRc; 873 782 874 def getDiskFormatVariantsForTesting(self, sDiskFmt, asVariants): 783 875 """ … … 892 984 # Check for virt mode, CPU count and selected VM. 893 985 if asTestCfg[self.kiVirtMode] == 'raw' \ 894 and (asTestCfg[self.kiCpuCount] > 1 or asTestCfg[self.kiVmName] == 'tst-storage'): 986 and ( asTestCfg[self.kiCpuCount] > 1 \ 987 or asTestCfg[self.kiVmName] == 'tst-storage' \ 988 or not self.fTestRawMode): 895 989 return False; 896 990 … … 938 1032 elif sBenchmark == 'fio': 939 1033 oTst = FioTest(oExecutor, dTestSet); # pylint: disable=redefined-variable-type 1034 elif sBenchmark == 'ioperf': 1035 oTst = IoPerfTest(oExecutor, dTestSet); # pylint: disable=redefined-variable-type 940 1036 941 1037 if oTst is not None: … … 1171 1267 lstBinaryPaths = ['/bin', '/sbin', '/usr/bin', '/usr/sbin' ]; 1172 1268 oExecVm = remoteexecutor.RemoteExecutor(oTxsSession, lstBinaryPaths, '${SCRATCH}'); 1173 oGstDiskCfg = storagecfg.DiskCfg('linux', storagecfg.g_ksDiskCfgList, \ 1174 self.getGuestDisk(oSession, oTxsSession, eStorageController)); 1175 oStorCfgVm = storagecfg.StorageCfg(oExecVm, oGstDiskCfg); 1176 1177 iTry = 0; 1178 while iTry < 3: 1179 sMountPoint = self.prepareStorage(oStorCfgVm); 1269 fRc = self.mountValidationKitIso(oExecVm); 1270 if fRc: 1271 oGstDiskCfg = storagecfg.DiskCfg('linux', storagecfg.g_ksDiskCfgList, \ 1272 self.getGuestDisk(oSession, oTxsSession, eStorageController)); 1273 oStorCfgVm = storagecfg.StorageCfg(oExecVm, oGstDiskCfg); 1274 1275 iTry = 0; 1276 while iTry < 3: 1277 sMountPoint = self.prepareStorage(oStorCfgVm); 1278 if sMountPoint is not None: 1279 reporter.log('Prepared storage on %s try' % (iTry + 1,)); 1280 break; 1281 else: 1282 iTry = iTry + 1; 1283 self.sleep(5); 1284 1180 1285 if sMountPoint is not None: 1181 reporter.log('Prepared storage on %s try' % (iTry + 1,)); 1182 break; 1286 self.testBenchmark('linux', sIoTest, sMountPoint, oExecVm, dTestSet, \ 1287 cMsTimeout = 3 * 3600 * 1000); # 3 hours max (Benchmark and QED takes a lot of time) 1288 self.cleanupStorage(oStorCfgVm); 1183 1289 else: 1184 iTry = iTry + 1; 1185 self.sleep(5); 1186 1187 if sMountPoint is not None: 1188 self.testBenchmark('linux', sIoTest, sMountPoint, oExecVm, dTestSet, \ 1189 cMsTimeout = 3 * 3600 * 1000); # 3 hours max (Benchmark and QED takes a lot of time) 1190 self.cleanupStorage(oStorCfgVm); 1290 reporter.testFailure('Failed to prepare storage for the guest benchmark'); 1291 1292 # cleanup. 1293 self.removeTask(oTxsSession); 1294 self.terminateVmBySession(oSession); 1295 1296 # Add the I/O log if it exists and the test failed 1297 if reporter.testErrorCount() > 0 \ 1298 and sIoLogFile is not None \ 1299 and os.path.exists(sIoLogFile): 1300 reporter.addLogFile(sIoLogFile, 'misc/other', 'I/O log'); 1301 os.remove(sIoLogFile); 1191 1302 else: 1192 reporter.testFailure('Failed to prepare storage for the guest benchmark'); 1193 1194 # cleanup. 1195 self.removeTask(oTxsSession); 1196 self.terminateVmBySession(oSession); 1197 1198 # Add the I/O log if it exists and the test failed 1199 if reporter.testErrorCount() > 0 \ 1200 and sIoLogFile is not None \ 1201 and os.path.exists(sIoLogFile): 1202 reporter.addLogFile(sIoLogFile, 'misc/other', 'I/O log'); 1203 os.remove(sIoLogFile); 1303 reporter.testFailure('Failed to mount validation kit ISO'); 1204 1304 1205 1305 else: … … 1276 1376 1277 1377 fRc = True; 1278 oDiskCfg = self.kdStorageCfgs.get(socket.getfqdn().lower());1279 if oDiskCfg is None:1280 oDiskCfg = self.kdStorageCfgs.get(socket.gethostname().lower());1378 tupTstCfg = self.kdStorageCfgs.get(socket.getfqdn().lower()); 1379 if tupTstCfg is None: 1380 tupTstCfg = self.kdStorageCfgs.get(socket.gethostname().lower()); 1281 1381 1282 1382 # Test the host first if requested 1283 if oDiskCfg is not None or self.fUseScratch: 1383 if tupTstCfg is not None or self.fUseScratch: 1384 self.fTestRawMode = tupTstCfg[0]; 1385 oDiskCfg = tupTstCfg[1]; 1284 1386 lstBinaryPaths = ['/bin', '/sbin', '/usr/bin', '/usr/sbin', \ 1285 1387 '/opt/csw/bin', '/usr/ccs/bin', '/usr/sfw/bin'];
Note:
See TracChangeset
for help on using the changeset viewer.