VirtualBox

Ignore:
Timestamp:
Jan 13, 2023 1:08:38 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
155202
Message:

Validation Kit/tdUnitTest1.py: Fixed running locally on Windows (hosts).

File:
1 edited

Legend:

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

    r98070 r98074  
    977977        return True;
    978978
    979     def _executeTestCase(self, oTestVm, sName, sFullPath, sTestCaseSubDir, oDevNull): # pylint: disable=too-many-locals,too-many-statements
     979    def _executeTestCase(self, oTestVm, sName, sFilePathAbs, sTestCaseSubDir, oDevNull): # pylint: disable=too-many-locals,too-many-statements
    980980        """
    981981        Executes a test case.
     982
     983        sFilePathAbs contains the absolute path (including OS-dependent executable suffix) of the testcase.
     984
     985        Returns @c true if testcase was skipped, or @c if not.
    982986        """
    983987
     
    10051009                asDirsToRemove.append(sDstDir);
    10061010
    1007             sSrc = sFullPath + self.sExeSuff;
     1011            sSrc = sFilePathAbs;
    10081012            # If the testcase source does not exist for whatever reason, just mark it as skipped
    10091013            # instead of reporting an error.
     
    10131017                return fSkipped;
    10141018
    1015             sDst = os.path.join(sDstDir, os.path.basename(sFullPath) + self.sExeSuff);
     1019            sDst = os.path.join(sDstDir, os.path.basename(sFilePathAbs));
    10161020            fModeExe  = 0;
    10171021            fModeDeps = 0;
     
    10351039            # Copy any associated .dll/.so/.dylib.
    10361040            for sSuff in [ '.dll', '.so', '.dylib' ]:
    1037                 sSrc = os.path.splitext(sFullPath)[0] + sSuff;
     1041                sSrc = os.path.splitext(sFilePathAbs)[0] + sSuff;
    10381042                if os.path.exists(sSrc):
    10391043                    sDst = os.path.join(sDstDir, os.path.basename(sSrc));
     
    10421046
    10431047            # Copy any associated .r0, .rc and .gc modules.
    1044             offDriver = sFullPath.rfind('Driver')
     1048            offDriver = sFilePathAbs.rfind('Driver')
    10451049            if offDriver > 0:
    10461050                for sSuff in [ '.r0', 'RC.rc', 'RC.gc' ]:
    1047                     sSrc = sFullPath[:offDriver] + sSuff;
     1051                    sSrc = sFilePathAbs[:offDriver] + sSuff;
    10481052                    if os.path.exists(sSrc):
    10491053                        sDst = os.path.join(sDstDir, os.path.basename(sSrc));
     
    10511055                        asFilesToRemove.append(sDst);
    10521056
    1053             sFullPath = os.path.join(sDstDir, os.path.basename(sFullPath));
     1057            sFilePathAbs = os.path.join(sDstDir, os.path.basename(sFilePathAbs));
    10541058
    10551059        #
    10561060        # Set up arguments and environment.
    10571061        #
    1058         asArgs = [sFullPath + self.sExeSuff,]
     1062        asArgs = [sFilePathAbs,]
    10591063        if sName in self.kdArguments:
    10601064            asArgs.extend(self.kdArguments[sName]);
     
    11391143
    11401144        if iRc == 0:
    1141             reporter.log('*** %s: exit code %d' % (sFullPath, iRc));
     1145            reporter.log('*** %s: exit code %d' % (sFilePathAbs, iRc));
    11421146            self.cPassed += 1;
    11431147
    11441148        elif iRc == 4: # RTEXITCODE_SKIPPED
    1145             reporter.log('*** %s: exit code %d (RTEXITCODE_SKIPPED)' % (sFullPath, iRc));
     1149            reporter.log('*** %s: exit code %d (RTEXITCODE_SKIPPED)' % (sFilePathAbs, iRc));
    11461150            fSkipped = True;
    11471151            self.cSkipped += 1;
    11481152
    11491153        elif fSkipped:
    1150             reporter.log('*** %s: exit code %d (Skipped)' % (sFullPath, iRc));
     1154            reporter.log('*** %s: exit code %d (Skipped)' % (sFilePathAbs, iRc));
    11511155            self.cSkipped += 1;
    11521156
     
    11601164            if iRc != 1:
    11611165                reporter.testFailure('Exit status: %d%s' % (iRc, sName));
    1162                 reporter.log(  '!*! %s: exit code %d%s' % (sFullPath, iRc, sName));
     1166                reporter.log(  '!*! %s: exit code %d%s' % (sFilePathAbs, iRc, sName));
    11631167            else:
    1164                 reporter.error('!*! %s: exit code %d%s' % (sFullPath, iRc, sName));
     1168                reporter.error('!*! %s: exit code %d%s' % (sFilePathAbs, iRc, sName));
    11651169            self.cFailed += 1;
    11661170
     
    12031207
    12041208        for sFilename in asFiles:
     1209            # When executing in remote execution mode, make sure to append the executable suffix here, as
     1210            # the (white / black) lists do not contain any OS-specific executable suffixes.
     1211            if self.sMode in ('remote-exec'):
     1212                sFilename = sFilename + self.sExeSuff;
    12051213            # Separate base and suffix and morph the base into something we
    12061214            # can use for reporting and array lookups.
     
    12141222
    12151223            # Process white list first, if set.
    1216             if self.fOnlyWhiteList  and  not self._isExcluded(sName, self.kdTestCasesWhiteList):
     1224            if  self.fOnlyWhiteList \
     1225            and not self._isExcluded(sName, self.kdTestCasesWhiteList):
    12171226                # (No testStart/Done or accounting here!)
    12181227                reporter.log('%s: SKIPPED (not in white list)' % (sName,));
     
    12201229
    12211230            # Basic exclusion.
    1222             if  not re.match(sTestCasePattern, sBaseName)  or  sSuffix in self.kasSuffixBlackList:
     1231            if  not re.match(sTestCasePattern, sBaseName) \
     1232            or  sSuffix in self.kasSuffixBlackList:
    12231233                reporter.log2('"%s" is not a test case.' % (sName,));
    12241234                continue;
     
    12491259                pass;
    12501260
    1251             sFullPath = os.path.normpath(os.path.join(self.sUnitTestsPathSrc, os.path.join(sTestCaseSubDir, sFilename)));
     1261            sFilePathAbs = os.path.normpath(os.path.join(self.sUnitTestsPathSrc, os.path.join(sTestCaseSubDir, sFilename)));
     1262            reporter.log2('sFilePathAbs=%s\n' % (sFilePathAbs,));
    12521263            reporter.testStart(sName);
    12531264            try:
    1254                 fSkipped = self._executeTestCase(oTestVm, sName, sFullPath, sTestCaseSubDir, oDevNull);
     1265                fSkipped = self._executeTestCase(oTestVm, sName, sFilePathAbs, sTestCaseSubDir, oDevNull);
    12551266            except:
    12561267                reporter.errorXcpt('!*!');
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