[PATCH v2 2/6] tests: Fix mock chaining on macOS

Michal Prívozník mprivozn at redhat.com
Fri Nov 27 09:53:56 UTC 2020


On 11/23/20 11:10 PM, Roman Bolshakov wrote:
> Some tests in qemuxml2argvtest need opendir() from virpcimock, others
> need opendir() from virfilewrapper.
> 
> But as of now, only opendir() from virpcimock has an effect.
> real_opendir in virpcimock has a pointer to opendir$INODE64 in
> libsystem_kernel.dylib instead of pointing to opendir$INODE64 in
> qemuxml2argvtest (from virfilewrapper). And because the second one is
> never used, tests that rely on prefixes added by virFileWrapperAddPrefix
> fail.
> 
> That can be fixed if dlsym(3) is asked explicitly to search symbols in
> main executable with RTLD_MAIN_ONLY before going to other dylibs.
> Existing RTLD_NEXT handle results into libsystem_kernel.dylib being
> searched before main executable.
> 
> Signed-off-by: Roman Bolshakov <r.bolshakov at yadro.com>
> ---
>   tests/virmock.h    | 13 +++++++++++++
>   tests/virpcimock.c |  1 +
>   2 files changed, 14 insertions(+)

Reviewed-by: Michal Privoznik <mprivozn at redhat.com>

Michal




More information about the libvir-list mailing list