Ensure address sanitize operation builds all components
The 'meson configure' call designed to enable address sanitize checks,
under some circumstances, prevents shared objects supplied from
subprojects from being rebuilt.
Using a 'setup reconfigure' operation allows the shared libraries to
be built for the address sanitization phase. Instead of receiving
segmentation faults for missing libraries, the tests run to
completion.
Tested:
Ran the CI script w/o these changes and saw the sanitize portion fail
due to missing libraries.
Installed the changes, and the CI script passed the sanitize section
because the shared libraries were built.
Change-Id: I60fef2518ec13ffbcc615e55f8f446cf92f4dd0a
Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index d2ddb29..cc4abdd 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -912,7 +912,7 @@
raise Exception("Unknown meson option type")
return "-D{}={}".format(key, str_val)
- def configure(self, build_for_testing):
+ def get_configure_flags(self, build_for_testing):
self.build_for_testing = build_for_testing
meson_options = {}
if os.path.exists("meson.options"):
@@ -952,6 +952,10 @@
)
if MESON_FLAGS.get(self.package) is not None:
meson_flags.extend(MESON_FLAGS.get(self.package))
+ return meson_flags
+
+ def configure(self, build_for_testing):
+ meson_flags = self.get_configure_flags(build_for_testing)
try:
check_call_cmd(
"meson", "setup", "--reconfigure", "build", *meson_flags
@@ -1075,13 +1079,15 @@
# in the build process to ensure we don't have undefined
# runtime code.
if is_sanitize_safe():
- check_call_cmd(
- "meson",
- "configure",
- "build",
- "-Db_sanitize=address,undefined",
- "-Db_lundef=false",
- )
+ meson_flags = self.get_configure_flags(self.build_for_testing)
+ meson_flags.append("-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)
check_call_cmd(
"meson",
"test",