VirtualBox

Changeset 93038 in vbox


Ignore:
Timestamp:
Dec 21, 2021 11:08:23 AM (3 years ago)
Author:
vboxsync
Message:

Validation Kit/Guest Control: Cleaned up + simplified manual debugging mode.

File:
1 edited

Legend:

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

    r93037 r93038  
    13521352    Contains local test debug settings.
    13531353    """
    1354     def __init__(self, sImgPath = None):
    1355         self.sImgPath = sImgPath;
     1354    def __init__(self, sVBoxServiceExeHst = None):
     1355        self.sVBoxServiceExeHst = sVBoxServiceExeHst;
    13561356        self.sGstVBoxServiceLogPath = '';
    13571357        self.fNoExit = False;
     
    13751375            'update_additions'
    13761376        ];
    1377         self.asTests        = self.asTestsDef;
    1378         self.fSkipKnownBugs = False;
    1379         self.oTestFiles     = None # type: vboxtestfileset.TestFileSet
    1380         self.oDebug         = tdDebugSettings();
     1377        self.asTests                = self.asTestsDef;
     1378        self.fSkipKnownBugs         = False;
     1379        self.oTestFiles             = None # type: vboxtestfileset.TestFileSet
     1380        self.oDebug                 = tdDebugSettings();
     1381        self.sPathVBoxServiceExeGst = '';
    13811382
    13821383    def parseOption(self, asArgs, iArg):                                        # pylint: disable=too-many-branches,too-many-statements
     
    14021403            iArg += 1;
    14031404            iNext = self.oTstDrv.requireMoreArgs(1, asArgs, iArg);
    1404             self.oDebug.sImgPath = asArgs[iArg];
     1405            self.oDebug.sVBoxServiceExeHst = asArgs[iArg];
    14051406            return iNext;
    14061407        if asArgs[iArg] == '--add-guest-ctrl-debug-no-exit':
     
    14281429        Returns fRc, oTxsSession.  The latter may have changed.
    14291430        """
     1431
     1432        self.sPathVBoxServiceExeGst =   oTestVm.pathJoin(self.oTstDrv.getGuestSystemAdminDir(oTestVm), 'VBoxService') \
     1433                                      + base.exeSuff();
     1434
    14301435        reporter.log("Active tests: %s" % (self.asTests,));
    14311436
     
    15071512        """
    15081513
    1509         if self.oDebug.sImgPath is None: # If no debugging enabled, bail out.
     1514        if self.oDebug.sVBoxServiceExeHst is None: # If no debugging enabled, bail out.
    15101515            reporter.log('Skipping debugging');
    1511             return True
     1516            return True;
    15121517
    15131518        reporter.log('Preparing for debugging ...');
    15141519
    15151520        try:
    1516 
    15171521            self.vboxServiceControl(oTxsSession, oTestVm, fStart = False);
    15181522
     1523            self.oTstDrv.sleep(5); # Fudge factor -- wait until the service stopped.
     1524
     1525            reporter.log('Uploading "%s" to "%s" ...' % (self.oDebug.sVBoxServiceExeHst, self.sPathVBoxServiceExeGst));
     1526            oTxsSession.syncUploadFile(self.oDebug.sVBoxServiceExeHst, self.sPathVBoxServiceExeGst);
     1527
    15191528            if oTestVm.isLinux():
    1520                 reporter.log('Uploading %s ...' % self.oDebug.sImgPath);
    1521                 sFileVBoxServiceHst = self.oDebug.sImgPath;
    1522                 sFileVBoxServiceGst = "/tmp/VBoxService-txs";
    1523                 oTxsSession.syncUploadFile(sFileVBoxServiceHst, sFileVBoxServiceGst);
    1524                 oTxsSession.syncChMod(sFileVBoxServiceGst, 0o755);
    1525                 reporter.log('Executing VBoxService (in background)...');
    1526                 oTxsSession.syncExec(sFileVBoxServiceGst, (sFileVBoxServiceGst, "-vvvv", "--only-control", \
    1527                                                            "--control-dump-stdout", "--control-dump-stderr", \
    1528                                                            "--logfile", "/tmp/VBoxService-txs.log") );
    1529             elif oTestVm.isWindows():
    1530                 reporter.log('Uploading %s ...' % self.oDebug.sImgPath);
    1531                 sFileVBoxServiceHst = self.oDebug.sImgPath;
    1532                 sFileVBoxServiceGst = os.path.join(self.oTstDrv.getGuestSystemDir(oTestVm), 'VBoxService.exe');
    1533                 oTxsSession.syncUploadFile(sFileVBoxServiceHst, sFileVBoxServiceGst);
    1534                 sPathSC = os.path.join(self.oTstDrv.getGuestSystemDir(oTestVm), 'sc.exe');
    1535                 oTxsSession.syncExec(sPathSC, (sPathSC, "stop", "VBoxService") );
    1536                 time.sleep(5);
    1537                 oTxsSession.syncExec(sPathSC, (sPathSC, "start", "VBoxService") );
    1538 
    1539             else: ## @todo Implement others.
    1540                 reporter.log('Debugging not available on this guest OS yet, skipping ...');
     1529                oTxsSession.syncChMod(self.sPathVBoxServiceExeGst, 0o755);
    15411530
    15421531            self.vboxServiceControl(oTxsSession, oTestVm, fStart = True);
     1532
     1533            self.oTstDrv.sleep(5); # Fudge factor -- wait until the service is ready.
    15431534
    15441535        except:
     
    16481639            fEnableVerboseLogging = True;
    16491640
    1650         # If debugging mode is disabled, enable logging -- otherwise a manually set up logging could clash here.
    1651         if not self.oDebug.sImgPath:
    1652             fEnableVerboseLogging = True;
    1653 
    16541641        # Old TxS versions had a bug which caused an infinite loop when executing stuff containing "$xxx",
    16551642        # so check if we got the version here first and skip enabling verbose logging nonetheless if needed.
    16561643        if not fGotTxsVer:
     1644            reporter.log('Too old TxS service running')
    16571645            fEnableVerboseLogging = False;
    16581646
     
    16601648        # Enable VBoxService verbose logging.
    16611649        #
     1650        reporter.log('Enabling verbose VBoxService logging: %s' % (fEnableVerboseLogging));
    16621651        if fEnableVerboseLogging:
    16631652            self.oDebug.sGstVBoxServiceLogPath = oTestVm.pathJoin(self.oTstDrv.getGuestTempDir(oTestVm), "VBoxService");
     
    16711660            if oTestVm.isWindows():
    16721661                sPathRegExe         = oTestVm.pathJoin(self.oTstDrv.getGuestSystemDir(oTestVm), 'reg.exe');
    1673                 sPathVBoxServiceExe = oTestVm.pathJoin(self.oTstDrv.getGuestSystemDir(oTestVm), 'VBoxService.exe');
    1674                 sImagePath          = '%s -vvvv --logfile %s' % (sPathVBoxServiceExe, sPathLogFile);
     1662                sImagePath          = '%s -vvvv --logfile %s' % (self.sPathVBoxServiceExeGst, sPathLogFile);
    16751663                fRestartVBoxService = self.oTstDrv.txsRunTest(oTxsSession, 'Enabling VBoxService verbose logging (via registry)',
    16761664                                         30 * 1000,
     
    16941682            if fRestartVBoxService:
    16951683                self.vboxServiceControl(oTxsSession, oTestVm, fStart = False);
    1696                 time.sleep(5);
     1684                self.oTstDrv.sleep(5);
    16971685                self.vboxServiceControl(oTxsSession, oTestVm, fStart = True);
    16981686            else:
     
    17031691                if not fRc:
    17041692                    return False;
    1705         else:
    1706             reporter.log('Skipping VBoxService enabling verbose logging (too old TxS service running)')
    17071693
    17081694        #
     
    52285214            # Cleanup.
    52295215            self.removeTask(oTxsSession);
    5230             if not self.aoSubTstDrvs[0].oDebug.fNoExit:
     5216            if self.aoSubTstDrvs[0].oDebug.fNoExit:
     5217                self.sleep(60 * 60 * 1000); # Leave the VM session open for manual inspection / debugging.
     5218            else:
    52315219                self.terminateVmBySession(oSession);
    52325220        else:
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