diff options
author | 2020-08-03 14:33:06 +0000 | |
---|---|---|
committer | 2020-08-03 14:33:06 +0000 | |
commit | 061da546b983eb767bad15e67af1174fb0bcf31c (patch) | |
tree | 83c78b820819d70aa40c36d90447978b300078c5 /gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/expression/char | |
parent | Import LLVM 10.0.0 release including clang, lld and lldb. (diff) | |
download | wireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.tar.xz wireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.zip |
Import LLVM 10.0.0 release including clang, lld and lldb.
ok hackroom
tested by plenty
Diffstat (limited to 'gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/expression/char')
3 files changed, 81 insertions, 0 deletions
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/expression/char/Makefile b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/expression/char/Makefile new file mode 100644 index 00000000000..99998b20bcb --- /dev/null +++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/expression/char/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/expression/char/TestExprsChar.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/expression/char/TestExprsChar.py new file mode 100644 index 00000000000..f1fa7805384 --- /dev/null +++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/expression/char/TestExprsChar.py @@ -0,0 +1,68 @@ + + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class ExprCharTestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + def setUp(self): + # Call super's setUp(). + TestBase.setUp(self) + + self.main_source = "main.cpp" + self.main_source_spec = lldb.SBFileSpec(self.main_source) + + def do_test(self, dictionary=None): + """These basic expression commands should work as expected.""" + self.build(dictionary=dictionary) + + (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, + '// Break here', self.main_source_spec) + frame = thread.GetFrameAtIndex(0) + + value = frame.EvaluateExpression("foo(c)") + self.assertTrue(value.IsValid()) + self.assertTrue(value.GetError().Success()) + self.assertEqual(value.GetValueAsSigned(0), 1) + + value = frame.EvaluateExpression("foo(sc)") + self.assertTrue(value.IsValid()) + self.assertTrue(value.GetError().Success()) + self.assertEqual(value.GetValueAsSigned(0), 2) + + value = frame.EvaluateExpression("foo(uc)") + self.assertTrue(value.IsValid()) + self.assertTrue(value.GetError().Success()) + self.assertEqual(value.GetValueAsSigned(0), 3) + + def test_default_char(self): + self.do_test() + + @expectedFailureAll( + archs=[ + "arm", + "aarch64", + "powerpc64le", + "s390x"], + bugnumber="llvm.org/pr23069") + def test_signed_char(self): + self.do_test(dictionary={'CFLAGS_EXTRAS': '-fsigned-char'}) + + @expectedFailureAll( + archs=[ + "i[3-6]86", + "x86_64", + "arm64", + 'arm64e', + 'armv7', + 'armv7k', + 'arm64_32'], + bugnumber="llvm.org/pr23069, <rdar://problem/28721938>") + @expectedFailureAll(triple='mips*', bugnumber="llvm.org/pr23069") + def test_unsigned_char(self): + self.do_test(dictionary={'CFLAGS_EXTRAS': '-funsigned-char'}) diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/expression/char/main.cpp b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/expression/char/main.cpp new file mode 100644 index 00000000000..c8b0beb1b35 --- /dev/null +++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/expression/char/main.cpp @@ -0,0 +1,10 @@ +int foo(char c) { return 1; } +int foo(signed char c) { return 2; } +int foo(unsigned char c) { return 3; } + +int main() { + char c = 0; + signed char sc = 0; + unsigned char uc = 0; + return 0; // Break here +} |