summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-09-04 08:02:52 +0000
committerRaphael Isemann <teemperor@gmail.com>2019-09-04 08:02:52 +0000
commit7479b9cb0e00e417282d29969f30e30cb5c44f8e (patch)
tree20f81d963b353f067b4d3b571918bb3c02f2fedb /lldb/packages/Python/lldbsuite
parent5d5150f0b490c0d90a5284cb0e37571195aee1ac (diff)
downloadbcm5719-llvm-7479b9cb0e00e417282d29969f30e30cb5c44f8e.tar.gz
bcm5719-llvm-7479b9cb0e00e417282d29969f30e30cb5c44f8e.zip
[lldb][NFC] Add a simple test for thread_local storage.
Seems we fail to read TLS data on Linux, so the test only runs on macOS for now. We will see how this test runs on the BSD bots. llvm-svn: 370848
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/thread_local/Makefile3
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/thread_local/TestThreadLocal.py5
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/thread_local/main.cpp17
3 files changed, 25 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/thread_local/Makefile b/lldb/packages/Python/lldbsuite/test/lang/cpp/thread_local/Makefile
new file mode 100644
index 00000000000..99bfa7e03b4
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/thread_local/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../../make
+CXX_SOURCES := main.cpp
+include $(LEVEL)/Makefile.rules
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/thread_local/TestThreadLocal.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/thread_local/TestThreadLocal.py
new file mode 100644
index 00000000000..9f8ed89375e
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/thread_local/TestThreadLocal.py
@@ -0,0 +1,5 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals(),
+ lldbinline.expectedFailureAll(oslist=["windows", "linux"]))
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/thread_local/main.cpp b/lldb/packages/Python/lldbsuite/test/lang/cpp/thread_local/main.cpp
new file mode 100644
index 00000000000..1855b7c5f34
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/thread_local/main.cpp
@@ -0,0 +1,17 @@
+int storage = 45;
+thread_local int tl_global_int = 123;
+thread_local int *tl_global_ptr = &storage;
+
+int main(int argc, char **argv) {
+ //% self.expect("expr tl_local_int", error=True, substrs=["couldn't get the value of variable tl_local_int"])
+ //% self.expect("expr *tl_local_ptr", error=True, substrs=["couldn't get the value of variable tl_local_ptr"])
+ thread_local int tl_local_int = 321;
+ thread_local int *tl_local_ptr = nullptr;
+ tl_local_ptr = &tl_local_int;
+ tl_local_int++;
+ //% self.expect("expr tl_local_int + 1", substrs=["int", "= 323"])
+ //% self.expect("expr *tl_local_ptr + 2", substrs=["int", "= 324"])
+ //% self.expect("expr tl_global_int", substrs=["int", "= 123"])
+ //% self.expect("expr *tl_global_ptr", substrs=["int", "= 45"])
+ return 0;
+}
OpenPOWER on IntegriCloud