Skip to content

Commit

Permalink
[Unit-tests] Add --enable-fake-dlclose configure flag so modules are …
Browse files Browse the repository at this point in the history
…not unloaded and ASAN could give more info and not just <unknown module>.
  • Loading branch information
andywolk committed Oct 23, 2021
1 parent 6b3cd2e commit 734e977
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1986,6 +1986,16 @@ if test "${enable_address_sanitizer}" = "yes"; then
APR_ADDTO(LDFLAGS, -fsanitize=address)
fi

# Enable fake dlclose
AC_ARG_ENABLE(fake_dlclose,
[AC_HELP_STRING([--enable-fake-dlclose],[Do not unload dynamic libraries])],
[enable_fake_dlclose="$enable_fake_dlclose"],
[enable_fake_dlclose="no"])

if test "${enable_fake_dlclose}" = "yes"; then
APR_ADDTO(SWITCH_AM_CFLAGS, -DHAVE_FAKE_DLCLOSE)
fi

AC_ARG_ENABLE(,
[AC_HELP_STRING([--enable-pool-sanitizer],[build with sanitizer friendly pool behavior])],
[enable_pool_sanitizer="$enable_pool_sanitizer"],
Expand Down
2 changes: 2 additions & 0 deletions src/switch_dso.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ SWITCH_DECLARE(void *) switch_dso_data_sym(switch_dso_lib_t lib, const char *sym
void switch_dso_destroy(switch_dso_lib_t *lib)
{
if (lib && *lib) {
#ifndef HAVE_FAKE_DLCLOSE
dlclose(*lib);
#endif
*lib = NULL;
}
}
Expand Down

1 comment on commit 734e977

@andywolk
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.