VirtualBox

Changeset 84322 in vbox


Ignore:
Timestamp:
May 15, 2020 5:29:46 PM (5 years ago)
Author:
vboxsync
Message:

Main: bugref:9341: Added several directories where vbox builds are searched

File:
1 edited

Legend:

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

    r83972 r84322  
    175175        self.sGuestAdditionsIso = sGuestAdditionsIso;
    176176
    177     def _findFile(self, sRegExp, sTestBuildDir):
    178         """
    179         Returns a filepath based on the given regex and path to look into
     177    def _findFile(self, sRegExp, asTestBuildDirs):
     178        """
     179        Returns a filepath based on the given regex and paths to look into
    180180        or None if no matching file is found.
    181181        """
    182182
    183183        oRegExp = re.compile(sRegExp);
    184 
    185         #return most recent file if there are several ones matching the pattern
    186         asFiles = [s for s in os.listdir(sTestBuildDir)
    187                    if os.path.isfile(os.path.join(sTestBuildDir, s))];
    188         asFiles = (s for s in asFiles
    189                    if oRegExp.match(os.path.basename(s))
    190                    and os.path.exists(sTestBuildDir + '/' + s));
    191         asFiles = sorted(asFiles, reverse = True, key = lambda s: os.path.getmtime(os.path.join(sTestBuildDir, s)));
    192         if asFiles:
    193             return sTestBuildDir + '/' + asFiles[0];
     184        for sTestBuildDir in asTestBuildDirs:
     185            try:
     186                #return most recent file if there are several ones matching the pattern
     187                asFiles = [s for s in os.listdir(sTestBuildDir)
     188                           if os.path.isfile(os.path.join(sTestBuildDir, s))];
     189                asFiles = (s for s in asFiles
     190                           if oRegExp.match(os.path.basename(s))
     191                           and os.path.exists(sTestBuildDir + '/' + s));
     192                asFiles = sorted(asFiles, reverse = True, key = lambda s: os.path.getmtime(os.path.join(sTestBuildDir, s)));
     193                if asFiles:
     194                    return sTestBuildDir + '/' + asFiles[0];
     195            except:
     196                pass;
    194197
    195198        reporter.error('Failed to find a file matching "%s" in %s.' % (sRegExp, sTestBuildDir));
     
    547550    """
    548551
    549     def __init__(self, oTestDriver, sTestBuildDir, fpApiVer, sGuestAdditionsIso):
     552    def __init__(self, oTestDriver, asTestBuildDirs, fpApiVer, sGuestAdditionsIso):
    550553        tdAutostartOs.__init__(self, oTestDriver, fpApiVer, sGuestAdditionsIso);
    551         self.sTestBuild = self._findFile('^VirtualBox-.*\\.run$', sTestBuildDir);
     554        self.sTestBuild = self._findFile('^VirtualBox-.*\\.run$', asTestBuildDirs);
    552555        if not self.sTestBuild:
    553556            raise base.GenError("VirtualBox install package not found");
     
    865868    """
    866869
    867     def __init__(self, oTestDriver, sTestBuildDir, fpApiVer, sGuestAdditionsIso):
     870    def __init__(self, oTestDriver, asTestBuildDirs, fpApiVer, sGuestAdditionsIso):
    868871        tdAutostartOs.__init__(self, oTestDriver, fpApiVer, sGuestAdditionsIso);
    869         self.sTestBuild = self._findFile('^VirtualBox-.*\\.(exe|msi)$', sTestBuildDir);
     872        self.sTestBuild = self._findFile('^VirtualBox-.*\\.(exe|msi)$', asTestBuildDirs);
    870873        if not self.sTestBuild:
    871874            raise base.GenError("VirtualBox install package not found");
     
    12051208        self.asTestVMs          = self.asTestVMsDef;
    12061209        self.asSkipVMs          = [];
    1207         self.sTestBuildDir      = None; #'D:/AlexD/TestBox/TestAdditionalFiles';
     1210        self.asTestBuildDirs      = None; #'D:/AlexD/TestBox/TestAdditionalFiles';
    12081211        self.sGuestAdditionsIso = None; #'D:/AlexD/TestBox/TestAdditionalFiles/VBoxGuestAdditions_6.1.2.iso';
    12091212
     
    12151218        reporter.log('');
    12161219        reporter.log('tdAutostart Options:');
    1217         reporter.log('  --test-build-dir <path>');
    1218         reporter.log('      The directory with VirtualBox distros. The option is mandatory');
     1220        reporter.log('  --test-build-dirs <path1[,path2[,...]]>');
     1221        reporter.log('      The list of directories with VirtualBox distros. The option is mandatory');
    12191222        reporter.log('      without any default value. The test raises an exception if the');
    1220         reporter.log('      option is not specified.');
     1223        reporter.log('      option is not specified. At least, one directory should be pointed.');
    12211224        reporter.log('  --guest-additions-iso <path/to/iso>');
    12221225        reporter.log('      The path to fresh VirtualBox Guest Additions iso. The option is');
     
    12321235
    12331236    def parseOption(self, asArgs, iArg): # pylint: disable=too-many-branches,too-many-statements
    1234         if asArgs[iArg] == '--test-build-dir':
     1237        if asArgs[iArg] == '--test-build-dirs':
    12351238            iArg += 1;
    1236             if iArg >= len(asArgs): raise base.InvalidOption('The "--test-build-dir" takes a path argument');
    1237             self.sTestBuildDir = asArgs[iArg];
     1239            if iArg >= len(asArgs): raise base.InvalidOption('The "--test-build-dirs" takes a paths argument');
     1240            self.asTestBuildDirs = asArgs[iArg].split(',');
    12381241        elif asArgs[iArg] == '--guest-additions-iso':
    12391242            iArg += 1;
     
    12611264    def completeOptions(self):
    12621265        # Remove skipped VMs from the test list.
    1263         if self.sTestBuildDir is None:
    1264             raise base.InvalidOption('--test-build-dir is not specified')
     1266        if self.asTestBuildDirs is None:
     1267            raise base.InvalidOption('--test-build-dirs is not specified')
    12651268        if self.sGuestAdditionsIso is None:
    12661269            raise base.InvalidOption('--guest-additions-iso is not specified')
     
    13671370        oGuestOsHlp = None              # type: tdAutostartOs
    13681371        if sVmName == self.ksOsLinux:
    1369             oGuestOsHlp = tdAutostartOsLinux(self, self.sTestBuildDir, self.fpApiVer, # pylint: disable=redefined-variable-type
     1372            oGuestOsHlp = tdAutostartOsLinux(self, self.asTestBuildDirs, self.fpApiVer, # pylint: disable=redefined-variable-type
    13701373                                             self.sGuestAdditionsIso);
    13711374        elif sVmName == self.ksOsSolaris:
    1372             oGuestOsHlp = tdAutostartOsSolaris(self, self.sTestBuildDir, self.fpApiVer, # pylint: disable=redefined-variable-type
     1375            oGuestOsHlp = tdAutostartOsSolaris(self, self.asTestBuildDirs, self.fpApiVer, # pylint: disable=redefined-variable-type
    13731376                                               self.sGuestAdditionsIso);
    13741377        elif sVmName == self.ksOsDarwin:
    1375             oGuestOsHlp = tdAutostartOsDarwin(self, self.sTestBuildDir, self.fpApiVer, # pylint: disable=redefined-variable-type
     1378            oGuestOsHlp = tdAutostartOsDarwin(self, self.asTestBuildDirs, self.fpApiVer, # pylint: disable=redefined-variable-type
    13761379                                              self.sGuestAdditionsIso);
    13771380        elif sVmName == self.ksOsWindows:
    1378             oGuestOsHlp = tdAutostartOsWin(self, self.sTestBuildDir, self.fpApiVer, # pylint: disable=redefined-variable-type
     1381            oGuestOsHlp = tdAutostartOsWin(self, self.asTestBuildDirs, self.fpApiVer, # pylint: disable=redefined-variable-type
    13791382                                           self.sGuestAdditionsIso);
    13801383
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