]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Ensure LD_PRELOAD exists before running test case
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 28 Mar 2013 18:01:21 +0000 (18:01 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 5 Apr 2013 09:41:46 +0000 (10:41 +0100)
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 <berrange@redhat.com>
tests/testutils.h

index 546c9aed43939c4d7bdfbef99f8e8f7df41522a7..3647487c90707cbf3dd9995935d5214092f179dc 100644 (file)
@@ -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");                                  \