VirtualBox

Changeset 84482 in vbox


Ignore:
Timestamp:
May 25, 2020 8:16:03 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
138201
Message:

Validation Kit/testdriver: Added static getGuestWinDir() and make use of it, to avoid more code duplication.

Location:
trunk/src/VBox/ValidationKit
Files:
2 edited

Legend:

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

    r84454 r84482  
    25992599        """
    26002600        if oTestVm.isWindows():
    2601             if oTestVm.sKind in ['WindowsNT4', 'WindowsNT3x',]:
    2602                 return 'C:\\Winnt\\System32';
    2603             return 'C:\\Windows\\System32';
     2601            return oTestVm.pathJoin(TestDriver.getGuestWinDir(oTestVm), 'System32');
    26042602        if oTestVm.isOS2():
    26052603            return 'C:\\OS2\\DLL';
     
    26172615        """
    26182616        if oTestVm.isWindows():
    2619             if oTestVm.sKind in ['WindowsNT4', 'WindowsNT3x',]:
    2620                 return 'C:\\Winnt\\System32';
    2621             return 'C:\\Windows\\System32';
     2617            return oTestVm.pathJoin(TestDriver.getGuestWinDir(oTestVm), 'System32');
    26222618        if oTestVm.isOS2():
    26232619            return 'C:\\OS2\\DLL'; ## @todo r=andy Not sure here.
    26242620        return sPathPrefix + "/sbin";
     2621
     2622    @staticmethod
     2623    def getGuestWinDir(oTestVm):
     2624        """
     2625        Helper for finding the Windows directory in the test VM that we can play around with.
     2626        ASSUMES that we always install Windows on drive C.
     2627
     2628        Returns the Windows directory, or an empty string when executed on a non-Windows guest (asserts).
     2629        """
     2630        sWinDir = '';
     2631        if oTestVm.isWindows():
     2632            if oTestVm.sKind in ['WindowsNT4', 'WindowsNT3x',]:
     2633                sWinDir = 'C:/WinNT/';
     2634            else:
     2635                sWinDir = 'C:/Windows/';
     2636        assert sWinDir != '', 'Retrieving Windows directory for non-Windows OS';
     2637        return sWinDir;
    26252638
    26262639    @staticmethod
  • trunk/src/VBox/ValidationKit/tests/additions/tdAddBasic1.py

    r84454 r84482  
    420420        asLogFiles = [];
    421421        fHaveSetupApiDevLog = False;
    422         if oTestVm.sKind in ('WindowsNT4',):
    423             sWinDir = 'C:/WinNT/';
    424         else:
    425             sWinDir = 'C:/Windows/';
    426             asLogFiles = [sWinDir + 'setupapi.log', sWinDir + 'setupact.log', sWinDir + 'setuperr.log'];
    427 
    428             # Apply The SetupAPI logging level so that we also get the (most verbose) setupapi.dev.log file.
    429             ## @todo !!! HACK ALERT !!! Add the value directly into the testing source image. Later.
    430             fHaveSetupApiDevLog = self.txsRunTest(oTxsSession, 'Enabling setupapi.dev.log', 30 * 1000,
    431                                                   'reg.exe',
    432                                                   ('reg.exe', 'add',
    433                                                    '"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Setup"',
    434                                                    '/v', 'LogLevel', '/t', 'REG_DWORD', '/d', '0xFF'),
    435                                                    fCheckSessionStatus = True);
     422        sWinDir = self.getGuestWinDir(oTestVm);
     423        asLogFiles = [ oTestVm.pathJoin(sWinDir, 'setupapi.log'),
     424                       oTestVm.pathJoin(sWinDir, 'setupact.log'),
     425                       oTestVm.pathJoin(sWinDir, 'setuperr.log') ];
     426
     427        # Apply The SetupAPI logging level so that we also get the (most verbose) setupapi.dev.log file.
     428        ## @todo !!! HACK ALERT !!! Add the value directly into the testing source image. Later.
     429        sRegExe = oTestVm.pathJoin(self.getGuestSystemDir(oTestVm), 'reg.exe');
     430        fHaveSetupApiDevLog = self.txsRunTest(oTxsSession, 'Enabling setupapi.dev.log', 30 * 1000,
     431                                              sRegExe,
     432                                              (sRegExe, 'add',
     433                                               '"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Setup"',
     434                                               '/v', 'LogLevel', '/t', 'REG_DWORD', '/d', '0xFF'),
     435                                               fCheckSessionStatus = True);
    436436
    437437        for sFile in asLogFiles:
Note: See TracChangeset for help on using the changeset viewer.

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