unit-test: Reconfigure after sanitizers

After running `meson configure build -Db_sanitize=none`, there may be
leftovers that cause the next analysis to fail:
`ASan runtime does not come first in initial library list; you should
either link runtime to your application or manually preload it with
LD_PRELOAD.`

Fixes: openbmc/openbmc-build-scripts#42

Change-Id: Ia5b3c6c8a076c61aadd70ab23c029c591a3e29f5
Signed-off-by: Ewelina Walkusz <ewelinax.walkusz@intel.com>
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index 51318ea..448c0da 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -1103,7 +1103,14 @@
             #                '-Db_sanitize=memory')
             # check_call_cmd('meson', 'test', '-C', 'build'
             #                '--logbase', 'testlog-msan')
-            check_call_cmd("meson", "configure", "build", "-Db_sanitize=none")
+            meson_flags.remove("-Db_sanitize=address,undefined")
+            try:
+                check_call_cmd(
+                    "meson", "setup", "--reconfigure", "build", *meson_flags
+                )
+            except Exception:
+                shutil.rmtree("build", ignore_errors=True)
+                check_call_cmd("meson", "setup", "build", *meson_flags)
         else:
             sys.stderr.write("###### Skipping sanitizers ######\n")