[libcxx] r296942 - teach LIT how to detect the glibc version

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 3 17:29:51 PST 2017


Author: ericwf
Date: Fri Mar  3 19:29:51 2017
New Revision: 296942

URL: http://llvm.org/viewvc/llvm-project?rev=296942&view=rev
Log:
teach LIT how to detect the glibc version

Modified:
    libcxx/trunk/utils/libcxx/test/config.py

Modified: libcxx/trunk/utils/libcxx/test/config.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/config.py?rev=296942&r1=296941&r2=296942&view=diff
==============================================================================
--- libcxx/trunk/utils/libcxx/test/config.py (original)
+++ libcxx/trunk/utils/libcxx/test/config.py Fri Mar  3 19:29:51 2017
@@ -401,6 +401,14 @@ class Configuration(object):
         if self.is_windows:
             self.config.available_features.add('windows')
 
+        # Attempt to detect the glibc version by querying
+        macros = self.cxx.dumpMacros(flags=['-include', 'features.h'])
+        if macros is not None and '__GLIBC__' in macros:
+            maj_v, min_v = (macros['__GLIBC__'], macros['__GLIBC_MINOR__'])
+            self.config.available_features.add('glibc')
+            self.config.available_features.add('glibc-%s' % maj_v)
+            self.config.available_features.add('glibc-%s.%s' % (maj_v, min_v))
+
     def configure_compile_flags(self):
         no_default_flags = self.get_lit_bool('no_default_flags', False)
         if not no_default_flags:




More information about the cfe-commits mailing list