JDevlieghere created this revision.
JDevlieghere added reviewers: labath, aprantl, jankratochvil.
Herald added a project: LLDB.

On the matrix bot on GreenDragon [1] we want to run the test suite against 
different DWARF versions. The idea here is not to replace targeted tests for 
certain DWARF features, but rather to provide an easy way to support this 
configuration.

[1] http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D66370

Files:
  lldb/packages/Python/lldbsuite/test/configuration.py
  lldb/packages/Python/lldbsuite/test/decorators.py
  lldb/packages/Python/lldbsuite/test/dotest.py
  lldb/packages/Python/lldbsuite/test/dotest_args.py
  lldb/packages/Python/lldbsuite/test/lldbtest.py


Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1290,6 +1290,8 @@
 
     def getDwarfVersion(self):
         """ Returns the dwarf version generated by clang or '0'. """
+        if configuration.dwarf_version:
+            return str(configuration.dwarf_version)
         if 'clang' in self.getCompiler():
             try:
                 driver_output = check_output(
Index: lldb/packages/Python/lldbsuite/test/dotest_args.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -125,6 +125,12 @@
         dest='out_of_tree_debugserver',
         action='store_true',
         help='A flag to indicate an out-of-tree debug server is being used')
+    group.add_argument(
+        '--force-dwarf',
+        metavar='dwarf_version',
+        dest='dwarf_version',
+        type=int,
+        help='Override the DWARF version.')
     group.add_argument(
         '-s',
         metavar='name',
Index: lldb/packages/Python/lldbsuite/test/dotest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -342,9 +342,15 @@
         configuration.skipCategories += test_categories.validate(
             args.skipCategories, False)
 
+    cflags_extras = ""
     if args.E:
-        cflags_extras = args.E
-        os.environ['CFLAGS_EXTRAS'] = cflags_extras
+        cflags_extras += args.E
+
+    if args.dwarf_version:
+        configuration.dwarf_version = args.dwarf_version
+        cflags_extras += '-gdwarf-{}'.format(args.dwarf_version)
+
+    os.environ['CFLAGS_EXTRAS'] = cflags_extras
 
     if args.d:
         sys.stdout.write(
@@ -364,6 +370,7 @@
     if args.framework:
         configuration.lldbFrameworkPath = args.framework
 
+
     if args.executable:
         # lldb executable is passed explicitly
         lldbtest_config.lldbExec = os.path.realpath(args.executable)
Index: lldb/packages/Python/lldbsuite/test/decorators.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/decorators.py
+++ lldb/packages/Python/lldbsuite/test/decorators.py
@@ -194,11 +194,9 @@
                 macos_version[0],
                 macos_version[1],
                 platform.mac_ver()[0])))
-        skip_for_dwarf_version = (
-             dwarf_version is None) or (
-                 (self.getDebugInfo() is 'dwarf') and
-                 _check_expected_version(
-                     dwarf_version[0], dwarf_version[1], 
self.getDwarfVersion()))
+        skip_for_dwarf_version = (dwarf_version is None) or (
+            _check_expected_version(dwarf_version[0], dwarf_version[1],
+                                    self.getDwarfVersion()))
 
         # For the test to be skipped, all specified (e.g. not None) parameters 
must be True.
         # An unspecified parameter means "any", so those are marked skip by 
default.  And we skip
Index: lldb/packages/Python/lldbsuite/test/configuration.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/configuration.py
+++ lldb/packages/Python/lldbsuite/test/configuration.py
@@ -43,6 +43,9 @@
 arch = None        # Must be initialized after option parsing
 compiler = None    # Must be initialized after option parsing
 
+# The overriden dwarf verison.
+dwarf_version = 0
+
 # Path to the FileCheck testing tool. Not optional.
 filecheck = None
 


Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1290,6 +1290,8 @@
 
     def getDwarfVersion(self):
         """ Returns the dwarf version generated by clang or '0'. """
+        if configuration.dwarf_version:
+            return str(configuration.dwarf_version)
         if 'clang' in self.getCompiler():
             try:
                 driver_output = check_output(
Index: lldb/packages/Python/lldbsuite/test/dotest_args.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -125,6 +125,12 @@
         dest='out_of_tree_debugserver',
         action='store_true',
         help='A flag to indicate an out-of-tree debug server is being used')
+    group.add_argument(
+        '--force-dwarf',
+        metavar='dwarf_version',
+        dest='dwarf_version',
+        type=int,
+        help='Override the DWARF version.')
     group.add_argument(
         '-s',
         metavar='name',
Index: lldb/packages/Python/lldbsuite/test/dotest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -342,9 +342,15 @@
         configuration.skipCategories += test_categories.validate(
             args.skipCategories, False)
 
+    cflags_extras = ""
     if args.E:
-        cflags_extras = args.E
-        os.environ['CFLAGS_EXTRAS'] = cflags_extras
+        cflags_extras += args.E
+
+    if args.dwarf_version:
+        configuration.dwarf_version = args.dwarf_version
+        cflags_extras += '-gdwarf-{}'.format(args.dwarf_version)
+
+    os.environ['CFLAGS_EXTRAS'] = cflags_extras
 
     if args.d:
         sys.stdout.write(
@@ -364,6 +370,7 @@
     if args.framework:
         configuration.lldbFrameworkPath = args.framework
 
+
     if args.executable:
         # lldb executable is passed explicitly
         lldbtest_config.lldbExec = os.path.realpath(args.executable)
Index: lldb/packages/Python/lldbsuite/test/decorators.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/decorators.py
+++ lldb/packages/Python/lldbsuite/test/decorators.py
@@ -194,11 +194,9 @@
                 macos_version[0],
                 macos_version[1],
                 platform.mac_ver()[0])))
-        skip_for_dwarf_version = (
-             dwarf_version is None) or (
-                 (self.getDebugInfo() is 'dwarf') and
-                 _check_expected_version(
-                     dwarf_version[0], dwarf_version[1], self.getDwarfVersion()))
+        skip_for_dwarf_version = (dwarf_version is None) or (
+            _check_expected_version(dwarf_version[0], dwarf_version[1],
+                                    self.getDwarfVersion()))
 
         # For the test to be skipped, all specified (e.g. not None) parameters must be True.
         # An unspecified parameter means "any", so those are marked skip by default.  And we skip
Index: lldb/packages/Python/lldbsuite/test/configuration.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/configuration.py
+++ lldb/packages/Python/lldbsuite/test/configuration.py
@@ -43,6 +43,9 @@
 arch = None        # Must be initialized after option parsing
 compiler = None    # Must be initialized after option parsing
 
+# The overriden dwarf verison.
+dwarf_version = 0
+
 # Path to the FileCheck testing tool. Not optional.
 filecheck = None
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to