Build bionic unit tests for musl
Modify bionic unit tests that are built for glibc so that they also
build against musl. They don't all pass though:
With glibc:
2 SLOW TESTS
4 TIMEOUT TESTS
313 FAILED TESTS
YOU HAVE 2 DISABLED TESTS
With musl:
11 SLOW TESTS
11 TIMEOUT TESTS
363 FAILED TESTS
YOU HAVE 2 DISABLED TESTS
Bug: 190084016
Test: m bionic-unit-tests-glibc with musl
Test: atest bionic-unit-tests-static
Test: atest --host bionic-unit-tests-glibc with glibc
Change-Id: I79b6eab04fed3cc4392450df5eef2579412edfe1
diff --git a/tests/elftls_dl_test.cpp b/tests/elftls_dl_test.cpp
index 277b2e3..aa975de 100644
--- a/tests/elftls_dl_test.cpp
+++ b/tests/elftls_dl_test.cpp
@@ -27,9 +27,11 @@
*/
#include <dlfcn.h>
-#include <gtest/gtest.h>
#include <link.h>
+#include <android-base/file.h>
+#include <gtest/gtest.h>
+
#include <thread>
#include "gtest_globals.h"
@@ -356,7 +358,7 @@
// This test is also run with glibc, where dlpi_name may have relative path components, so
// examine just the basename when searching for the library.
- if (strcmp(basename(info->dlpi_name), "libtest_elftls_dynamic.so") != 0) return 0;
+ if (strcmp(android::base::Basename(info->dlpi_name).c_str(), "libtest_elftls_dynamic.so") != 0) return 0;
tls_info.found = true;
tls_info.modid = info->dlpi_tls_modid;