- Timestamp:
- Mar 31, 2022 9:07:13 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/unittests/tdUnitTest1.py
r94400 r94405 399 399 400 400 # 401 # Do some sanity checking first. 402 # 403 if self.sMode == 'remote-exec' \ 404 and not self.sUnitTestsPathSrc: # There is no way we can figure this out automatically. 405 reporter.error('Unit tests source must be specified explicitly for selected mode!'); 406 return False; 407 408 # 401 409 # We need a VBox install (/ build) to test. 402 410 # 403 411 if False is True: ## @todo r=andy WTF? 404 412 if not self.importVBoxApi(): 405 reporter.error('Unabled to import the VBox Python API.') 406 return False 413 reporter.error('Unabled to import the VBox Python API.'); 414 return False; 407 415 else: 408 416 self._detectBuild(); … … 415 423 # Solaris requires special handling because of it's multi arch subdirs. 416 424 # 417 self.sVBoxInstallRoot = self.oBuild.sInstallPath 418 if not self.oBuild.isDevBuild() and utils.getHostOs() == 'solaris': 419 sArchDir = utils.getHostArch(); 420 if sArchDir == 'x86': sArchDir = 'i386'; 421 self.sVBoxInstallRoot = os.path.join(self.sVBoxInstallRoot, sArchDir); 422 423 # Add the installation root to the PATH on windows so we can get DLLs from it. 424 if utils.getHostOs() == 'win': 425 sPathName = 'PATH'; 426 if not sPathName in os.environ: 427 sPathName = 'Path'; 428 sPath = os.environ.get(sPathName, '.'); 429 if sPath and sPath[-1] != ';': 430 sPath += ';'; 431 os.environ[sPathName] = sPath + self.sVBoxInstallRoot + ';'; 425 if not self.sVBoxInstallRoot: 426 self.sVBoxInstallRoot = self.oBuild.sInstallPath; 427 if not self.oBuild.isDevBuild() and utils.getHostOs() == 'solaris': 428 sArchDir = utils.getHostArch(); 429 if sArchDir == 'x86': sArchDir = 'i386'; 430 self.sVBoxInstallRoot = os.path.join(self.sVBoxInstallRoot, sArchDir); 431 432 ## @todo r=andy Make sure the install root really exists and is accessible. 433 434 # Add the installation root to the PATH on windows so we can get DLLs from it. 435 if utils.getHostOs() == 'win': 436 sPathName = 'PATH'; 437 if not sPathName in os.environ: 438 sPathName = 'Path'; 439 sPath = os.environ.get(sPathName, '.'); 440 if sPath and sPath[-1] != ';': 441 sPath += ';'; 442 os.environ[sPathName] = sPath + self.sVBoxInstallRoot + ';'; 443 else: 444 reporter.log2('VBox installation root already set to "%s"' % (self.sVBoxInstallRoot)); 432 445 433 446 # 434 447 # The unittests are generally not installed, so look for them. 435 448 # 436 sBinOrDist = 'dist' if utils.getHostOs() in [ 'darwin', ] else 'bin'; 437 asCandidates = [ 438 self.oBuild.sInstallPath, 439 os.path.join(self.sScratchPath, utils.getHostOsDotArch(), self.oBuild.sType, sBinOrDist), 440 os.path.join(self.sScratchPath, utils.getHostOsDotArch(), 'release', sBinOrDist), 441 os.path.join(self.sScratchPath, utils.getHostOsDotArch(), 'debug', sBinOrDist), 442 os.path.join(self.sScratchPath, utils.getHostOsDotArch(), 'strict', sBinOrDist), 443 os.path.join(self.sScratchPath, utils.getHostOsDotArch(), 'dbgopt', sBinOrDist), 444 os.path.join(self.sScratchPath, utils.getHostOsDotArch(), 'profile', sBinOrDist), 445 os.path.join(self.sScratchPath, sBinOrDist + '.' + utils.getHostArch()), 446 os.path.join(self.sScratchPath, sBinOrDist, utils.getHostArch()), 447 os.path.join(self.sScratchPath, sBinOrDist), 448 ]; 449 if utils.getHostOs() == 'darwin': 450 for i in range(1, len(asCandidates)): 451 asCandidates[i] = os.path.join(asCandidates[i], 'VirtualBox.app', 'Contents', 'MacOS'); 452 453 for sCandidat in asCandidates: 454 if os.path.exists(os.path.join(sCandidat, 'testcase', 'tstVMStructSize' + self.sExeSuff)): 455 self.sUnitTestsPathSrc = sCandidat; 456 return True; 457 458 reporter.error('Unable to find unit test dir. Candidates: %s' % (asCandidates,)) 459 return False; 449 if not self.sUnitTestsPathSrc: 450 sBinOrDist = 'dist' if utils.getHostOs() in [ 'darwin', ] else 'bin'; 451 asCandidates = [ 452 self.oBuild.sInstallPath, 453 os.path.join(self.sScratchPath, utils.getHostOsDotArch(), self.oBuild.sType, sBinOrDist), 454 os.path.join(self.sScratchPath, utils.getHostOsDotArch(), 'release', sBinOrDist), 455 os.path.join(self.sScratchPath, utils.getHostOsDotArch(), 'debug', sBinOrDist), 456 os.path.join(self.sScratchPath, utils.getHostOsDotArch(), 'strict', sBinOrDist), 457 os.path.join(self.sScratchPath, utils.getHostOsDotArch(), 'dbgopt', sBinOrDist), 458 os.path.join(self.sScratchPath, utils.getHostOsDotArch(), 'profile', sBinOrDist), 459 os.path.join(self.sScratchPath, sBinOrDist + '.' + utils.getHostArch()), 460 os.path.join(self.sScratchPath, sBinOrDist, utils.getHostArch()), 461 os.path.join(self.sScratchPath, sBinOrDist), 462 ]; 463 if utils.getHostOs() == 'darwin': 464 for i in range(1, len(asCandidates)): 465 asCandidates[i] = os.path.join(asCandidates[i], 'VirtualBox.app', 'Contents', 'MacOS'); 466 467 for sCandidat in asCandidates: 468 if os.path.exists(os.path.join(sCandidat, 'testcase', 'tstVMStructSize' + self.sExeSuff)): 469 self.sUnitTestsPathSrc = sCandidat; 470 break; 471 472 if not self.sUnitTestsPathSrc: 473 reporter.error('Unable to find unit test source dir. Candidates: %s' % (asCandidates,)); 474 return False; 475 else: 476 reporter.log2('Unit test source dir already set to "%s"' % (self.sUnitTestsPathSrc)); 477 478 return True; 460 479 461 480 # … … 472 491 reporter.log(' --dryrun'); 473 492 reporter.log(' Performs a dryrun (no tests being executed).'); 474 reporter.log(' --mode <local|remote>'); 475 reporter.log(' Specifies the execution mode.'); 493 reporter.log(' --mode <local|remote-copy|remote-exec>'); 494 reporter.log(' Specifies the test execution mode:'); 495 reporter.log(' local: Locally on the same machine.'); 496 reporter.log(' remote-copy: On remote (guest) by copying them from the local source.'); 497 reporter.log(' remote-exec: On remote (guest) directly (needs unit test source).'); 476 498 reporter.log(' --only-whitelist'); 477 499 reporter.log(' Only processes the white list.'); … … 496 518 if iArg >= len(asArgs): 497 519 raise base.InvalidOption('Option "%s" needs a value' % (asArgs[iArg - 1])); 498 if asArgs[iArg] == 'local':520 if asArgs[iArg] in ('local', 'remote-copy', 'remote-exec'): 499 521 self.sMode = asArgs[iArg]; 500 elif asArgs[iArg] == 'remote':501 if self.sUnitTestsPathSrc:502 self.sMode = 'remote-exec';503 else:504 self.sMode = 'remote-copy';505 522 else: 506 523 raise base.InvalidOption('Argument "%s" invalid' % (asArgs[iArg])); … … 510 527 raise base.InvalidOption('Option "%s" needs a value' % (asArgs[iArg - 1])); 511 528 self.sUnitTestsPathSrc = asArgs[iArg]; 512 self.sMode = 'remote-exec';513 reporter.log('Unit test source explicitly set to "%s"' % (self.sUnitTestsPathSrc));514 529 elif asArgs[iArg] == '--only-whitelist': 515 530 self.fOnlyWhiteList = True; … … 521 536 raise base.InvalidOption('Option "%s" needs a value' % (asArgs[iArg - 1])); 522 537 self.sVBoxInstallRoot = asArgs[iArg]; 523 reporter.log('VBox installation root explicitly set to "%s"' % (self.sVBoxInstallRoot));524 538 else: 525 539 return vbox.TestDriver.parseOption(self, asArgs, iArg); … … 560 574 561 575 def actionExecute(self): 562 if not self.sUnitTestsPathSrc: 563 if not self._detectPaths(): 564 return False; 576 if not self._detectPaths(): 577 return False; 565 578 reporter.log2('Unit test source path is "%s"\n' % self.sUnitTestsPathSrc); 566 579
Note:
See TracChangeset
for help on using the changeset viewer.