VirtualBox

Ignore:
Timestamp:
Mar 30, 2020 12:56:39 PM (5 years ago)
Author:
vboxsync
Message:

Validation Kit/testdriver: Hack alert: Added sanitizeLogFlagsString() to support more than one log flag as command line argument (--vbox-XXX-log-flags).

File:
1 edited

Legend:

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

    r82968 r83479  
    10551055        return self.fImportedVBoxApi;
    10561056
     1057    def sanitizeLogFlagsString(self, sString):
     1058        """
     1059        Sanitizes a given log flag string by removing any separators (":" and ",") with
     1060        a space and removes quotes.
     1061
     1062        ## @todo !!! HACK ALERT !!! Needed until we have proper argument parsing / quoting support.
     1063        """
     1064        for ch in [ ':', ',' ]:
     1065            if ch in sString:
     1066                sString = sString.replace(ch, " ");
     1067        for ch in [ '\'', '"' ]:
     1068            if ch in sString:
     1069                sString = sString.replace(ch, "");
     1070        return sString;
     1071
    10571072    def _startVBoxSVC(self): # pylint: disable=too-many-statements
    10581073        """ Starts VBoxSVC. """
     
    10651080        except: pass;
    10661081        os.environ['VBOX_LOG']       = self.sLogSvcGroups;
    1067         os.environ['VBOX_LOG_FLAGS'] = '%s append' % (self.sLogSvcFlags,);  # Append becuse of VBoxXPCOMIPCD.
     1082        # Append because of VBoxXPCOMIPCD.
     1083        os.environ['VBOX_LOG_FLAGS'] = '%s append' % (self.sanitizeLogFlagsString(self.sLogSvcFlags),);
    10681084        if self.sLogSvcDest:
    10691085            os.environ['VBOX_LOG_DEST'] = 'nodeny ' + self.sLogSvcDest;
     
    12911307        except: pass;
    12921308        os.environ['VBOX_LOG']       = self.sLogSelfGroups;
    1293         os.environ['VBOX_LOG_FLAGS'] = '%s append' % (self.sLogSelfFlags, );
     1309        os.environ['VBOX_LOG_FLAGS'] = '%s append' % (self.sanitizeLogFlagsString(self.sLogSelfFlags), );
    12941310        if self.sLogSelfDest:
    12951311            os.environ['VBOX_LOG_DEST'] = 'nodeny ' + self.sLogSelfDest;
     
    18111827            iArg += 1;
    18121828            if iArg >= len(asArgs):
    1813                 raise base.InvalidOption('The "--vbox-svc-flags" takes an argument');
     1829                raise base.InvalidOption('The "--vbox-log-flags" takes an argument');
    18141830            self.sLogSelfFlags     = asArgs[iArg];
    18151831            self.sLogSessionFlags  = asArgs[iArg];
     
    27672783        asEnvFinal = [
    27682784            'VBOX_LOG=%s' % (self.sLogSessionGroups,),
    2769             'VBOX_LOG_FLAGS=%s' % (self.sLogSessionFlags,),
     2785            'VBOX_LOG_FLAGS=%s' % (self.sanitizeLogFlagsString(self.sLogSessionFlags),),
    27702786            'VBOX_LOG_DEST=nodeny %s' % (sLogDest,),
    27712787            'VBOX_RELEASE_LOG_FLAGS=append time',
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