Changeset 103389 in vbox
- Timestamp:
- Feb 15, 2024 2:24:19 PM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/unittests/tdUnitTest1.py
r103286 r103389 401 401 self.oTxsSession = None; 402 402 403 # The VirtualBox installation root directory. 403 404 self.sVBoxInstallRoot = None; 404 405 405 406 ## 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. 412 409 self.sMode = 'local'; 413 410 … … 417 414 418 415 ## 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 420 418 # 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. 421 422 self.sUnitTestsPathSrc = None; 422 423 … … 457 458 """ 458 459 459 reporter.log2('Detecting paths ...');460 reporter.log2('Detecting paths (mode is "%s") ...' % ("remot" if self.isRemoteMode() else "local",)); 460 461 461 462 # 462 463 # We need a VBox install (/ build) to test. 463 464 # 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; 472 468 473 469 # … … 475 471 # Solaris requires special handling because of it's multi arch subdirs. 476 472 # 477 if not self.sVBoxInstallRoot and self. sMode == 'remote-exec':473 if not self.sVBoxInstallRoot and self.isRemoteMode(): 478 474 self.sVBoxInstallRoot = '${CDROM}/${OS}/${ARCH}'; 479 475 … … 499 495 reporter.log2('VBox installation root already set to "%s"' % (self.sVBoxInstallRoot)); 500 496 497 reporter.log('VBox installation root path: %s' % (self.sVBoxInstallRoot,)); 498 501 499 self.sVBoxInstallRoot = self._sanitizePath(self.sVBoxInstallRoot); 502 500 … … 504 502 # The unittests are generally not installed, so look for them. 505 503 # 506 if not self.sUnitTestsPathSrc and self. sMode == 'remote-exec':504 if not self.sUnitTestsPathSrc and self.isRemoteMode(): 507 505 self.sUnitTestsPathSrc = '${CDROM}/testcase/${OS}/${ARCH}'; 508 506 … … 545 543 else: 546 544 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,)); 548 547 549 548 self.sUnitTestsPathSrc = self._sanitizePath(self.sUnitTestsPathSrc); … … 564 563 reporter.log(' --dryrun'); 565 564 reporter.log(' Performs a dryrun (no tests being executed).'); 566 reporter.log(' --mode <local|remote -copy|remote-exec>');565 reporter.log(' --mode <local|remote>'); 567 566 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).'); 571 569 reporter.log(' --only-whitelist'); 572 570 reporter.log(' Only processes the white list.'); … … 591 589 if iArg >= len(asArgs): 592 590 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',): 594 592 self.sMode = asArgs[iArg]; 595 593 else: … … 730 728 reporter.log(' Exe suffix: %s' % (self.sExeSuff,)); 731 729 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 '',)); 733 731 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 '',)); 735 733 reporter.log('*********************************************************'); 736 734 reporter.log('*** PASSED: %d' % (self.cPassed,)); … … 941 939 self._logExpandString(sSrc); 942 940 self._logExpandString(sDst); 943 if self. sMode == 'remote-exec':941 if self.isRemoteMode(): 944 942 self.oTxsSession.syncCopyFile(sSrc, sDst, iMode); 945 943 else: … … 1019 1017 # work. They also have to be executed as root, i.e. via sudo. 1020 1018 # 1021 # When executing test remotely we must also copy stuff over to the1022 # remote location. Currently there is no diferent between remote-copy1023 # and remote-exec here, which it would be nice if Andy could explain...1024 #1025 ## @todo r=bird: Please explain + fix ^^.1026 1019 fHardened = sName in self.kasHardened and self.sUnitTestsPathSrc != self.sVBoxInstallRoot; 1027 1020 asFilesToRemove = []; # Stuff to clean up. … … 1040 1033 # If the testcase source does not exist for whatever reason, just mark it as skipped 1041 1034 # 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; 1046 1038 1047 1039 sDst = os.path.join(sDstDir, os.path.basename(sFilePathAbs)); … … 1054 1046 asFilesToRemove.append(sDst); 1055 1047 1056 # Copy required dependencies to destination 1048 # Copy required dependencies to destination. 1057 1049 # Note! The testcases are statically linked, so there are no VBoxRT.dll/so/dylib 1058 1050 # to copy here. This code can be currently be ignored. … … 1067 1059 asFilesToRemove.append(sDst); 1068 1060 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. 1070 1062 ## It makes for very confusing reading and is a potential for trouble. 1071 1063 … … 1244 1236 # 1245 1237 if not self.fOnlyWhiteList: 1246 if self.sMode in ('local', 'remote-copy'):1238 if not self.isRemoteMode(): 1247 1239 asFiles = sorted(os.listdir(os.path.join(self.sUnitTestsPathSrc, sTestCaseSubDir))); 1248 else: # 'remote -exec'1240 else: # 'remote' 1249 1241 ## @todo Implement remote file enumeration / directory listing. 1250 1242 reporter.error('Sorry, no remote file enumeration implemented yet!\nUse --only-whitelist instead.'); … … 1260 1252 # When executing in remote execution mode, make sure to append the executable suffix here, as 1261 1253 # the (white / black) lists do not contain any OS-specific executable suffixes. 1262 if self. sMode == 'remote-exec':1254 if self.isRemoteMode(): 1263 1255 sFilename = sFilename + self.sExeSuff; 1264 1256 # Separate base and suffix and morph the base into something we
Note:
See TracChangeset
for help on using the changeset viewer.