[libvirt] [PATCH 0/2] Two more 'make check' speedups

Do not generate random bignums and stop doing expensive virsh tests by default. Ján Tomko (2): tests: mock gnutls_dh_params_generate2 tests: mark virsh-optparse and virsh-synopsis as expensive tests/virnettlscontexttest.c | 2 +- tests/virnettlssessiontest.c | 2 +- tests/virrandommock.c | 12 ++++++++++++ tests/virsh-optparse | 2 ++ tests/virsh-synopsis | 2 ++ 5 files changed, 18 insertions(+), 2 deletions(-) -- 2.7.3

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

On Thu, Jun 16, 2016 at 10:46:42 +0200, Ján Tomko wrote:
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/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) +{
I'm not okay with completely removing this function here since virnettlssessiontest is creating a session and thus this might either reduce test coverage or introduce a problem in some cases. I suggest that you call it just once and then use gnutls_dh_params_cpy to cache it in the test itself rather than just skipping the init.

On Fri, Jun 17, 2016 at 01:16:35PM +0200, Peter Krempa wrote:
On Thu, Jun 16, 2016 at 10:46:42 +0200, Ján Tomko wrote:
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/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) +{
I'm not okay with completely removing this function here since virnettlssessiontest is creating a session and thus this might either reduce test coverage or introduce a problem in some cases.
I suggest that you call it just once and then use gnutls_dh_params_cpy to cache it in the test itself rather than just skipping the init.
We already have the private key stored inline to the test suite. It might be possible to also pre-generate DH params and store them inline too. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

virsh-synopsis takes even longer than virsh-all which is already makred as expensive. --- tests/virsh-optparse | 2 ++ tests/virsh-synopsis | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/virsh-optparse b/tests/virsh-optparse index cbd6c30..cb0f3d4 100755 --- a/tests/virsh-optparse +++ b/tests/virsh-optparse @@ -19,6 +19,8 @@ . "$(dirname $0)/test-lib.sh" +test_expensive + # If $abs_top_builddir/tools is not early in $PATH, put it there, # so that we can safely invoke "virsh" simply with its name. case $PATH in diff --git a/tests/virsh-synopsis b/tests/virsh-synopsis index d0d1197..60446dc 100755 --- a/tests/virsh-synopsis +++ b/tests/virsh-synopsis @@ -19,6 +19,8 @@ . "$(dirname $0)/test-lib.sh" +test_expensive + if test "$VERBOSE" = yes; then set -x $abs_top_builddir/tools/virsh --version -- 2.7.3

On Thu, Jun 16, 2016 at 10:46:43 +0200, Ján Tomko wrote:
virsh-synopsis takes even longer than virsh-all which is already makred as expensive. --- tests/virsh-optparse | 2 ++ tests/virsh-synopsis | 2 ++ 2 files changed, 4 insertions(+)
diff --git a/tests/virsh-optparse b/tests/virsh-optparse index cbd6c30..cb0f3d4 100755 --- a/tests/virsh-optparse +++ b/tests/virsh-optparse @@ -19,6 +19,8 @@
. "$(dirname $0)/test-lib.sh"
+test_expensive + # If $abs_top_builddir/tools is not early in $PATH, put it there, # so that we can safely invoke "virsh" simply with its name. case $PATH in diff --git a/tests/virsh-synopsis b/tests/virsh-synopsis index d0d1197..60446dc 100755 --- a/tests/virsh-synopsis +++ b/tests/virsh-synopsis
I think we could drop this test completely together with virsh-all if we add small C program or perhaps add a switch to virsh that will iterate the cmdGroups[] array declared in virsh (that should be simple enough to extract) and will call the checks that make sure that the the command and argument help strings are present.
participants (3)
-
Daniel P. Berrange
-
Ján Tomko
-
Peter Krempa