VirtualBox

Ignore:
Timestamp:
Feb 15, 2024 10:31:06 AM (10 months ago)
Author:
vboxsync
Message:

Validation Kit/testdriver: Added and internal _printEnv() which can log (stripped) environment blocks.

File:
1 edited

Legend:

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

    r103076 r103380  
    11171117        return self.fImportedVBoxApi;
    11181118
     1119    def _printEnv(self, dEnv = os.environ, fRaw = False):
     1120        """
     1121        Prints the given environment block to log2.
     1122
     1123        Uses the default environment block if not specified explicitly.
     1124        Removes any control characters found to not mess up the screen output.
     1125        """
     1126        for sKey, sVal in sorted(dEnv.items()):
     1127            reporter.log2('%s=%s' % (sKey, sVal if fRaw else re.sub(r'[\x00-\x1f]', '', sVal)));
     1128
    11191129    def _startVBoxSVC(self): # pylint: disable=too-many-statements
    11201130        """ Starts VBoxSVC. """
     
    11351145
    11361146        reporter.log2('VBoxSVC environment:');
    1137         for sKey, sVal in sorted(os.environ.items()):
    1138             reporter.log2('%s=%s' % (sKey, sVal));
     1147        self._printEnv();
    11391148
    11401149        # Always leave a pid file behind so we can kill it during cleanup-before.
     
    13871396
    13881397        reporter.log2('Self environment:');
    1389         for sKey, sVal in sorted(os.environ.items()):
    1390             reporter.log2('%s=%s' % (sKey, sVal));
     1398        self._printEnv();
    13911399
    13921400        # Hack the sys.path + environment so the vboxapi can be found.
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