Replace local MUSL define with global ANDROID_HOST_MUSL
Bug: 190084016
Test: m USE_HOST_MUSL=true bionic-unit-tests-glibc
Change-Id: I56b23576cb24912112d2ae56d8ecc2e3716982fe
diff --git a/tests/glob_test.cpp b/tests/glob_test.cpp
index 8bf35bf..6ce5f2f 100644
--- a/tests/glob_test.cpp
+++ b/tests/glob_test.cpp
@@ -17,6 +17,8 @@
#include <glob.h>
#include <dirent.h>
+#include <sys/cdefs.h>
+
#include <gtest/gtest.h>
#include <string>
@@ -34,7 +36,7 @@
// Helper for use with GLOB_ALTDIRFUNC to iterate over the elements of `fake_dir`.
//
-#if !defined(MUSL)
+#if !defined(ANDROID_HOST_MUSL)
static std::vector<std::string> fake_dir;
static size_t fake_dir_offset;
static void fake_closedir(void*) {
@@ -104,7 +106,7 @@
globfree(&g);
}
-#if !defined(MUSL)
+#if !defined(ANDROID_HOST_MUSL)
static std::string g_failure_path;
static int g_failure_errno;
static int test_error_callback_result;
@@ -116,7 +118,7 @@
#endif
TEST(glob, glob_gl_errfunc) {
-#if !defined(MUSL)
+#if !defined(ANDROID_HOST_MUSL)
glob_t g = {};
InstallFake(&g);
@@ -137,7 +139,7 @@
}
TEST(glob, glob_GLOB_ERR) {
-#if !defined(MUSL)
+#if !defined(ANDROID_HOST_MUSL)
glob_t g = {};
InstallFake(&g);
@@ -184,7 +186,7 @@
}
TEST(glob, glob_GLOB_NOSORT) {
-#if !defined(MUSL)
+#if !defined(ANDROID_HOST_MUSL)
fake_dir = { "c", "a", "d", "b" };
glob_t g = {};
@@ -213,7 +215,7 @@
}
TEST(glob, glob_GLOB_MAGCHAR) {
-#if !defined(MUSL)
+#if !defined(ANDROID_HOST_MUSL)
glob_t g = {};
ASSERT_EQ(GLOB_NOMATCH, glob("/does-not-exist", 0, nullptr, &g));
ASSERT_TRUE((g.gl_flags & GLOB_MAGCHAR) == 0);
@@ -228,7 +230,7 @@
#endif
}
-#if !defined(MUSL)
+#if !defined(ANDROID_HOST_MUSL)
static void CheckGlob(const char* pattern, const std::vector<std::string>& expected_matches) {
glob_t g = {};
InstallFake(&g);
@@ -248,7 +250,7 @@
#endif
TEST(glob, glob_globbing) {
-#if !defined(MUSL)
+#if !defined(ANDROID_HOST_MUSL)
fake_dir = { "f1", "f2", "f30", "f40" };
CheckGlob("f?", { "f1", "f2" });
@@ -260,7 +262,7 @@
}
TEST(glob, glob_globbing_rsc) {
-#if !defined(MUSL)
+#if !defined(ANDROID_HOST_MUSL)
// https://research.swtch.com/glob
fake_dir = { "axbxcxdxe" };
CheckGlob("a*b*c*d*e*", { "axbxcxdxe" });