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/Android.bp b/tests/Android.bp
index 0f9af41..1df9264 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -43,6 +43,9 @@
         linux_bionic: {
             header_libs: ["bionic_libc_platform_headers"],
         },
+        musl: {
+            cflags: ["-DMUSL"],
+        },
     },
     cflags: [
         "-fstack-protector-all",
@@ -469,6 +472,18 @@
                 "libsystemproperties",
             ],
         },
+        musl: {
+            exclude_srcs: [
+                // musl doesn't have error.h
+                "error_test.cpp",
+
+                // musl doesn't define noreturn for C++
+                "stdnoreturn_test.cpp",
+
+                // unsupported relocation type 37
+                "ifunc_test.cpp",
+            ],
+        },
     },
 
     static_libs: [
@@ -1171,6 +1186,13 @@
         linux_bionic: {
             enabled: false,
         },
+        musl: {
+            exclude_static_libs: [
+                // Musl doesn't have fortify
+                "libfortify1-tests-clang",
+                "libfortify2-tests-clang",
+            ],
+        },
     },
 }