From: Daniel P. Berrange Date: Thu, 28 Mar 2013 18:01:21 +0000 (+0000) Subject: Ensure LD_PRELOAD exists before running test case X-Git-Tag: v1.0.5-rc1~232 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1d3154a50e4303bf6f4f6c995a169820c8924fe;p=thirdparty%2Flibvirt.git Ensure LD_PRELOAD exists before running test case The linker will ignore LD_PRELOAD libraries which do not exist, just printing a warning message. This is not helpful for the test suite which will be utterly fubar without the preload library present. Add an explicit test for existence of the library to protect against this Signed-off-by: Daniel P. Berrange --- diff --git a/tests/testutils.h b/tests/testutils.h index 546c9aed43..3647487c90 100644 --- a/tests/testutils.h +++ b/tests/testutils.h @@ -75,6 +75,10 @@ int virtTestMain(int argc, const char *preload = getenv("LD_PRELOAD"); \ if (preload == NULL || strstr(preload, lib) == NULL) { \ char *newenv; \ + if (!virFileIsExecutable(lib)) { \ + perror(lib); \ + return EXIT_FAILURE; \ + } \ if (virAsprintf(&newenv, "%s%s%s", preload ? preload : "", \ preload ? ":" : "", lib) < 0) { \ perror("virAsprintf"); \