[libcxx] r221966 - Setup llvm-symbolizer when running the tests with sanitizers

Eric Fiselier eric at efcs.ca
Fri Nov 14 10:42:54 PST 2014


Thanks for the heads up. That sounds like a better way to handle this.

/Eric

On Fri, Nov 14, 2014 at 11:30 AM, Alexey Samsonov <vonosmas at gmail.com>
wrote:

> FYI ASan/MSan should discover llvm-symbolizer from PATH env var. So, as an
> alternative, you could just propagate necessary PATH bits to lit-tests.
>
> On Thu, Nov 13, 2014 at 6:47 PM, Eric Fiselier <eric at efcs.ca> wrote:
>
>> Author: ericwf
>> Date: Thu Nov 13 20:47:08 2014
>> New Revision: 221966
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=221966&view=rev
>> Log:
>> Setup llvm-symbolizer when running the tests with sanitizers
>>
>> Modified:
>>     libcxx/trunk/test/lit.cfg
>>
>> Modified: libcxx/trunk/test/lit.cfg
>> URL:
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/lit.cfg?rev=221966&r1=221965&r2=221966&view=diff
>>
>> ==============================================================================
>> --- libcxx/trunk/test/lit.cfg (original)
>> +++ libcxx/trunk/test/lit.cfg Thu Nov 13 20:47:08 2014
>> @@ -425,16 +425,30 @@ class Configuration(object):
>>      def configure_sanitizer(self):
>>          san = self.get_lit_conf('llvm_use_sanitizer', '').strip()
>>          if san:
>> +            # Search for llvm-symbolizer along the compiler path first
>> +            # and then along the PATH env variable.
>> +            symbolizer_search_paths = os.environ.get('PATH', '')
>> +            cxx_path = lit.util.which(self.cxx)
>> +            if cxx_path is not None:
>> +                symbolizer_search_paths = os.path.dirname(cxx_path) + \
>> +                                          os.pathsep +
>> symbolizer_search_paths
>> +            llvm_symbolizer = lit.util.which('llvm-symbolizer',
>> +                                             symbolizer_search_paths)
>> +            # Setup the sanitizer compile flags
>>              self.compile_flags += ['-fno-omit-frame-pointer']
>>              if sys.platform.startswith('linux'):
>>                  self.link_flags += ['-ldl']
>>              if san == 'Address':
>>                  self.compile_flags += ['-fsanitize=address']
>> +                if llvm_symbolizer is not None:
>> +                    self.env['ASAN_SYMBOLIZER_PATH'] = llvm_symbolizer
>>                  self.config.available_features.add('asan')
>>              elif san == 'Memory' or san == 'MemoryWithOrigins':
>>                  self.compile_flags += ['-fsanitize=memory']
>>                  if san == 'MemoryWithOrigins':
>>                      self.compile_flags +=
>> ['-fsanitize-memory-track-origins']
>> +                if llvm_symbolizer is not None:
>> +                    self.env['MSAN_SYMBOLIZER_PATH'] = llvm_symbolizer
>>                  self.config.available_features.add('msan')
>>              elif san == 'Undefined':
>>                  self.compile_flags += ['-fsanitize=undefined',
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
>
>
> --
> Alexey Samsonov
> vonosmas at gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141114/8e3976e5/attachment.html>


More information about the cfe-commits mailing list