[PATCH 02/18] Ensure LD_PRELOAD exists before running test case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

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 existance
of the library to protect against this

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 tests/testutils.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/testutils.h b/tests/testutils.h
index 546c9ae..3647487 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");                                  \
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]