* TLS tests were "empty" because nothing was setting the following variables:
* USE_TLS
* HAVE___THREAD
* HAVE_TLS_MODEL_ATTRIBUTE
All toolchains supported by uClibc-ng today do support both NPTL threads and TLS.
All ports also define HAVE_TLS_MODEL_ATTRIBUTE except alpha.
* 3 tests (tst-tls6 / tst-tls7 / tst-tls8) were peeking into internal/private
data structures from libc, which is not possible anymore since libc and
tests are now split into 2 git repositories.
This commit fixes those 2 issues so that TLS tests can be run again.
Signed-off-by: Yann Sionneau <yann(a)sionneau.net>
---
test/tls/Makefile.in | 6 +++
test/tls/tst-tls6.c | 25 ------------
test/tls/tst-tls7.c | 25 ------------
test/tls/tst-tls8.c | 95 --------------------------------------------
4 files changed, 6 insertions(+), 145 deletions(-)
diff --git a/test/tls/Makefile.in b/test/tls/Makefile.in
index 6a6a50e..348fc1c 100644
--- a/test/tls/Makefile.in
+++ b/test/tls/Makefile.in
@@ -1,6 +1,12 @@
# uClibc-ng TLS tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+CFLAGS += -DUSE_TLS=1 -DHAVE___THREAD=1 -I.
+
+ifneq ($(ARCH),alpha)
+CFLAGS += -DHAVE_TLS_MODEL_ATTRIBUTE=1
+endif
+
TESTS := tst-tls1 tst-tls2 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 \
tst-tls8 tst-tls9 tst-tls10 tst-tls11 tst-tls12 tst-tls13 \
tst-tls14 tst-tls15 tst-tls16 tst-tls17 tst-tls18 tst-tls-at-ctor \
diff --git a/test/tls/tst-tls6.c b/test/tls/tst-tls6.c
index 7cc8f6b..b9a5609 100644
--- a/test/tls/tst-tls6.c
+++ b/test/tls/tst-tls6.c
@@ -26,31 +26,6 @@ do_test (void)
exit (1);
}
- /* Dirty test code here: we peek into a private data structure.
- We make sure that the module gets assigned the same ID every
- time. The value of the first round is used. */
-#ifdef __UCLIBC__
- if (modid == -1)
- modid = ((struct dyn_elf *) h)->dyn->l_tls_modid;
- else if (((struct dyn_elf *)h)->dyn->l_tls_modid != (size_t) modid)
- {
- printf ("round %d: modid now %zu, initially %d\n",
- i,
- ((struct dyn_elf *)h)->dyn->l_tls_modid,
- modid);
- result = 1;
- }
-#else
- if (modid == -1)
- modid = ((struct link_map *) h)->l_tls_modid;
- else if (((struct link_map *) h)->l_tls_modid != modid)
- {
- printf ("round %d: modid now %zd, initially %d\n",
- i, ((struct link_map *) h)->l_tls_modid, modid);
- result = 1;
- }
-#endif
-
foop = dlsym (h, "foo");
if (foop == NULL)
{
diff --git a/test/tls/tst-tls7.c b/test/tls/tst-tls7.c
index b8bb71d..b0a6d37 100644
--- a/test/tls/tst-tls7.c
+++ b/test/tls/tst-tls7.c
@@ -24,31 +24,6 @@ do_test (void)
exit (1);
}
- /* Dirty test code here: we peek into a private data structure.
- We make sure that the module gets assigned the same ID every
- time. The value of the first round is used. */
-#ifdef __UCLIBC__
- if (modid == -1)
- modid = ((struct dyn_elf *) h)->dyn->l_tls_modid;
- else if (((struct dyn_elf *)h)->dyn->l_tls_modid != (size_t) modid)
- {
- printf ("round %d: modid now %zu, initially %d\n",
- i,
- ((struct dyn_elf *)h)->dyn->l_tls_modid,
- modid);
- result = 1;
- }
-#else
- if (modid == -1)
- modid = ((struct link_map *) h)->l_tls_modid;
- else if (((struct link_map *) h)->l_tls_modid != (size_t) modid)
- {
- printf ("round %d: modid now %zu, initially %d\n",
- i, ((struct link_map *) h)->l_tls_modid, modid);
- result = 1;
- }
-#endif
-
fp = dlsym (h, "in_dso2");
if (fp == NULL)
{
diff --git a/test/tls/tst-tls8.c b/test/tls/tst-tls8.c
index 4635304..a723cab 100644
--- a/test/tls/tst-tls8.c
+++ b/test/tls/tst-tls8.c
@@ -29,31 +29,6 @@ do_test (void)
exit (1);
}
- /* Dirty test code here: we peek into a private data structure.
- We make sure that the module gets assigned the same ID every
- time. The value of the first round is used. */
-#ifdef __UCLIBC__
- if (modid1 == (size_t) -1)
- modid1 = ((struct dyn_elf *) h1)->dyn->l_tls_modid;
- else if (((struct dyn_elf *)h1)->dyn->l_tls_modid != (size_t) modid1)
- {
- printf ("round %d: modid now %zd, initially %zd\n",
- i,
- ((struct dyn_elf *)h1)->dyn->l_tls_modid,
- modid1);
- result = 1;
- }
-#else
- if (modid1 == (size_t) -1)
- modid1 = ((struct link_map *) h1)->l_tls_modid;
- else if (((struct link_map *) h1)->l_tls_modid != modid1)
- {
- printf ("round %d: modid now %zd, initially %zd\n",
- i, ((struct link_map *) h1)->l_tls_modid, modid1);
- result = 1;
- }
-#endif
-
fp1 = dlsym (h1, "in_dso2");
if (fp1 == NULL)
{
@@ -72,32 +47,6 @@ do_test (void)
exit (1);
}
- /* Dirty test code here: we peek into a private data structure.
- We make sure that the module gets assigned the same ID every
- time. The value of the first round is used. */
-#ifdef __UCLIBC__
- if (modid2 == (size_t) -1)
- modid2 = ((struct dyn_elf *)h2)->dyn->l_tls_modid;
- else if (((struct dyn_elf *)h2)->dyn->l_tls_modid
- != (size_t) modid2)
- {
- printf ("round %d: modid now %zd, initially %zd\n",
- i,
- ((struct dyn_elf *)h2)->dyn->l_tls_modid,
- modid2);
- result = 1;
- }
-#else
- if (modid2 == (size_t) -1)
- modid2 = ((struct link_map *) h2)->l_tls_modid;
- else if (((struct link_map *) h2)->l_tls_modid != modid2)
- {
- printf ("round %d: modid now %zd, initially %zd\n",
- i, ((struct link_map *) h2)->l_tls_modid, modid2);
- result = 1;
- }
-#endif
-
bazp = dlsym (h2, "baz");
if (bazp == NULL)
{
@@ -127,28 +76,6 @@ do_test (void)
exit (1);
}
- /* Dirty test code here: we peek into a private data structure.
- We make sure that the module gets assigned the same ID every
- time. The value of the first round is used. */
-#ifdef __UCLIBC__
- if (((struct dyn_elf *)h1)->dyn->l_tls_modid
- != modid1)
- {
- printf ("round %d: modid now %zd, initially %zd\n",
- i,
- ((struct dyn_elf *)h1)->dyn->l_tls_modid,
- modid1);
- result = 1;
- }
-#else
- if (((struct link_map *) h1)->l_tls_modid != modid1)
- {
- printf ("round %d: modid now %zd, initially %zd\n",
- i, ((struct link_map *) h1)->l_tls_modid, modid1);
- result = 1;
- }
-#endif
-
fp1 = dlsym (h1, "in_dso2");
if (fp1 == NULL)
{
@@ -167,28 +94,6 @@ do_test (void)
exit (1);
}
- /* Dirty test code here: we peek into a private data structure.
- We make sure that the module gets assigned the same ID every
- time. The value of the first round is used. */
-#ifdef __UCLIBC__
- if (((struct dyn_elf *)h2)->dyn->l_tls_modid
- != modid2)
- {
- printf ("round %d: modid now %zd, initially %zd\n",
- i,
- ((struct dyn_elf *)h2)->dyn->l_tls_modid,
- modid2);
- result = 1;
- }
-#else
- if (((struct link_map *) h2)->l_tls_modid != modid2)
- {
- printf ("round %d: modid now %zd, initially %zd\n",
- i, ((struct link_map *) h2)->l_tls_modid, modid2);
- result = 1;
- }
-#endif
-
bazp = dlsym (h2, "baz");
if (bazp == NULL)
{
--
2.17.1