[PATCH 1/2] tests: mock gnutls_dh_params_generate2

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

 



This function generates some big random numbers.
Skip it in tests to save time.
---
 tests/virnettlscontexttest.c |  2 +-
 tests/virnettlssessiontest.c |  2 +-
 tests/virrandommock.c        | 12 ++++++++++++
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/tests/virnettlscontexttest.c b/tests/virnettlscontexttest.c
index b062be6..9f62413 100644
--- a/tests/virnettlscontexttest.c
+++ b/tests/virnettlscontexttest.c
@@ -633,7 +633,7 @@ mymain(void)
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
 
-VIRT_TEST_MAIN(mymain)
+VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virrandommock.so")
 
 #else
 
diff --git a/tests/virnettlssessiontest.c b/tests/virnettlssessiontest.c
index 47fbec6..0d2e106 100644
--- a/tests/virnettlssessiontest.c
+++ b/tests/virnettlssessiontest.c
@@ -487,7 +487,7 @@ mymain(void)
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
 
-VIRT_TEST_MAIN(mymain)
+VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virrandommock.so")
 
 #else
 
diff --git a/tests/virrandommock.c b/tests/virrandommock.c
index 6df5e20..05c7a23 100644
--- a/tests/virrandommock.c
+++ b/tests/virrandommock.c
@@ -37,3 +37,15 @@ virRandomBytes(unsigned char *buf,
 
     return 0;
 }
+
+#ifdef WITH_GNUTLS
+# include <stdio.h>
+# include <gnutls/gnutls.h>
+
+int
+gnutls_dh_params_generate2(gnutls_dh_params_t dparams ATTRIBUTE_UNUSED,
+                           unsigned int bits ATTRIBUTE_UNUSED)
+{
+    return 0;
+}
+#endif
-- 
2.7.3

--
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]