VirtualBox

Changeset 63198 in vbox for trunk/src


Ignore:
Timestamp:
Aug 9, 2016 11:29:58 AM (8 years ago)
Author:
vboxsync
Message:

ValidationKit/tests/storage: Rework the testcase, test the split2G variants when supported by the selected backend, introduce different test sets for different use cases (quick functionality check vs. benchmarking vs. stress testing)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/storage/tdStorageBenchmark1.py

    r63142 r63198  
    234234
    235235
     236class StorTestCfgMgr(object):
     237    """
     238    Manages the different testcases.
     239    """
     240
     241    def __init__(self, aasTestLvls, aasTestsBlacklist, fnIsCfgSupported = None):
     242        self.aasTestsBlacklist = aasTestsBlacklist;
     243        self.at3TestLvls       = [];
     244        self.iTestLvl          = 0;
     245        self.fnIsCfgSupported  = fnIsCfgSupported;
     246        for asTestLvl in aasTestLvls:
     247            if isinstance(asTestLvl, tuple):
     248                asTestLvl, fnTestFmt = asTestLvl;
     249                self.at3TestLvls.append((0, fnTestFmt, asTestLvl));
     250            else:
     251                self.at3TestLvls.append((0, None, asTestLvl));
     252
     253        self.at3TestLvls.reverse();
     254
     255        # Get the first non blacklisted test.
     256        asTestCfg = self.getCurrentTestCfg();
     257        while len(asTestCfg) > 0 and self.isTestCfgBlacklisted(asTestCfg):
     258            asTestCfg = self.advanceTestCfg();
     259
     260        iLvl = 0;
     261        for sCfg in asTestCfg:
     262            reporter.testStart('%s' % (self.getTestIdString(sCfg, iLvl)));
     263            iLvl += 1;
     264
     265    def __del__(self):
     266        # Make sure the tests are marked as done.
     267        while self.iTestLvl < len(self.at3TestLvls):
     268            reporter.testDone();
     269            self.iTestLvl += 1;
     270
     271    def getTestIdString(self, oCfg, iLvl):
     272        """
     273        Returns a potentially formatted string for the test name.
     274        """
     275
     276        # The order of the test levels is reversed so get the level starting
     277        # from the end.
     278        _, fnTestFmt, _ = self.at3TestLvls[len(self.at3TestLvls) - 1 - iLvl];
     279        if fnTestFmt is not None:
     280            return fnTestFmt(oCfg);
     281        else:
     282            return oCfg;
     283
     284    def isTestCfgBlacklisted(self, asTestCfg):
     285        """
     286        Returns whether the given test config is black listed.
     287        """
     288        fBlacklisted = False;
     289
     290        for asTestBlacklist in self.aasTestsBlacklist:
     291            iLvl = 0;
     292            fBlacklisted = True;
     293            while iLvl < len(asTestBlacklist) and iLvl < len(asTestCfg):
     294                if asTestBlacklist[iLvl] != asTestCfg[iLvl] and asTestBlacklist[iLvl] != '*':
     295                    fBlacklisted = False;
     296                    break;
     297
     298                iLvl += 1;
     299
     300        if not fBlacklisted and self.fnIsCfgSupported is not None:
     301            fBlacklisted = not self.fnIsCfgSupported(asTestCfg);
     302
     303        return fBlacklisted;
     304
     305    def advanceTestCfg(self):
     306        """
     307        Advances to the next test config and returns it as an
     308        array of strings or an empty config if there is no test left anymore.
     309        """
     310        iTestCfg, fnTestFmt, asTestCfg = self.at3TestLvls[self.iTestLvl];
     311        iTestCfg += 1;
     312        self.at3TestLvls[self.iTestLvl] = (iTestCfg, fnTestFmt, asTestCfg);
     313        while iTestCfg == len(asTestCfg) and self.iTestLvl < len(self.at3TestLvls):
     314            self.at3TestLvls[self.iTestLvl] = (0, fnTestFmt, asTestCfg);
     315            self.iTestLvl += 1;
     316            if self.iTestLvl < len(self.at3TestLvls):
     317                iTestCfg, fnTestFmt, asTestCfg = self.at3TestLvls[self.iTestLvl];
     318                iTestCfg += 1;
     319                self.at3TestLvls[self.iTestLvl] = (iTestCfg, fnTestFmt, asTestCfg);
     320                if iTestCfg < len(asTestCfg):
     321                    self.iTestLvl = 0;
     322                    break;
     323            else:
     324                break; # We reached the end of our tests.
     325
     326        return self.getCurrentTestCfg();
     327
     328    def getCurrentTestCfg(self):
     329        """
     330        Returns the current not black listed test config as an array of strings.
     331        """
     332        asTestCfg = [];
     333
     334        if self.iTestLvl < len(self.at3TestLvls):
     335            for t3TestLvl in self.at3TestLvls:
     336                iTestCfg, _, asTestLvl = t3TestLvl;
     337                asTestCfg.append(asTestLvl[iTestCfg]);
     338
     339            asTestCfg.reverse()
     340
     341        return asTestCfg;
     342
     343    def getNextTestCfg(self, fSkippedLast = False):
     344        """
     345        Returns the next not blacklisted test config or an empty list if
     346        there is no test left.
     347        """
     348        asTestCfgCur = self.getCurrentTestCfg();
     349
     350        asTestCfg = self.advanceTestCfg();
     351        while len(asTestCfg) > 0 and self.isTestCfgBlacklisted(asTestCfg):
     352            asTestCfg = self.advanceTestCfg();
     353
     354        # Compare the current and next config and close the approriate test
     355        # categories.
     356        reporter.testDone(fSkippedLast);
     357        if len(asTestCfg) > 0:
     358            idxSame = 0;
     359            while asTestCfgCur[idxSame] == asTestCfg[idxSame]:
     360                idxSame += 1;
     361
     362            for i in range(idxSame, len(asTestCfg) - 1):
     363                reporter.testDone();
     364
     365            for i in range(idxSame, len(asTestCfg)):
     366                reporter.testStart('%s' % (self.getTestIdString(asTestCfg[i], i)));
     367
     368        else:
     369            # No more tests, mark all tests as done
     370            for i in range(0, len(asTestCfgCur) - 1):
     371                reporter.testDone();
     372
     373        return asTestCfg;
     374
    236375class tdStorageBenchmark(vbox.TestDriver):                                      # pylint: disable=R0902
    237376    """
     
    245384    };
    246385
     386    # Available test sets.
     387    kdTestSets = {
     388        # Mostly for developing and debugging the testcase.
     389        'Fast': {
     390            'RecordSize':  '64k',
     391            'TestsetSize': '100m',
     392            'QueueDepth':  '32',
     393            'DiskSizeGb':  2
     394        },
     395        # For quick functionality tests where benchmark results are not required.
     396        'Functionality': {
     397            'RecordSize':  '64k',
     398            'TestsetSize': '2g',
     399            'QueueDepth':  '32',
     400            'DiskSizeGb':  4
     401        },
     402        # For benchmarking the I/O stack.
     403        'Benchmark': {
     404            'RecordSize':  '64k',
     405            'TestsetSize': '20g',
     406            'QueueDepth':  '32',
     407            'DiskSizeGb':  30
     408        },
     409        # For stress testing which takes a lot of time.
     410        'Stress': {
     411            'RecordSize':  '64k',
     412            'TestsetSize': '2t',
     413            'QueueDepth':  '32',
     414            'DiskSizeGb':  3000
     415        },
     416    };
     417
     418    # Dictionary mapping the virtualization mode mnemonics to a little less cryptic
     419    # strings used in test descriptions.
     420    kdVirtModeDescs = {
     421        'raw'       : 'Raw-mode',
     422        'hwvirt'    : 'HwVirt',
     423        'hwvirt-np' : 'NestedPaging'
     424    };
     425
     426    # Array indexes for the test configs.
     427    kiVmName      = 0;
     428    kiStorageCtrl = 1;
     429    kiDiskFmt     = 2;
     430    kiDiskVar     = 3;
     431    kiCpuCount    = 4;
     432    kiVirtMode    = 5;
     433    kiIoTest      = 6;
     434    kiTestSet     = 7;
     435
    247436    def __init__(self):
    248437        vbox.TestDriver.__init__(self);
    249         self.asRsrcs           = None;
    250         self.oGuestToGuestVM   = None;
    251         self.oGuestToGuestSess = None;
    252         self.oGuestToGuestTxs  = None;
    253         self.asTestVMsDef      = ['tst-storage', 'tst-storage32'];
    254         self.asTestVMs         = self.asTestVMsDef;
    255         self.asSkipVMs         = [];
    256         self.asVirtModesDef    = ['hwvirt', 'hwvirt-np', 'raw',]
    257         self.asVirtModes       = self.asVirtModesDef
    258         self.acCpusDef         = [1, 2,]
    259         self.acCpus            = self.acCpusDef;
    260         self.asStorageCtrlsDef = ['AHCI', 'IDE', 'LsiLogicSAS', 'LsiLogic', 'BusLogic', 'NVMe'];
    261         self.asStorageCtrls    = self.asStorageCtrlsDef;
    262         self.asDiskFormatsDef  = ['VDI', 'VMDK', 'VHD', 'QED', 'Parallels', 'QCOW', 'iSCSI'];
    263         self.asDiskFormats     = self.asDiskFormatsDef;
    264         self.asDiskVariantsDef = ['Dynamic', 'Fixed', 'Split2G'];
    265         self.asDiskVariants    = self.asDiskVariantsDef;
    266         self.asTestsDef        = ['iozone', 'fio'];
    267         self.asTests           = self.asTestsDef;
    268         self.asIscsiTargetsDef = [ ]; # @todo: Configure one target for basic iSCSI testing
    269         self.asIscsiTargets    = self.asIscsiTargetsDef;
    270         self.fTestHost         = False;
    271         self.fUseScratch       = False;
    272         self.fRecreateStorCfg = True;
    273         self.oStorCfg          = None;
     438        self.asRsrcs                 = None;
     439        self.asTestVMsDef            = ['tst-storage', 'tst-storage32'];
     440        self.asTestVMs               = self.asTestVMsDef;
     441        self.asSkipVMs               = [];
     442        self.asVirtModesDef          = ['hwvirt', 'hwvirt-np', 'raw',]
     443        self.asVirtModes             = self.asVirtModesDef;
     444        self.acCpusDef               = [1, 2];
     445        self.acCpus                  = self.acCpusDef;
     446        self.asStorageCtrlsDef       = ['AHCI', 'IDE', 'LsiLogicSAS', 'LsiLogic', 'BusLogic', 'NVMe'];
     447        self.asStorageCtrls          = self.asStorageCtrlsDef;
     448        self.asDiskFormatsDef        = ['VDI', 'VMDK', 'VHD', 'QED', 'Parallels', 'QCOW', 'iSCSI'];
     449        self.asDiskFormats           = self.asDiskFormatsDef;
     450        self.asDiskVariantsDef       = ['Dynamic', 'Fixed', 'DynamicSplit2G', 'FixedSplit2G', 'Network'];
     451        self.asDiskVariants          = self.asDiskVariantsDef;
     452        self.asTestsDef              = ['iozone', 'fio'];
     453        self.asTests                 = self.asTestsDef;
     454        self.asTestSetsDef           = ['Fast', 'Functionality', 'Benchmark', 'Stress'];
     455        self.asTestSets              = self.asTestSetsDef;
     456        self.asIscsiTargetsDef       = [ ]; # @todo: Configure one target for basic iSCSI testing
     457        self.asIscsiTargets          = self.asIscsiTargetsDef;
     458        self.fTestHost               = False;
     459        self.fUseScratch             = False;
     460        self.fRecreateStorCfg        = True;
     461        self.fReportBenchmarkResults = True;
     462        self.oStorCfg                = None;
    274463
    275464    #
     
    294483        reporter.log('  --tests         <test1[:test2[:...]]>');
    295484        reporter.log('      Default: %s' % (':'.join(self.asTests)));
     485        reporter.log('  --test-sets     <set1[:set2[:...]]>');
     486        reporter.log('      Default: %s' % (':'.join(self.asTestSets)));
    296487        reporter.log('  --test-vms      <vm1[:vm2[:...]]>');
    297488        reporter.log('      Test the specified VMs in the given order. Use this to change');
     
    309500        reporter.log('      Recreate the host storage config before each test');
    310501        reporter.log('  --dont-wipe-storage-cfg');
    311         reporter.log('      Don\' recreate the host storage config before each test');
     502        reporter.log('      Don\'t recreate the host storage config before each test');
     503        reporter.log('  --report-benchmark-results');
     504        reporter.log('      Report all benchmark results');
     505        reporter.log('  --dont-report-benchmark-results');
     506        reporter.log('      Don\'t report any benchmark results');
    312507        return rc;
    313508
     
    351546        elif asArgs[iArg] == '--tests':
    352547            iArg += 1;
    353             if iArg >= len(asArgs): raise base.InvalidOption('The "--tests" takes a colon separated list of disk formats');
     548            if iArg >= len(asArgs): raise base.InvalidOption('The "--tests" takes a colon separated list of tests to run');
    354549            self.asTests = asArgs[iArg].split(':');
     550        elif asArgs[iArg] == '--test-sets':
     551            iArg += 1;
     552            if iArg >= len(asArgs): raise base.InvalidOption('The "--test-sets" takes a colon separated list of test sets');
     553            self.asTestSets = asArgs[iArg].split(':');
    355554        elif asArgs[iArg] == '--test-vms':
    356555            iArg += 1;
     
    376575        elif asArgs[iArg] == '--dont-wipe-storage-cfg':
    377576            self.fRecreateStorCfg = False;
     577        elif asArgs[iArg] == '--report-benchmark-results':
     578            self.fReportBenchmarkResults = True;
     579        elif asArgs[iArg] == '--dont-report-benchmark-results':
     580            self.fReportBenchmarkResults = False;
    378581        else:
    379582            return vbox.TestDriver.parseOption(self, asArgs, iArg);
     
    494697                lstDskVariants = [];
    495698                lstCaps = self.oVBoxMgr.getArray(oDskFmt, 'capabilities');
    496                 for eCap in lstCaps:
    497                     if    eCap == vboxcon.MediumFormatCapabilities_CreateDynamic \
    498                        and 'Dynamic' in asVariants:
    499                         lstDskVariants.append('Dynamic');
    500                     elif     eCap == vboxcon.MediumFormatCapabilities_CreateFixed \
    501                          and 'Fixed' in asVariants:
    502                         lstDskVariants.append('Fixed');
    503                     elif    eCap == vboxcon.MediumFormatCapabilities_CreateSplit2G \
    504                          and 'Split2G' in asVariants:
    505                         lstDskVariants.append('Split2G');
    506                     elif eCap == vboxcon.MediumFormatCapabilities_TcpNetworking:
    507                         lstDskVariants.append('Network'); # Solely for iSCSI to get a non empty list
     699
     700                if     vboxcon.MediumFormatCapabilities_CreateDynamic in lstCaps \
     701                   and 'Dynamic' in asVariants:
     702                    lstDskVariants.append('Dynamic');
     703
     704                if     vboxcon.MediumFormatCapabilities_CreateFixed in lstCaps \
     705                   and 'Fixed' in asVariants:
     706                    lstDskVariants.append('Fixed');
     707
     708                if     vboxcon.MediumFormatCapabilities_CreateSplit2G in lstCaps \
     709                   and vboxcon.MediumFormatCapabilities_CreateDynamic in lstCaps \
     710                   and 'DynamicSplit2G' in asVariants:
     711                    lstDskVariants.append('DynamicSplit2G');
     712
     713                if     vboxcon.MediumFormatCapabilities_CreateSplit2G in lstCaps \
     714                   and vboxcon.MediumFormatCapabilities_CreateFixed in lstCaps \
     715                   and 'FixedSplit2G' in asVariants:
     716                    lstDskVariants.append('FixedSplit2G');
     717
     718                if     vboxcon.MediumFormatCapabilities_TcpNetworking in lstCaps \
     719                   and 'Network' in asVariants:
     720                    lstDskVariants.append('Network'); # Solely for iSCSI to get a non empty list
    508721
    509722                return lstDskVariants;
     
    520733        elif sDiskVariant == 'Fixed':
    521734            tMediumVariant = (vboxcon.MediumVariant_Fixed, );
    522         elif sDiskVariant == 'Split2G':
     735        elif sDiskVariant == 'DynamicSplit2G':
     736            tMediumVariant = (vboxcon.MediumVariant_Standard, vboxcon.MediumVariant_VmdkSplit2G);
     737        elif sDiskVariant == 'FixedSplit2G':
    523738            tMediumVariant = (vboxcon.MediumVariant_Fixed, vboxcon.MediumVariant_VmdkSplit2G);
    524739
    525740        return tMediumVariant;
    526741
    527     def testBenchmark(self, sTargetOs, sBenchmark, sMountpoint, oExecutor):
     742    def getStorageCtrlFromName(self, sStorageCtrl):
     743        """
     744        Resolves the storage controller string to the matching constant.
     745        """
     746        eStorageCtrl = None;
     747
     748        if sStorageCtrl == 'AHCI':
     749            eStorageCtrl = vboxcon.StorageControllerType_IntelAhci;
     750        elif sStorageCtrl == 'IDE':
     751            eStorageCtrl = vboxcon.StorageControllerType_PIIX4;
     752        elif sStorageCtrl == 'LsiLogicSAS':
     753            eStorageCtrl = vboxcon.StorageControllerType_LsiLogicSas;
     754        elif sStorageCtrl == 'LsiLogic':
     755            eStorageCtrl = vboxcon.StorageControllerType_LsiLogic;
     756        elif sStorageCtrl == 'BusLogic':
     757            eStorageCtrl = vboxcon.StorageControllerType_BusLogic;
     758        elif sStorageCtrl == 'NVMe':
     759            eStorageCtrl = vboxcon.StorageControllerType_NVMe;
     760
     761        return eStorageCtrl;
     762
     763    def isTestCfgSupported(self, asTestCfg):
     764        """
     765        Returns whether a specific test config is supported.
     766        """
     767
     768        # Check whether the disk variant is supported by the selected format.
     769        asVariants = self.getDiskFormatVariantsForTesting(asTestCfg[self.kiDiskFmt], [ asTestCfg[self.kiDiskVar] ]);
     770        if len(asVariants) == 0:
     771            return False;
     772
     773        # For iSCSI check whether we have targets configured.
     774        if asTestCfg[self.kiDiskFmt] == 'iSCSI' and len(self.asIscsiTargets) == 0:
     775            return False;
     776
     777        # Check for virt mode, CPU count and selected VM.
     778        if     asTestCfg[self.kiVirtMode] == 'raw' \
     779           and (asTestCfg[self.kiCpuCount] > 1 or asTestCfg[self.kiVmName] == 'tst-storage'):
     780            return False;
     781
     782        return True;
     783
     784    def fnFormatCpuString(self, cCpus):
     785        """
     786        Formats the CPU count to be readable.
     787        """
     788        if cCpus == 1:
     789            return '1 cpu';
     790        else:
     791            return '%u cpus' % (cCpus);
     792
     793    def fnFormatVirtMode(self, sVirtMode):
     794        """
     795        Formats the virtualization mode to be a little less cryptic for use in test
     796        descriptions.
     797        """
     798        return self.kdVirtModeDescs[sVirtMode];
     799
     800    def testBenchmark(self, sTargetOs, sBenchmark, sMountpoint, oExecutor, dTestSet):
    528801        """
    529802        Runs the given benchmark on the test host.
    530803        """
    531         # Create a basic config
    532         dCfg = {
    533             'RecordSize':  '64k',
    534             'TestsetSize': '100m',
    535             'QueueDepth':  '32',
    536             'FilePath': sMountpoint,
    537             'TargetOs': sTargetOs
    538         };
     804
     805        dTestSet['FilePath'] = sMountpoint;
     806        dTestSet['TargetOs'] = sTargetOs;
    539807
    540808        oTst = None;
    541809        if sBenchmark == 'iozone':
    542             oTst = IozoneTest(oExecutor, dCfg);
     810            oTst = IozoneTest(oExecutor, dTestSet);
    543811        elif sBenchmark == 'fio':
    544             oTst = FioTest(oExecutor, dCfg); # pylint: disable=R0204
     812            oTst = FioTest(oExecutor, dTestSet); # pylint: disable=R0204
    545813
    546814        if oTst is not None:
    547             reporter.testStart(sBenchmark);
    548815            fRc = oTst.prepare();
    549816            if fRc:
    550817                fRc = oTst.run();
    551818                if fRc:
    552                     fRc = oTst.reportResult();
     819                    if self.fReportBenchmarkResults:
     820                        fRc = oTst.reportResult();
    553821                else:
    554822                    reporter.testFailure('Running the testcase failed');
     
    557825
    558826        oTst.cleanup();
    559         reporter.testDone();
    560827
    561828        return fRc;
    562829
    563     def testBenchmarks(self, sTargetOs, sMountPoint, oExecutor):
    564         """
    565         Runs all the configured benchmarks on the target.
    566         """
    567         for sTest in self.asTests:
    568             self.testBenchmark(sTargetOs, sTest, sMountPoint, oExecutor);
    569 
    570     def test1OneCfg(self, sVmName, eStorageController, sDiskFormat, sDiskVariant, \
    571                     sDiskPath, cCpus, fHwVirt, fNestedPaging):
     830    def testOneCfg(self, sVmName, eStorageController, sDiskFormat, sDiskVariant, # pylint: disable=R0913
     831                   sDiskPath, cCpus, sIoTest, sVirtMode, sTestSet):
    572832        """
    573833        Runs the specified VM thru test #1.
     
    578838        oVM = self.getVmByName(sVmName);
    579839
     840        dTestSet      = self.kdTestSets.get(sTestSet);
     841        cbDisk        = dTestSet.get('DiskSizeGb') * 1024*1024*1024;
     842        fHwVirt       = sVirtMode != 'raw';
     843        fNestedPaging = sVirtMode == 'hwvirt-np';
     844
     845        fRc = True;
     846        if sDiskFormat == 'iSCSI':
     847            sDiskPath = self.asIscsiTargets[0];
     848        elif self.fUseScratch:
     849            sDiskPath = self.sScratchPath;
     850        else:
     851            # If requested recreate the storage space to start with a clean config
     852            # for benchmarks
     853            if self.fRecreateStorCfg:
     854                sMountPoint = self.prepareStorage(self.oStorCfg);
     855                if sMountPoint is not None:
     856                    # Create a directory where every normal user can write to.
     857                    self.oStorCfg.mkDirOnVolume(sMountPoint, 'test', 0777);
     858                    sDiskPath = sMountPoint + '/test';
     859                else:
     860                    fRc = False;
     861                    reporter.testFailure('Failed to prepare storage for VM');
     862
     863        if not fRc:
     864            return fRc;
     865
    580866        # Reconfigure the VM
    581         fRc = True;
    582867        oSession = self.openSession(oVM);
    583868        if oSession is not None:
     
    594879                listNames = [];
    595880                listValues = [];
    596                 listValues = sDiskPath.split('|');
     881                listValues = self.asIscsiTargets[0].split('|');
    597882                listNames.append('TargetAddress');
    598883                listNames.append('TargetName');
     
    624909            else:
    625910                tMediumVariant = self.convDiskToMediumVariant(sDiskVariant);
    626                 fRc = fRc and oSession.createAndAttachHd(sDiskPath, sDiskFormat, _ControllerTypeToName(eStorageController), \
    627                                                          cb = 30*1024*1024*1024, iPort = 0, iDevice = iDevice, \
     911                fRc = fRc and oSession.createAndAttachHd(sDiskPath + '/test.disk', sDiskFormat, \
     912                                                         _ControllerTypeToName(eStorageController), \
     913                                                         cb = cbDisk, iPort = 0, iDevice = iDevice, \
    628914                                                         fImmutable = False, cMsTimeout = 3600 * 1000, \
    629915                                                         tMediumVariant = tMediumVariant);
     
    655941                sMountPoint = self.prepareStorage(oStorCfgVm);
    656942                if sMountPoint is not None:
    657                     self.testBenchmarks('linux', sMountPoint, oExecVm);
     943                    self.testBenchmark('linux', sIoTest, sMountPoint, oExecVm, dTestSet);
    658944                    self.cleanupStorage(oStorCfgVm);
    659945                else:
     
    678964
    679965                    oSession.saveSettings();
    680                     self.oVBox.deleteHdByLocation(sDiskPath);
     966                    self.oVBox.deleteHdByLocation(sDiskPath + '/test.disk');
    681967                    oSession.saveSettings();
    682968                    oSession.close();
     
    687973                fRc = False;
    688974
     975            # Cleanup storage area
     976            if sDiskFormat != 'iSCSI' and not self.fUseScratch and self.fRecreateStorCfg:
     977                self.cleanupStorage(self.oStorCfg);
     978
    689979        return fRc;
    690980
    691     def testBenchmarkOneVM(self, sVmName, sMountPoint = None):
    692         """
    693         Runs one VM thru the various benchmark configurations.
    694         """
    695         reporter.testStart(sVmName);
     981    def testStorage(self, sDiskPath = None):
     982        """
     983        Runs the storage testcase through the selected configurations
     984        """
     985
     986        aasTestCfgs = [];
     987        aasTestCfgs.insert(self.kiVmName,      self.asTestVMs);
     988        aasTestCfgs.insert(self.kiStorageCtrl, self.asStorageCtrls);
     989        aasTestCfgs.insert(self.kiDiskFmt,     self.asDiskFormats);
     990        aasTestCfgs.insert(self.kiDiskVar,     self.asDiskVariants);
     991        aasTestCfgs.insert(self.kiCpuCount,    (self.acCpus, self.fnFormatCpuString));
     992        aasTestCfgs.insert(self.kiVirtMode,    (self.asVirtModes, self.fnFormatVirtMode));
     993        aasTestCfgs.insert(self.kiIoTest,      self.asTests);
     994        aasTestCfgs.insert(self.kiTestSet,     self.asTestSets);
     995
     996        aasTestsBlacklist = [];
     997        aasTestsBlacklist.append(['tst-storage', 'BusLogic']); # 64bit Linux is broken with BusLogic
     998
     999        oTstCfgMgr = StorTestCfgMgr(aasTestCfgs, aasTestsBlacklist, self.isTestCfgSupported);
     1000
    6961001        fRc = True;
    697         for sStorageCtrl in self.asStorageCtrls:
    698             reporter.testStart(sStorageCtrl);
    699 
    700             if sStorageCtrl == 'AHCI':
    701                 eStorageCtrl = vboxcon.StorageControllerType_IntelAhci;
    702             elif sStorageCtrl == 'IDE':
    703                 eStorageCtrl = vboxcon.StorageControllerType_PIIX4;
    704             elif sStorageCtrl == 'LsiLogicSAS':
    705                 eStorageCtrl = vboxcon.StorageControllerType_LsiLogicSas;
    706             elif sStorageCtrl == 'LsiLogic':
    707                 eStorageCtrl = vboxcon.StorageControllerType_LsiLogic;
    708             elif sStorageCtrl == 'BusLogic':
    709                 if sVmName == 'tst-storage': # Broken for 64bit Linux
    710                     reporter.testDone(True);
    711                     continue;
    712                 eStorageCtrl = vboxcon.StorageControllerType_BusLogic;
    713             elif sStorageCtrl == 'NVMe':
    714                 eStorageCtrl = vboxcon.StorageControllerType_NVMe;
    715             else:
    716                 eStorageCtrl = None;
    717 
    718             for sDiskFormat in self.asDiskFormats:
    719                 reporter.testStart('%s' % (sDiskFormat));
    720 
    721                 if sDiskFormat == "iSCSI":
    722                     asPaths = self.asIscsiTargets;
    723                 else:
    724                     if self.fUseScratch:
    725                         asPaths = [ self.sScratchPath ];
    726                     else:
    727                         # Create a new default storage config on the host
    728                         if self.fRecreateStorCfg:
    729                             sMountPoint = self.prepareStorage(self.oStorCfg);
    730                         if sMountPoint is not None:
    731                             # Create a directory where every normal user can write to.
    732                             self.oStorCfg.mkDirOnVolume(sMountPoint, 'test', 0777);
    733                             asPaths = [ sMountPoint + '/test' ];
    734                         else:
    735                             asPaths = [];
    736                             fRc = False;
    737                             reporter.testFailure('Failed to prepare storage for VM');
    738 
    739                 asVariants = self.getDiskFormatVariantsForTesting(sDiskFormat, self.asDiskVariants);
    740                 for sVariant in asVariants:
    741                     reporter.testStart('%s' % (sVariant));
    742                     for sPath in asPaths:
    743                         if sDiskFormat == "iSCSI":
    744                             sPath = sPath;
    745                         else:
    746                             sPath = sPath + "/test.disk";
    747 
    748                         for cCpus in self.acCpus:
    749                             if cCpus == 1:  reporter.testStart('1 cpu');
    750                             else:           reporter.testStart('%u cpus' % (cCpus));
    751 
    752                             for sVirtMode in self.asVirtModes:
    753                                 if sVirtMode == 'raw' and (cCpus > 1 or sVmName == 'tst-storage'):
    754                                     continue;
    755                                 hsVirtModeDesc = {};
    756                                 hsVirtModeDesc['raw']       = 'Raw-mode';
    757                                 hsVirtModeDesc['hwvirt']    = 'HwVirt';
    758                                 hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
    759                                 reporter.testStart(hsVirtModeDesc[sVirtMode]);
    760 
    761                                 fHwVirt       = sVirtMode != 'raw';
    762                                 fNestedPaging = sVirtMode == 'hwvirt-np';
    763                                 fRc = self.test1OneCfg(sVmName, eStorageCtrl, sDiskFormat, sVariant, sPath, \
    764                                                        cCpus, fHwVirt, fNestedPaging)  and  fRc and True; # pychecker hack.
    765                                 reporter.testDone(); # Virt mode
    766 
    767                             reporter.testDone(); # CPU count
    768                     reporter.testDone(); # Disk variant
    769 
    770                 # Cleanup storage area
    771                 if sDiskFormat != 'iSCSI' and not self.fUseScratch and self.fRecreateStorCfg:
    772                     self.cleanupStorage(self.oStorCfg);
    773 
    774                 reporter.testDone(); # Disk format
    775             reporter.testDone(); # Controller
    776         reporter.testDone(); # VM
     1002        asTestCfg = oTstCfgMgr.getCurrentTestCfg();
     1003        while len(asTestCfg) > 0:
     1004            fRc = self.testOneCfg(asTestCfg[self.kiVmName], self.getStorageCtrlFromName(asTestCfg[self.kiStorageCtrl]), \
     1005                                  asTestCfg[self.kiDiskFmt], asTestCfg[self.kiDiskVar], sDiskPath, \
     1006                                  asTestCfg[self.kiCpuCount], asTestCfg[self.kiIoTest], asTestCfg[self.kiVirtMode], \
     1007                                  asTestCfg[self.kiTestSet]) and fRc and True; # pychecker hack.
     1008
     1009            asTestCfg = oTstCfgMgr.getNextTestCfg();
     1010
    7771011        return fRc;
    7781012
     
    8041038                    sMountPoint = self.prepareStorage(self.oStorCfg);
    8051039                if sMountPoint is not None:
    806                     self.testBenchmarks(utils.getHostOs(), sMountPoint, oExecutor);
     1040                    for sIoTest in self.asTests:
     1041                        reporter.testStart(sIoTest);
     1042                        for sTestSet in self.asTestSets:
     1043                            reporter.testStart(sTestSet);
     1044                            dTestSet = self.kdTestSets.get(sTestSet);
     1045                            self.testBenchmark(utils.getHostOs(), sIoTest, sMountPoint, oExecutor, dTestSet);
     1046                            reporter.testDone();
     1047                        reporter.testDone();
    8071048                    self.cleanupStorage(self.oStorCfg);
    8081049                else:
     
    8191060                        reporter.testFailure('Failed to prepare host storage');
    8201061                        fRc = False;
     1062                    self.oStorCfg.mkDirOnVolume(sMountPoint, 'test', 0777);
     1063                    sMountPoint = sMountPoint + '/test';
    8211064                    reporter.testDone();
    8221065
    8231066                if fRc:
    824                     # Loop thru the test VMs.
    825                     for sVM in self.asTestVMs:
    826                         # run test on the VM.
    827                         if not self.testBenchmarkOneVM(sVM, sMountPoint):
    828                             fRc = False;
     1067                    # Run the storage tests.
     1068                    if not self.testStorage(sMountPoint):
     1069                        fRc = False;
     1070
     1071                if not self.fRecreateStorCfg:
     1072                    self.cleanupStorage(self.oStorCfg);
    8291073        else:
    8301074            fRc = False;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette