VirtualBox

Changeset 65114 in vbox for trunk/src


Ignore:
Timestamp:
Jan 4, 2017 3:44:31 PM (8 years ago)
Author:
vboxsync
Message:

testdriver/vboxinstaller.py: Kill drvinst.exe and give msiexec a little bit of time to shut down before killing it/them. List service statuses after uninstall (and thereby before installation).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testdriver/vboxinstaller.py

    r62484 r65114  
    719719    #
    720720
     721    ## VBox windows services we can query the status of.
     722    kasWindowsServices = [ 'vboxdrv', 'vboxusbmon' ];
     723
    721724    def _installVBoxOnWindows(self):
    722725        """ Installs VBox on Windows."""
     
    769772        return fRc;
    770773
     774    def _isProcessPresent(self, sName):
     775        """ Checks whether the named process is present or not. """
     776        for oProcess in utils.processListAll():
     777            sBase = oProcess.getBaseImageNameNoExeSuff();
     778            if sBase is not None and sBase.lower() == sName:
     779                return True;
     780        return False;
     781
     782    def _killProcessesByName(self, sName, sDesc):
     783        """ Checks whether the named process is present or not. """
     784        cKilled = 0;
     785        for oProcess in utils.processListAll():
     786            sBase = oProcess.getBaseImageNameNoExeSuff();
     787            if sBase is not None and sBase.lower() == sName:
     788                reporter.log('Killing %s process: %s (%s)' % (sDesc, oProcess.iPid, sBase));
     789                utils.processKill(oProcess.iPid);
     790                cKilled += 1;
     791        return cKilled;
     792
    771793    def _uninstallVBoxOnWindows(self):
    772794        """
     
    793815
    794816        # Before we start uninstalling anything, just ruthlessly kill any
    795         # msiexec process we might find hanging around.
     817        # msiexec and drvinst process we might find hanging around.
    796818        cKilled = 0;
    797         for oProcess in utils.processListAll():
    798             sBase = oProcess.getBaseImageNameNoExeSuff();
    799             if sBase is not None and sBase.lower() in [ 'msiexec', ]:
    800                 reporter.log('Killing MSI process: %s (%s)' % (oProcess.iPid, sBase));
    801                 utils.processKill(oProcess.iPid);
    802                 cKilled += 1;
    803         if cKilled > 0:
    804             time.sleep(16); # fudge.
     819        if self._isProcessPresent('drvinst'):
     820            time.sleep(15);     # In the hope that it goes away.
     821            cKilled = self._killProcessesByName('drvinst', 'MSI driver installation');
     822            if cKilled > 0:
     823                time.sleep(15); # Give related MSI process a chance to clean up after we killed the driver installer.
     824
     825        if self._isProcessPresent('msiexec'):
     826            time.sleep(15);     # In the hope that it goes away.
     827            cKilled = self._killProcessesByName('msiexec', 'MSI driver installation');
     828            if cKilled > 0:
     829                time.sleep(16); # fudge.
    805830
    806831        # Do the uninstalling.
     
    822847        if fRc is False and os.path.isfile(sLogFile):
    823848            reporter.addLogFile(sLogFile, 'log/uninstaller');
     849
     850        # Log driver service states (should ls \Driver\VBox* and \Device\VBox*).
     851        for sService in self.kasWindowsServices:
     852            self._sudoExecuteSync(['sc.exe', 'query', sService]);
     853
    824854        return fRc;
    825855
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