scripts/unit-test: Don't run ub+asan on ppc64

Currently broken in Ubuntu 18.04 + gcc8

==362==Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly. ABORTING.
==362==ASan shadow was supposed to be located in the [0x01ffffff0000-0x11ffffffffff] range.
==362==Process memory map follows:
        0x0f37ea840000-0x0f37ea870000   /home/wak/google-src/stdplus/build/test/signal
        0x0f37ea870000-0x0f37ea880000   /home/wak/google-src/stdplus/build/test/signal
        0x0f37ea880000-0x0f37ea8a0000   /home/wak/google-src/stdplus/build/test/signal
        0x73b972fe0000-0x73b973020000
        0x73b973030000-0x73b9733c0000
        0x73b9733c0000-0x73b9734f0000   /lib/powerpc64le-linux-gnu/libm-2.27.so
        0x73b9734f0000-0x73b973500000   /lib/powerpc64le-linux-gnu/libm-2.27.so
        0x73b973500000-0x73b973510000   /lib/powerpc64le-linux-gnu/libm-2.27.so
        0x73b973510000-0x73b973540000   /lib/powerpc64le-linux-gnu/libpthread-2.27.so
        0x73b973540000-0x73b973550000   /lib/powerpc64le-linux-gnu/libpthread-2.27.so
        0x73b973550000-0x73b973560000   /lib/powerpc64le-linux-gnu/libpthread-2.27.so
        0x73b973560000-0x73b973570000   /lib/powerpc64le-linux-gnu/librt-2.27.so
        0x73b973570000-0x73b973580000   /lib/powerpc64le-linux-gnu/librt-2.27.so
        0x73b973580000-0x73b973590000   /lib/powerpc64le-linux-gnu/librt-2.27.so
        0x73b973590000-0x73b9735a0000   /lib/powerpc64le-linux-gnu/libdl-2.27.so
        0x73b9735a0000-0x73b9735b0000   /lib/powerpc64le-linux-gnu/libdl-2.27.so
        0x73b9735b0000-0x73b9735c0000   /lib/powerpc64le-linux-gnu/libdl-2.27.so
        0x73b9735c0000-0x73b9737d0000   /lib/powerpc64le-linux-gnu/libc-2.27.so
        0x73b9737d0000-0x73b9737e0000   /lib/powerpc64le-linux-gnu/libc-2.27.so
        0x73b9737e0000-0x73b9737f0000   /lib/powerpc64le-linux-gnu/libc-2.27.so
        0x73b9737f0000-0x73b973810000   /lib/powerpc64le-linux-gnu/libgcc_s.so.1
        0x73b973810000-0x73b973820000   /lib/powerpc64le-linux-gnu/libgcc_s.so.1
        0x73b973820000-0x73b973830000   /lib/powerpc64le-linux-gnu/libgcc_s.so.1
        0x73b973830000-0x73b973890000   /usr/lib/powerpc64le-linux-gnu/libubsan.so.1.0.0
        0x73b973890000-0x73b9738a0000   /usr/lib/powerpc64le-linux-gnu/libubsan.so.1.0.0
        0x73b9738a0000-0x73b9738b0000   /usr/lib/powerpc64le-linux-gnu/libubsan.so.1.0.0
        0x73b9738b0000-0x73b9738c0000   /usr/lib/powerpc64le-linux-gnu/libubsan.so.1.0.0
        0x73b9738c0000-0x73b974390000
        0x73b974390000-0x73b9745a0000   /usr/lib/powerpc64le-linux-gnu/libstdc++.so.6.0.25
        0x73b9745a0000-0x73b9745b0000   /usr/lib/powerpc64le-linux-gnu/libstdc++.so.6.0.25
        0x73b9745b0000-0x73b9745c0000   /usr/lib/powerpc64le-linux-gnu/libstdc++.so.6.0.25
        0x73b9745c0000-0x73b974630000   /usr/local/lib/libgtest.so
        0x73b974630000-0x73b974640000   /usr/local/lib/libgtest.so
        0x73b974640000-0x73b974650000   /usr/local/lib/libgtest.so
        0x73b974650000-0x73b974660000   /usr/local/lib/libgtest_main.so
        0x73b974660000-0x73b974670000   /usr/local/lib/libgtest_main.so
        0x73b974670000-0x73b974680000   /usr/local/lib/libgtest_main.so
        0x73b974680000-0x73b9746a0000   /home/wak/google-src/stdplus/build/src/libstdplus.so
        0x73b9746a0000-0x73b9746b0000   /home/wak/google-src/stdplus/build/src/libstdplus.so
        0x73b9746b0000-0x73b9746c0000   /home/wak/google-src/stdplus/build/src/libstdplus.so
        0x73b9746c0000-0x73b974890000   /usr/lib/powerpc64le-linux-gnu/libasan.so.5.0.0
        0x73b974890000-0x73b9748a0000   /usr/lib/powerpc64le-linux-gnu/libasan.so.5.0.0
        0x73b9748a0000-0x73b9748b0000   /usr/lib/powerpc64le-linux-gnu/libasan.so.5.0.0
        0x73b9748b0000-0x73b975520000
        0x73b975520000-0x73b975540000   [vdso]
        0x73b975540000-0x73b975580000   /lib/powerpc64le-linux-gnu/ld-2.27.so
        0x73b975580000-0x73b975590000   /lib/powerpc64le-linux-gnu/ld-2.27.so
        0x73b975590000-0x73b9755a0000   /lib/powerpc64le-linux-gnu/ld-2.27.so
        0x7fffd5b70000-0x7fffd5ba0000   [stack]
==362==End of process memory map.
-------

Tested:
    Ran on x86 and verified that ub+asan is running and passing as
    expected. Ran on ppc64 and verified that ub+asan is not run and the
    build still passes.

Change-Id: If22ad1fe10da479b1e91a8e746cd2cbcf5c270d6
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index 1c8ee07..1c3c815 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -560,6 +560,12 @@
     """
     return re.match('ppc64', platform.machine()) is None
 
+def is_sanitize_safe():
+    """
+    Returns whether it is safe to run sanitizers on our platform
+    """
+    return re.match('ppc64', platform.machine()) is None
+
 def maybe_run_valgrind(top_dir):
     """
     Potentially runs the unit tests through valgrind for the package
@@ -745,18 +751,19 @@
                 # asan symbols at runtime only. We don't want to set it earlier
                 # in the build process to ensure we don't have undefined
                 # runtime code.
-                check_call_cmd(top_dir, 'meson', 'configure', 'build',
-                               '-Db_sanitize=address,undefined',
-                               '-Db_lundef=false')
-                check_call_cmd(top_dir, 'meson', 'test', '-C', 'build',
-                               '--logbase', 'testlog-ubasan')
-                # TODO: Fix memory sanitizer
-                #check_call_cmd(top_dir, 'meson', 'configure', 'build',
-                #               '-Db_sanitize=memory')
-                #check_call_cmd(top_dir, 'meson', 'test', '-C', 'build'
-                #               '--logbase', 'testlog-msan')
-                check_call_cmd(top_dir, 'meson', 'configure', 'build',
-                               '-Db_sanitize=none', '-Db_lundef=true')
+                if is_sanitize_safe():
+                    check_call_cmd(top_dir, 'meson', 'configure', 'build',
+                                   '-Db_sanitize=address,undefined',
+                                   '-Db_lundef=false')
+                    check_call_cmd(top_dir, 'meson', 'test', '-C', 'build',
+                                   '--logbase', 'testlog-ubasan')
+                    # TODO: Fix memory sanitizer
+                    #check_call_cmd(top_dir, 'meson', 'configure', 'build',
+                    #               '-Db_sanitize=memory')
+                    #check_call_cmd(top_dir, 'meson', 'test', '-C', 'build'
+                    #               '--logbase', 'testlog-msan')
+                    check_call_cmd(top_dir, 'meson', 'configure', 'build',
+                                   '-Db_sanitize=none', '-Db_lundef=true')
 
                 # Run coverage checks
                 check_call_cmd(top_dir, 'meson', 'configure', 'build',