VirtualBox

Changeset 103389 in vbox


Ignore:
Timestamp:
Feb 15, 2024 2:24:19 PM (11 months ago)
Author:
vboxsync
Message:

Validation Kit/tdUnitTest1: Resolved some @todos. The execution syntax for remote tests changed from "remote-exec" to "remote". "remote-copy" has been removed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/unittests/tdUnitTest1.py

    r103286 r103389  
    401401        self.oTxsSession = None;
    402402
     403        # The VirtualBox installation root directory.
    403404        self.sVBoxInstallRoot = None;
    404405
    405406        ## Testing mode being used:
    406         #   "local":       Execute unit tests locally (same host, default).
    407         #   "remote-copy": Copies unit tests from host to the remote, then executing it.
    408         #   "remote-exec": Executes unit tests right on the remote from a given source.
    409         ## @todo r=bird: 'remote-exec' and 'remote-copy' are confusing. We're presumably executing the test remotely in both
    410         ## cases, the different being that in the latter case we copy from the valkit iso rather than uploading the test files.
    411         ## That's hardly clear from the names or the explanation.
     407        #   "local":  Execute unit tests locally (same host, default).
     408        #   "remote": Executes unit tests right on the remote from a given source.
    412409        self.sMode      = 'local';
    413410
     
    417414
    418415        ## The source directory where our unit tests live.
    419         # This most likely is our out/ or some staging directory and
     416        #
     417        # For local mode this is our out/ or some staging directory and
    420418        # also acts the source for copying over the testcases to a remote target.
     419        #
     420        # For remote remote this is the ${CDROM} directory where we ship the included
     421        # testcases on the Validation Kit ISO.
    421422        self.sUnitTestsPathSrc = None;
    422423
     
    457458        """
    458459
    459         reporter.log2('Detecting paths ...');
     460        reporter.log2('Detecting paths (mode is "%s") ...' % ("remot" if self.isRemoteMode() else "local",));
    460461
    461462        #
    462463        # We need a VBox install (/ build) to test.
    463464        #
    464         if False is True: ## @todo r=andy ?? # pylint: disable=comparison-of-constants
    465             if not self.importVBoxApi():
    466                 return False;
    467         else:
    468             self._detectBuild();
    469             if self.oBuild is None:
    470                 reporter.error('Unabled to detect the VBox build.');
    471                 return False;
     465        if not self._detectBuild():
     466            reporter.error('Unabled to detect the VBox build.');
     467            return False;
    472468
    473469        #
     
    475471        # Solaris requires special handling because of it's multi arch subdirs.
    476472        #
    477         if not self.sVBoxInstallRoot and self.sMode == 'remote-exec':
     473        if not self.sVBoxInstallRoot and self.isRemoteMode():
    478474            self.sVBoxInstallRoot = '${CDROM}/${OS}/${ARCH}';
    479475
     
    499495            reporter.log2('VBox installation root already set to "%s"' % (self.sVBoxInstallRoot));
    500496
     497        reporter.log('VBox installation root path: %s' % (self.sVBoxInstallRoot,));
     498
    501499        self.sVBoxInstallRoot = self._sanitizePath(self.sVBoxInstallRoot);
    502500
     
    504502        # The unittests are generally not installed, so look for them.
    505503        #
    506         if not self.sUnitTestsPathSrc and self.sMode == 'remote-exec':
     504        if not self.sUnitTestsPathSrc and self.isRemoteMode():
    507505            self.sUnitTestsPathSrc = '${CDROM}/testcase/${OS}/${ARCH}';
    508506
     
    545543        else:
    546544            reporter.log2('Unit test source dir already set to "%s"' % (self.sUnitTestsPathSrc))
    547             reporter.log('Unit test source dir path: ', self.sUnitTestsPathSrc)
     545
     546        reporter.log('Unit test source dir path: %s' % (self.sUnitTestsPathSrc,));
    548547
    549548        self.sUnitTestsPathSrc = self._sanitizePath(self.sUnitTestsPathSrc);
     
    564563        reporter.log('  --dryrun');
    565564        reporter.log('      Performs a dryrun (no tests being executed).');
    566         reporter.log('  --mode <local|remote-copy|remote-exec>');
     565        reporter.log('  --mode <local|remote>');
    567566        reporter.log('      Specifies the test execution mode:');
    568         reporter.log('      local:       Locally on the same machine.');
    569         reporter.log('      remote-copy: On remote (guest) by copying them from the local source. (BORKED!)');
    570         reporter.log('      remote-exec: On remote (guest) directly (needs unit test source).');
     567        reporter.log('      local:  Locally on the same machine.');
     568        reporter.log('      remote: On remote (guest) directly (needs unit test source).');
    571569        reporter.log('  --only-whitelist');
    572570        reporter.log('      Only processes the white list.');
     
    591589            if iArg >= len(asArgs):
    592590                raise base.InvalidOption('Option "%s" needs a value' % (asArgs[iArg - 1]));
    593             if asArgs[iArg] in ('local', 'remote-copy', 'remote-exec',):
     591            if asArgs[iArg] in ('local', 'remote',):
    594592                self.sMode = asArgs[iArg];
    595593            else:
     
    730728        reporter.log('       Exe suffix: %s' % (self.sExeSuff,));
    731729        reporter.log('Unit tests source: %s %s'
    732                      % (self.sUnitTestsPathSrc, '(on remote)' if self.sMode == 'remote-exec' else '',));
     730                     % (self.sUnitTestsPathSrc, '(on remote)' if self.isRemoteMode() else '',));
    733731        reporter.log('VBox install root: %s %s'
    734                      % (self.sVBoxInstallRoot, '(on remote)' if self.sMode == 'remote-exec' else '',));
     732                     % (self.sVBoxInstallRoot, '(on remote)' if self.isRemoteMode() else '',));
    735733        reporter.log('*********************************************************');
    736734        reporter.log('***  PASSED: %d' % (self.cPassed,));
     
    941939            self._logExpandString(sSrc);
    942940            self._logExpandString(sDst);
    943             if self.sMode == 'remote-exec':
     941            if self.isRemoteMode():
    944942                self.oTxsSession.syncCopyFile(sSrc, sDst, iMode);
    945943            else:
     
    10191017        # work.  They also have to be executed as root, i.e. via sudo.
    10201018        #
    1021         # When executing test remotely we must also copy stuff over to the
    1022         # remote location.  Currently there is no diferent between remote-copy
    1023         # and remote-exec here, which it would be nice if Andy could explain...
    1024         #
    1025         ## @todo r=bird: Please explain + fix ^^.
    10261019        fHardened       = sName in self.kasHardened and self.sUnitTestsPathSrc != self.sVBoxInstallRoot;
    10271020        asFilesToRemove = []; # Stuff to clean up.
     
    10401033            # If the testcase source does not exist for whatever reason, just mark it as skipped
    10411034            # instead of reporting an error.
    1042             if not self._wrapPathExists(sSrc): ## @todo r=bird: This doesn't add up for me with the two remote modes.
    1043                 self.cSkipped += 1;            ## It seems to presuppose that we're in remote-exec mode as _wrapPathExists
    1044                 fSkipped = True;               ## does not differentiate between the two remote modes and will always check
    1045                 return fSkipped;               ## the path on the remote side.
     1035            if not self._wrapPathExists(sSrc):
     1036                self.cSkipped += 1;
     1037                return True;
    10461038
    10471039            sDst = os.path.join(sDstDir, os.path.basename(sFilePathAbs));
     
    10541046            asFilesToRemove.append(sDst);
    10551047
    1056             # Copy required dependencies to destination .
     1048            # Copy required dependencies to destination.
    10571049            # Note! The testcases are statically linked, so there are no VBoxRT.dll/so/dylib
    10581050            #       to copy here.  This code can be currently be ignored.
     
    10671059                            asFilesToRemove.append(sDst);
    10681060
    1069             ## @todo r=bird: The next two are check for _local_ files matching the remote path when in remote-mode.
     1061            ## @todo r=bird: The next two are checks for _local_ files matching the remote path when in remote-mode.
    10701062            ##               It makes for very confusing reading and is a potential for trouble.
    10711063
     
    12441236        #
    12451237        if not self.fOnlyWhiteList:
    1246             if self.sMode in ('local', 'remote-copy'):
     1238            if not self.isRemoteMode():
    12471239                asFiles = sorted(os.listdir(os.path.join(self.sUnitTestsPathSrc, sTestCaseSubDir)));
    1248             else: # 'remote-exec'
     1240            else: # 'remote'
    12491241                ## @todo Implement remote file enumeration / directory listing.
    12501242                reporter.error('Sorry, no remote file enumeration implemented yet!\nUse --only-whitelist instead.');
     
    12601252            # When executing in remote execution mode, make sure to append the executable suffix here, as
    12611253            # the (white / black) lists do not contain any OS-specific executable suffixes.
    1262             if self.sMode == 'remote-exec':
     1254            if self.isRemoteMode():
    12631255                sFilename = sFilename + self.sExeSuff;
    12641256            # Separate base and suffix and morph the base into something we
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