Fix api_base_test failures with shared only builds and on modern glibc#41
Open
ssam18 wants to merge 1 commit into
Open
Fix api_base_test failures with shared only builds and on modern glibc#41ssam18 wants to merge 1 commit into
ssam18 wants to merge 1 commit into
Conversation
The test mocks libc functions with the linker wrap option, which only works when the DAQ library is linked statically into the test binary. Link against a check only convenience library so make check passes when configured with --disable-static. Also pick the stat wrapper based on the glibc version since glibc 2.33 removed the extern inline that redirected stat to __xstat. Fix for the issue snort3#23 and snort3#30.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
api_base_test mocks several libc functions through the linker wrap option, which only takes effect for symbols that are resolved at static link time. When the library is configured with --disable-static, libtool quietly falls back to linking the test against libdaq.so, so the mocks never fire and three of the four tests fail as reported in #23. This change adds a check only convenience library built from the api sources and links api_base_test against it, so the suite passes no matter how the installable library is configured. On glibc 2.33 and later the test also fails to link with an undefined reference to __wrap_stat because stat is no longer an extern inline that calls __xstat, which is what #30 reports. The guard around the stat mock now takes the glibc version into account. Verified make check on Ubuntu with glibc 2.39 in both the default and the --disable-static configurations.