Use have_dl to guard all tests that rely on icu4c.
Bug: http://b/65138342
Test: ran tests
Change-Id: Iddded068a2481e8b15e102c8705545a886ae2772
diff --git a/tests/utils.h b/tests/utils.h
index 81df350..8638850 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -17,6 +17,7 @@
#ifndef __TEST_UTILS_H
#define __TEST_UTILS_H
+#include <dlfcn.h>
#include <inttypes.h>
#include <sys/mman.h>
#include <sys/types.h>
@@ -43,6 +44,12 @@
#define KNOWN_FAILURE_ON_BIONIC(x) x
#endif
+// bionic's dlsym doesn't work in static binaries, so we can't access icu,
+// so any unicode test case will fail.
+static inline bool have_dl() {
+ return (dlopen("libc.so", 0) != nullptr);
+}
+
#if defined(__linux__)
#include <sys/sysmacros.h>