scripts/unit-test: Don't run valgrind on ppc64

When implementing meson support I forgot to include the check to make
sure we don't run valgrind for ppc64 builds. This adds the check that is
used in our autotools and cmake builds already.

Change-Id: I70390c415da2b381714f0374630b9a595aa299a5
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index a832304..81ad017 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -550,6 +550,12 @@
     except CalledProcessError:
         raise Exception('Cppcheck failed')
 
+def is_valgrind_safe():
+    """
+    Returns whether it is safe to run valgrind 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
@@ -563,7 +569,7 @@
     # that is inlined into optimized code for POWER by gcc 7+. Until we find
     # a workaround, just don't run valgrind tests on POWER.
     # https://github.com/openbmc/openbmc/issues/3315
-    if re.match('ppc64', platform.machine()) is not None:
+    if not is_valgrind_safe():
         return
     if not make_target_exists('check-valgrind'):
         return
@@ -712,7 +718,9 @@
         if os.path.isfile(CODE_SCAN_DIR + '/meson.build'):
             check_call_cmd(top_dir, 'meson', 'test', '-C', 'build')
             check_call_cmd(top_dir, 'ninja', '-C', 'build', 'coverage-html')
-            check_call_cmd(top_dir, 'meson', 'test', '-C', 'build', '--wrap', 'valgrind')
+            if is_valgrind_safe():
+                check_call_cmd(top_dir, 'meson', 'test', '-C', 'build',
+                               '--wrap', 'valgrind')
         else:
             run_unit_tests(top_dir)
             maybe_run_valgrind(top_dir)