VirtualBox

Changeset 86437 in vbox for trunk


Ignore:
Timestamp:
Oct 4, 2020 11:36:35 AM (4 years ago)
Author:
vboxsync
Message:

testdriver/vboxinstaller.py: Preload libasan.so.X when present in VBoxAll on linux and disable memory leak detection. bugref:9841

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testdriver/vboxinstaller.py

    r82968 r86437  
    7171        self._asBuildUrls   = [];   # The URLs passed us on the command line.
    7272        self._asBuildFiles  = [];   # The downloaded file names.
     73        self._fUnpackedBuildFiles = False;
    7374        self._fAutoInstallPuelExtPack = True;
    7475
     
    8384        reporter.log('');
    8485        reporter.log('vboxinstaller Options:');
    85         reporter.log('  --vbox-build    <url[,url2[,..]]>');
     86        reporter.log('  --vbox-build    <url[,url2[,...]]>');
    8687        reporter.log('      Comma separated list of URL to file to download and install or/and');
    8788        reporter.log('      unpack.  URLs without a schema are assumed to be files on the');
     
    123124        #
    124125        if not self._asBuildUrls:
    125             reporter.error('No build files specfiied ("--vbox-build file1[,file2[...]]")');
     126            reporter.error('No build files specified ("--vbox-build file1[,file2[...]]")');
    126127            return False;
    127128        if not self._asSubDriver:
     
    166167            fRc = self._executeSubDriver([ 'verify', ]);
    167168        if fRc is True and 'execute' not in self.asActions and 'all' not in self.asActions:
    168             fRc = self._executeSubDriver([ 'config', ]);
     169            fRc = self._executeSubDriver([ 'config', ], fPreloadASan = True);
    169170        return fRc;
    170171
     
    173174        Execute the sub testdriver.
    174175        """
    175         return self._executeSubDriver(self.asActions);
     176        return self._executeSubDriver(self.asActions, fPreloadASan = True);
    176177
    177178    def actionCleanupAfter(self):
     
    203204        processes, and finally do the pid file processing (again).
    204205        """
    205         fRc1 = self._executeSubDriver([ 'abort', ], fMaySkip = False);
     206        fRc1 = self._executeSubDriver([ 'abort', ], fMaySkip = False, fPreloadASan = True);
    206207        fRc2 = self._killAllVBoxProcesses();
    207208        fRc3 = TestDriverBase.actionAbort(self);
     
    212213    # Persistent variables.
    213214    #
    214     ## @todo integrate into the base driver. Persisten accross scratch wipes?
     215    ## @todo integrate into the base driver. Persistent accross scratch wipes?
    215216
    216217    def __persistentVarCalcName(self, sVar):
     
    373374        return (iRc == 0, iRc);
    374375
    375     def _executeSubDriver(self, asActions, fMaySkip = True):
     376    def _findASanLibsForASanBuild(self):
     377        """
     378        Returns a list of (address) santizier related libraries to preload
     379        when launching the sub driver.
     380        Returns empty list for non-asan builds or on platforms where this isn't needed.
     381        """
     382        # Note! We include libasan.so.X in the VBoxAll tarball for asan builds, so we
     383        #       can use its presence both to detect an 'asan' build and to return it.
     384        #       Only the libasan.so.X library needs preloading at present.
     385        if self.sHost in ('linux',):
     386            sLibASan = self._findFile(r'libasan\.so\..*');
     387            if sLibASan:
     388                return [sLibASan,];
     389        return [];
     390
     391    def _executeSubDriver(self, asActions, fMaySkip = True, fPreloadASan = True):
    376392        """
    377393        Execute the sub testdriver with the specified action.
     
    380396        asArgs.append('--no-wipe-clean');
    381397        asArgs.extend(asActions);
     398
     399        asASanLibs = [];
     400        if fPreloadASan:
     401            asASanLibs = self._findASanLibsForASanBuild();
     402        if asASanLibs:
     403            os.environ['LD_PRELOAD'] = ':'.join(asASanLibs);
     404            os.environ['LSAN_OPTIONS'] = 'detect_leaks=0'; # We don't want python leaks. vbox.py disables this.
     405
     406            rc = self._executeSync(asArgs, fMaySkip = fMaySkip);
     407
     408            del os.environ['LSAN_OPTIONS'];
     409            del os.environ['LD_PRELOAD'];
     410            return rc;
     411
    382412        return self._executeSync(asArgs, fMaySkip = fMaySkip);
    383413
     
    425455        # list.  This allows us to use VBoxAll*.tar.gz files.
    426456        #
    427         for sFile in list(self._asBuildFiles):
     457        for sFile in list(self._asBuildFiles): # Note! We copy the list as _maybeUnpackArchive updates it.
    428458            if self._maybeUnpackArchive(sFile, fNonFatal = True) is not True:
    429459                reporter.testDone(fSkipped = True);
    430460                return None; # Failed to unpack. Probably local error, like busy
    431461                             # DLLs on windows, no reason for failing the build.
     462        self._fUnpackedBuildFiles = True;
    432463
    433464        #
     
    497528        oRegExp = re.compile(sRegExp);
    498529
     530        reporter.log('_findFile: %s' % (sRegExp,));
    499531        for sFile in self._asBuildFiles:
    500532            if oRegExp.match(os.path.basename(sFile)) and os.path.exists(sFile):
    501533                return sFile;
     534
     535        # If we didn't unpack the build files, search all the files in the scratch area:
     536        if not self._fUnpackedBuildFiles:
     537            for sDir, _, asFiles in os.walk(self.sScratchPath):
     538                for sFile in asFiles:
     539                    #reporter.log('_findFile: considering %s' % (sFile,));
     540                    if oRegExp.match(sFile):
     541                        return os.path.join(sDir, sFile);
    502542
    503543        if fMandatory:
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