VirtualBox

Changeset 107173 in vbox


Ignore:
Timestamp:
Nov 28, 2024 12:23:48 PM (7 weeks ago)
Author:
vboxsync
Message:

ValidationKit/tests/additions/tdAddGuestCtrl.py: Added support for VBoxService logging on NT4 / W2K guests by using VBoxGuestInstallHelper.exe as registry editor by default.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py

    r106061 r107173  
    17301730        fEnableVerboseLogging = False;
    17311731
    1732         # On Windows and Linux guests we always can enable verbose logging.
    1733         # NT4 and W2K doesn't have reg.exe nor (at least NT4) sc.exe.
    1734         if (oTestVm.isWindows() and oTestVm.sKind not in ('WindowsNT4', 'Windows2000',)) \
    1735         or oTestVm.isLinux():
     1732        # On Windows and Linux guests we always can (try to) enable verbose logging.
     1733        if (oTestVm.isWindows() or oTestVm.isLinux()):
    17361734            fEnableVerboseLogging = True;
    17371735
     
    17421740            fEnableVerboseLogging = False;
    17431741
     1742        self.oDebug.sGstVBoxServiceLogPath = oTestVm.pathJoin(self.oTstDrv.getGuestTempDir(oTestVm), "VBoxService");
     1743        sPathLogFile = oTestVm.pathJoin(self.oDebug.sGstVBoxServiceLogPath, 'VBoxService.log');
     1744
     1745        if oTestVm.isWindows():
     1746            sImagePath = '%s -vvvv --logfile %s' % (self.sPathVBoxServiceExeGst, sPathLogFile);
     1747            # For newer revisions we use VBoxGuestInstallHelper.exe. Should work on all Windows versions.
     1748            if self.oTstDrv.fpApiVer >= 7.0 and self.oTstDrv.uRevision >= 166162:
     1749                # Right now we ASSUME that the installation directory always is the following:
     1750                sRegEditorExePath     = 'C:\\Program Files\\Oracle\\VirtualBox Guest Additions\\VBoxGuestInstallHelper.exe';
     1751                asRegEditorArgs       = [ sRegEditorExePath, 'registry', 'write', 'HKLM', 'SYSTEM\\CurrentControlSet\\Services\\VBoxService',
     1752                                          'ImagePath', 'REG_SZ', '"' + sImagePath + '"' ];
     1753            # reg.exe is not able to write keys on older Windows versions (NT4, 2k).
     1754            elif oTestVm.sKind not in ('WindowsNT4', 'Windows2000',):
     1755                sRegEditorExePath     = oTestVm.pathJoin(self.oTstDrv.getGuestSystemDir(oTestVm), 'reg.exe');
     1756                asRegEditorArgs       = [ sRegEditorExePath, 'add', 'HKLM\\SYSTEM\\CurrentControlSet\\Services\\VBoxService',
     1757                                          '/v', 'ImagePath', '/t', 'REG_SZ', '/d', sImagePath, '/f' ];
     1758            else:
     1759                reporter.log('VBoxService logging is not available on this Windows guest');
     1760                fEnableVerboseLogging = False;
     1761
    17441762        # Some older Linux test VMs (like tst-rhel5) don't have a pre-configured 'vbox' user.
    17451763        # So make sure that this user exists and has the appropriate password set. Ignore any errors.
    1746         if oTestVm.isLinux():
     1764        elif oTestVm.isLinux():
    17471765            sCmdUserAdd = oTestVm.pathJoin(self.oTstDrv.getGuestSystemAdminDir(oTestVm, sPathPrefix = '/usr'), 'useradd');
    17481766            asArgs = [ sCmdUserAdd, '-m', 'vbox' ];
     
    17601778        reporter.log('Enabling verbose VBoxService logging: %s' % (fEnableVerboseLogging));
    17611779        if fEnableVerboseLogging:
    1762             self.oDebug.sGstVBoxServiceLogPath = oTestVm.pathJoin(self.oTstDrv.getGuestTempDir(oTestVm), "VBoxService");
    17631780            if oTxsSession.syncMkDirPath(self.oDebug.sGstVBoxServiceLogPath, 0o777) is not True:
    17641781                return reporter.error('Failed to create directory "%s"!' % (self.oDebug.sGstVBoxServiceLogPath,));
    1765             sPathLogFile = oTestVm.pathJoin(self.oDebug.sGstVBoxServiceLogPath, 'VBoxService.log');
    1766 
    17671782            reporter.log('VBoxService logs will be stored in "%s"' % (self.oDebug.sGstVBoxServiceLogPath,));
    17681783
    17691784            fRestartVBoxService = False;
    1770             if oTestVm.isWindows() and oTestVm.sKind not in ('WindowsNT4', 'Windows2000',):
    1771                 sPathRegExe         = oTestVm.pathJoin(self.oTstDrv.getGuestSystemDir(oTestVm), 'reg.exe');
    1772                 sImagePath          = '%s -vvvv --logfile %s' % (self.sPathVBoxServiceExeGst, sPathLogFile);
     1785
     1786            if oTestVm.isWindows():
     1787                asArgs = [ sRegEditorExePath ] + asRegEditorArgs;
    17731788                fRestartVBoxService = self.oTstDrv.txsRunTest(oTxsSession, 'Enabling VBoxService verbose logging (via registry)',
    1774                                          30 * 1000,
    1775                                          sPathRegExe,
    1776                                         (sPathRegExe, 'add',
    1777                                         'HKLM\\SYSTEM\\CurrentControlSet\\Services\\VBoxService',
    1778                                         '/v', 'ImagePath', '/t', 'REG_SZ', '/d', sImagePath, '/f'));
     1789                                                              30 * 1000,
     1790                                                              sRegEditorExePath, asRegEditorArgs);
    17791791            elif oTestVm.isLinux():
    17801792                # Need to use some stupid trickery here to locate the sed binary,
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