VirtualBox

Changeset 87224 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 12, 2021 11:03:22 AM (4 years ago)
Author:
vboxsync
Message:

Main: bugref:9341: Testcase is restricted to test only the host-like OS by default.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/autostart/tdAutostart1.py

    r87216 r87224  
    44Autostart testcase using.
    55"""
    6 #from pykickstart.commands import repo
     6
    77__copyright__ = \
    88"""
     
    102102        self.fPae = fPae;
    103103        self.sGuestAdditionsIso = sGuestAdditionsIso;
    104         self._asTestBuildDirs = [];
    105         self.sTestBuild = None;
    106         self.sVBoxInstaller = "";
     104        self._asTestBuildDirs = oTstDrv.asTestBuildDirs;
     105        self._sTestBuild = None;
     106        self._sVBoxInstaller = "";
    107107        self.asVirtModesSup = ['hwvirt-np',];
    108108        self.asParavirtModesSup = ['default',];
     
    115115    def asTestBuildDirs(self, value):
    116116        self._asTestBuildDirs = value;
    117         self.sTestBuild = self._findFile(self.sVBoxInstaller, value);
     117        self.sTestBuild = self._findFile(self._sVBoxInstaller, value);
    118118        if not self.sTestBuild:
    119119            raise base.GenError("VirtualBox install package not found");
     120
     121    @property
     122    def sTestBuild(self):
     123        return self._sTestBuild;
     124
     125    @sTestBuild.setter
     126    def sTestBuild(self, value):
     127        if not os.path.exists(value):
     128            raise base.GenError("The %s does not exist" % (value,));
     129        self._sTestBuild = value;
    120130
    121131    def _findFile(self, sRegExp, asTestBuildDirs):
     
    664674        tdAutostartOs.__init__(self, oSet, oTstDrv, sVmName, sKind, sHdd, eNic0Type, cMbRam, \
    665675                               cCpus, fPae, sGuestAdditionsIso);
    666         self.sVBoxInstaller = '^VirtualBox-.*\\.run$';
     676        self._sVBoxInstaller = '^VirtualBox-.*\\.run$';
    667677        return;
    668678
     
    937947        tdAutostartOs.__init__(self, oSet, oTstDrv, sVmName, sKind, sHdd, eNic0Type, cMbRam, \
    938948                               cCpus, fPae, sGuestAdditionsIso);
    939         self.sVBoxInstaller = '^VirtualBox-.*\\.(exe|msi)$';
     949        self._sVBoxInstaller = '^VirtualBox-.*\\.(exe|msi)$';
    940950        return;
    941951
     
    12851295    ksOsSolaris = 'tst-solaris'
    12861296    ksOsFreeBSD = 'tst-freebsd'
     1297
    12871298    def __init__(self):
    12881299        vbox.TestDriver.__init__(self);
     
    12931304        ## @todo r=bird: The --test-build-dirs option as primary way to get the installation files to test
    12941305        ## is not an acceptable test practice as we don't know wtf you're testing.  See defect for more.
    1295         self.asTestBuildDirs    = None; #'D:/AlexD/TestBox/TestAdditionalFiles';
     1306        self.asTestBuildDirs    = os.path.join(self.sScratchPath, 'bin');
    12961307        self.sGuestAdditionsIso = None; #'D:/AlexD/TestBox/TestAdditionalFiles/VBoxGuestAdditions_6.1.2.iso';
    1297         oSet = vboxtestvms.TestVmSet(self.oTestVmManager, acCpus = [2], fIgnoreSkippedVm = True);
     1308        oSet = vboxtestvms.TestVmSet(self.oTestVmManager, acCpus = [2], asVirtModes = ['hwvirt-np',], fIgnoreSkippedVm = True);
    12981309        # pylint: disable=line-too-long
    1299         oSet.aoTestVms.extend([
    1300             tdAutostartOsWin(oSet, self, self.ksOsWindows, 'Windows7_64', \
     1310        self.asTestVmClasses = {
     1311            'win'     : tdAutostartOsWin(oSet, self, self.ksOsWindows, 'Windows7_64', \
    13011312                             '6.0/windows7piglit/windows7piglit.vdi', eNic0Type = None, cMbRam = 2048,  \
    13021313                             cCpus = 2, fPae = True, sGuestAdditionsIso = self.getGuestAdditionsIso()),
    1303             tdAutostartOsLinux(oSet, self, self.ksOsLinux, 'Ubuntu_64', \
     1314            'linux'   : tdAutostartOsLinux(oSet, self, self.ksOsLinux, 'Ubuntu_64', \
    13041315                               '6.0/ub1804piglit/ub1804piglit.vdi', eNic0Type = None, \
    1305                                cMbRam = 2048, cCpus = 2, fPae = None, sGuestAdditionsIso = self.getGuestAdditionsIso())
    1306         ]);
     1316                               cMbRam = 2048, cCpus = 2, fPae = None, sGuestAdditionsIso = self.getGuestAdditionsIso()),
     1317            'solaris' : None, #'tdAutostartOsSolaris',
     1318            'darwin'  : None  #'tdAutostartOsDarwin'
     1319        };
     1320        oSet.aoTestVms.extend([oTestVm for oTestVm in self.asTestVmClasses.values() if oTestVm is not None]);
     1321        sOs = self.getBuildOs();
     1322        if sOs in self.asTestVmClasses.keys():
     1323            for oTestVM in oSet.aoTestVms:
     1324                if oTestVM is not None:
     1325                    oTestVM.fSkip = oTestVM != self.asTestVmClasses[sOs];
     1326
    13071327        # pylint: enable=line-too-long
    13081328        self.oTestVmSet = oSet;
     
    13171337        reporter.log('tdAutostart Options:');
    13181338        reporter.log('  --test-build-dirs <path1[,path2[,...]]>');
    1319         reporter.log('      The list of directories with VirtualBox distros. The option is mandatory');
    1320         reporter.log('      without any default value. The test raises an exception if the');
    1321         reporter.log('      option is not specified. At least, one directory should be pointed.');
     1339        reporter.log('      The list of directories with VirtualBox distros. Overrides default path.');
     1340        reporter.log('      Default path is $TESTBOX_SCRATCH_PATH/bin.');
     1341        reporter.log('  --vbox-<os>-build <path>');
     1342        reporter.log('      The path to vbox build for the specified OS.');
     1343        reporter.log('      The OS can be one of "win", "linux", "solaris" and "darwin".');
     1344        reporter.log('      This option alse enables corresponding VM for testing.');
     1345        reporter.log('      (Default behaviour is testing only VM having host-like OS.)');
    13221346        return rc;
    13231347
     
    13251349        if asArgs[iArg] == '--test-build-dirs':
    13261350            iArg += 1;
    1327             if iArg >= len(asArgs): raise base.InvalidOption('The "--test-build-dirs" takes a paths argument');
     1351            if iArg >= len(asArgs): raise base.InvalidOption('The "--test-build-dirs" takes a path argument');
    13281352            self.asTestBuildDirs = asArgs[iArg].split(',');
    13291353            for oTestVm in self.oTestVmSet.aoTestVms:
    13301354                oTestVm.asTestBuildDirs = self.asTestBuildDirs;
     1355        elif asArgs[iArg] in [ '--vbox-%s-build' % os for os in self.asTestVmClasses.keys()]:
     1356            iArg += 1;
     1357            if iArg >= len(asArgs): raise base.InvalidOption('The "%s" take a path argument' % (asArgs[iArg - 1],));
     1358            oMatch = re.match("--vbox-([^-]+)-build", asArgs[iArg - 1]);
     1359            if oMatch is not None:
     1360                sOs = oMatch.group(1);
     1361                oTestVm = self.asTestVmClasses.get(sOs);
     1362                if oTestVm is not None:
     1363                    oTestVm.sTestBuild = asArgs[iArg];
     1364                    oTestVm.fSkip = False;
    13311365        else:
    13321366            return vbox.TestDriver.parseOption(self, asArgs, iArg);
    13331367        return iArg + 1;
    1334 
    1335     def completeOptions(self):
    1336         # Remove skipped VMs from the test list.
    1337         if self.asTestBuildDirs is None:
    1338             raise base.InvalidOption('--test-build-dirs is not specified')
    1339         for sVM in self.asSkipVMs:
    1340             try:    self.asTestVMs.remove(sVM);
    1341             except: pass;
    1342         return vbox.TestDriver.completeOptions(self);
    13431368
    13441369    def actionConfig(self):
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