aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/lang/c/tls_globals
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/lang/c/tls_globals')
-rw-r--r--packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py5
-rw-r--r--packages/Python/lldbsuite/test/lang/c/tls_globals/a.c6
-rw-r--r--packages/Python/lldbsuite/test/lang/c/tls_globals/main.c14
3 files changed, 19 insertions, 6 deletions
diff --git a/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py b/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py
index 0d9e22ec3adf..0ca9923c89a6 100644
--- a/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py
+++ b/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py
@@ -7,8 +7,9 @@ from __future__ import print_function
import unittest2
import os, time
import lldb
+from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
-import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test import lldbutil
class TlsGlobalTestCase(TestBase):
@@ -25,8 +26,8 @@ class TlsGlobalTestCase(TestBase):
self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.getcwd())
self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars " + self.dylibPath))
- @unittest2.expectedFailure("rdar://7796742")
@skipIfWindows # TLS works differently on Windows, this would need to be implemented separately.
+ @expectedFailureAll(bugnumber="llvm.org/pr28392", oslist=no_match(lldbplatformutil.getDarwinOSTriples()))
def test(self):
"""Test thread-local storage."""
self.build()
diff --git a/packages/Python/lldbsuite/test/lang/c/tls_globals/a.c b/packages/Python/lldbsuite/test/lang/c/tls_globals/a.c
index b9a85902d117..ab1022514d1e 100644
--- a/packages/Python/lldbsuite/test/lang/c/tls_globals/a.c
+++ b/packages/Python/lldbsuite/test/lang/c/tls_globals/a.c
@@ -11,6 +11,12 @@
__thread int var_shared = 33;
+int
+touch_shared()
+{
+ return var_shared;
+}
+
void shared_check()
{
var_shared *= 2;
diff --git a/packages/Python/lldbsuite/test/lang/c/tls_globals/main.c b/packages/Python/lldbsuite/test/lang/c/tls_globals/main.c
index cbe01b89b7ef..73e32ca39a58 100644
--- a/packages/Python/lldbsuite/test/lang/c/tls_globals/main.c
+++ b/packages/Python/lldbsuite/test/lang/c/tls_globals/main.c
@@ -11,6 +11,10 @@
#include <unistd.h>
void shared_check();
+// On some OS's (darwin) you must actually access a thread local variable
+// before you can read it
+int
+touch_shared();
// Create some TLS storage within the static executable.
__thread int var_static = 44;
@@ -28,9 +32,11 @@ int main (int argc, char const *argv[])
{
pthread_t handle;
pthread_create(&handle, NULL, &fn_static, NULL);
+ touch_shared();
+ for (; var_static;)
+ {
+ usleep(1); // main breakpoint
+ }
- for(;;)
- usleep(1); // main breakpoint
-
- return 0;
+ return 0;
}