Author: Raphael Isemann
Date: 2020-06-19T17:47:16+02:00
New Revision: 85e7e3b1c93ebdaaaf1f63d0d5b3b778e81fdd9c

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

LOG: [lldb] Fix TestComplexInt on ARM

On the buildbot long and int have the same size but long and long long don't,
so the bug where we find the first type by size will produce a different error.
Make the test dynamic based on int/long/long long size to fix the bot.

Added: 
    

Modified: 
    lldb/test/API/lang/c/complex_int/TestComplexInt.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/lang/c/complex_int/TestComplexInt.py 
b/lldb/test/API/lang/c/complex_int/TestComplexInt.py
index 8d9344ee0f7a..9bd0c3700def 100644
--- a/lldb/test/API/lang/c/complex_int/TestComplexInt.py
+++ b/lldb/test/API/lang/c/complex_int/TestComplexInt.py
@@ -16,12 +16,19 @@ def test(self):
         self.build()
         lldbutil.run_to_source_breakpoint(self, "// break here", 
lldb.SBFileSpec("main.c"))
 
+        long_size_eq_int = self.frame().EvaluateExpression("sizeof(long) == 
sizeof(int)")
+
         # FIXME: LLDB treats all complex ints as unsigned, so the value is 
wrong.
         self.expect_expr("complex_int", result_type="_Complex int", 
result_value="4294967295 + 4294967294i")
-        self.expect_expr("complex_long", result_type="_Complex long")
-
         self.expect_expr("complex_unsigned", result_type="_Complex int", 
result_value="1 + 2i")
-        self.expect_expr("complex_unsigned_long", result_type="_Complex long", 
result_value="1 + 2i")
+
+        # FIXME: We get the type wrong if long has the same size as int.
+        if long_size_eq_int.GetValue() == "true":
+            self.expect_expr("complex_long", result_type="_Complex int")
+            self.expect_expr("complex_unsigned_long", result_type="_Complex 
int", result_value="1 + 2i")
+        else:
+            self.expect_expr("complex_long", result_type="_Complex long")
+            self.expect_expr("complex_unsigned_long", result_type="_Complex 
long", result_value="1 + 2i")
 
     @no_debug_info_test
     def test_long_long(self):
@@ -30,5 +37,10 @@ def test_long_long(self):
 
         # FIXME: We get the type wrong if long has the same size as long long.
         # FIXME: LLDB treats all complex ints as unsigned, so the value is 
wrong.
-        self.expect_expr("complex_long_long", result_type="_Complex long")
-        self.expect_expr("complex_unsigned_long_long", result_type="_Complex 
long", result_value="1 + 2i")
+        long_size_eq_long_long = self.frame().EvaluateExpression("sizeof(long) 
== sizeof(long long)")
+        if long_size_eq_long_long.GetValue() == "true":
+            self.expect_expr("complex_long_long", result_type="_Complex long")
+            self.expect_expr("complex_unsigned_long_long", 
result_type="_Complex long", result_value="1 + 2i")
+        else:
+            self.expect_expr("complex_long_long", result_type="_Complex long 
long")
+            self.expect_expr("complex_unsigned_long_long", 
result_type="_Complex long long", result_value="1 + 2i")


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to