[Lldb-commits] [lldb] ad81d01 - [lldb][Test] Check compiler in data forammter compiler version checks

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 9 17:37:43 PST 2023


Author: Michael Buch
Date: 2023-02-10T01:37:26Z
New Revision: ad81d019a62d33e5d1f232844b83d3e164e4b160

URL: https://github.com/llvm/llvm-project/commit/ad81d019a62d33e5d1f232844b83d3e164e4b160
DIFF: https://github.com/llvm/llvm-project/commit/ad81d019a62d33e5d1f232844b83d3e164e4b160.diff

LOG: [lldb][Test] Check compiler in data forammter compiler version checks

**Summary**

The compiler version check wouldn't make sense for non-GCC
compilers, so check for the compiler too.

Differential Revision: https://reviews.llvm.org/D143656

Added: 
    

Modified: 
    lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/non-module-type-separation/TestNonModuleTypeSeparation.py
    lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/retry-with-std-module/TestRetryWithStdModule.py
    lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py
    lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
    lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
    lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
    lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py
    lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py
index f12f5f96aa5d6..553095f151dea 100644
--- a/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py
@@ -20,7 +20,7 @@ def test(self):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             deque_type = "std::deque<int>"
         else:
             deque_type = "std::deque<int, std::allocator<int> >"

diff  --git a/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py
index d62e49f11cbb2..2867ea162bdcb 100644
--- a/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py
@@ -21,7 +21,7 @@ def test(self):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             deque_type = "std::deque<Foo>"
         else:
             deque_type = "std::deque<Foo, std::allocator<Foo> >"

diff  --git a/lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
index ad6c5f487b9d4..79072be33a5f3 100644
--- a/lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
@@ -20,7 +20,7 @@ def test(self):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             list_type = "std::forward_list<Foo>"
         else:
             list_type = "std::forward_list<Foo, std::allocator<Foo> >"

diff  --git a/lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py
index 8cb6c13865c95..4a872e1e61dd3 100644
--- a/lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py
@@ -20,7 +20,7 @@ def test(self):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             list_type = "std::forward_list<int>"
         else:
             list_type = "std::forward_list<int, std::allocator<int> >"

diff  --git a/lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py
index e67ff4b947fd6..58e516a48817e 100644
--- a/lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py
@@ -22,7 +22,7 @@ def test(self):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             list_type = "std::list<Foo>"
         else:
             list_type = "std::list<Foo, std::allocator<Foo> >"

diff  --git a/lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py
index b81e2c63e206e..9ffc3599fa046 100644
--- a/lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py
@@ -20,7 +20,7 @@ def test(self):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             list_type = "std::list<int>"
         else:
             list_type = "std::list<int, std::allocator<int> >"

diff  --git a/lldb/test/API/commands/expression/import-std-module/non-module-type-separation/TestNonModuleTypeSeparation.py b/lldb/test/API/commands/expression/import-std-module/non-module-type-separation/TestNonModuleTypeSeparation.py
index 8e3dca65b5671..6431a64fd3974 100644
--- a/lldb/test/API/commands/expression/import-std-module/non-module-type-separation/TestNonModuleTypeSeparation.py
+++ b/lldb/test/API/commands/expression/import-std-module/non-module-type-separation/TestNonModuleTypeSeparation.py
@@ -31,7 +31,7 @@ def test(self):
             ValueCheck(value="2"),
         ]
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             vector_type = "std::vector<int>"
             dbg_vec_type = "std::vector<DbgInfoClass>"
             module_vector_type = "std::vector<int>"

diff  --git a/lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py
index d084083fd4c43..b9ccb1e46bb70 100644
--- a/lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py
@@ -20,7 +20,7 @@ def test(self):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             queue_type = "std::queue<C>"
         else:
             queue_type = "std::queue<C, std::deque<C, std::allocator<C> > >"
@@ -56,7 +56,7 @@ def test(self):
                          result_value="5")
 
         # Test std::queue functionality with a std::list.
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             queue_type = "std::queue<C, std::list<C> >"
         else:
             queue_type = "std::queue<C, std::list<C, std::allocator<C> > >"

diff  --git a/lldb/test/API/commands/expression/import-std-module/retry-with-std-module/TestRetryWithStdModule.py b/lldb/test/API/commands/expression/import-std-module/retry-with-std-module/TestRetryWithStdModule.py
index 7e6d6e0424cae..4f8edc016922a 100644
--- a/lldb/test/API/commands/expression/import-std-module/retry-with-std-module/TestRetryWithStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/retry-with-std-module/TestRetryWithStdModule.py
@@ -14,7 +14,7 @@ def test(self):
                                           "// Set break point at this line.",
                                           lldb.SBFileSpec("main.cpp"))
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             vec_type = "std::vector<int>"
         else:
             vec_type = "std::vector<int, std::allocator<int> >"

diff  --git a/lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py b/lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py
index 3a219d9b43e93..9363631964417 100644
--- a/lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py
+++ b/lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py
@@ -22,7 +22,7 @@ def test(self):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             ptr_type = "std::unique_ptr<Foo>"
         else:
             ptr_type = "std::unique_ptr<Foo, std::default_delete<Foo> >"

diff  --git a/lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py
index 01ee90b5357f3..1cf227e4c3a89 100644
--- a/lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py
@@ -22,7 +22,7 @@ def test(self):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             ptr_type = "std::unique_ptr<int>"
         else:
             ptr_type = "std::unique_ptr<int, std::default_delete<int> >"

diff  --git a/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py
index 6a411d7d39fb4..82882716f6381 100644
--- a/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py
@@ -22,7 +22,7 @@ def test(self):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             vector_type = "std::vector<Foo>"
         else:
             vector_type = "std::vector<Foo, std::allocator<Foo> >"

diff  --git a/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
index 4adc25385f761..c5165365d68d8 100644
--- a/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
@@ -18,7 +18,7 @@ def test(self):
                                           "// Set break point at this line.",
                                           lldb.SBFileSpec("main.cpp"))
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             vector_type = "std::vector<int>"
             vector_of_vector_type = "std::vector<std::vector<int> >"
         else:

diff  --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
index c8cf41bf062dd..81c7e703cad2f 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
@@ -58,7 +58,7 @@ def test_shared_ptr_variables(self):
         self.assertRegex(valobj.summary, r"^10( strong=1)? weak=1$")
         self.assertNotEqual(valobj.child[0].unsigned, 0)
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             string_type = "std::basic_string<char>"
         else:
             string_type = "std::basic_string<char, std::char_traits<char>, std::allocator<char> >"

diff  --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
index d9803f4b0b675..34724e34982d4 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
@@ -52,7 +52,7 @@ def cleanup():
 
         ns = self.namespace
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             expected_basic_string = '%s::basic_string<unsigned char>'%ns
         else:
             expected_basic_string = '%s::basic_string<unsigned char, %s::char_traits<unsigned char>, ' \

diff  --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py
index 4e5fcd12ebdda..08639c35ed0c2 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py
@@ -56,7 +56,7 @@ def cleanup():
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             expected_basic_string = 'std::basic_string<unsigned char>'
             expected_basic_string_view = 'std::basic_string_view<unsigned char>'
         else:

diff  --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py
index d9e18859e620a..e31a3f100317b 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py
@@ -15,13 +15,13 @@ def make_expected_type(self, pointee_type: str, qualifiers: str = "") -> str:
         if qualifiers:
             qualifiers = ' ' + qualifiers
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             return f'std::unique_ptr<{pointee_type}>{qualifiers}'
         else:
             return f'std::unique_ptr<{pointee_type}, std::default_delete<{pointee_type}> >{qualifiers}'
 
     def make_expected_basic_string_ptr(self) -> str:
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             return f'std::unique_ptr<std::basic_string<char> >'
         else:
             return 'std::unique_ptr<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, ' \


        


More information about the lldb-commits mailing list