[libvirt] [dbus PATCH 0/3] tests: Some fixes and cleanups

The first patch fixes an actual bug, the rest just makes things a bit nicer. Andrea Bolognani (3): tests: Fix VIRT_DBUS_INTERFACES_DIR tests: Don't loop up abs_top_builddir in the environment tests: Use AM_TESTS_ENVIRONMENT tests/Makefile.am | 5 ++--- tests/libvirttest.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) -- 2.17.1

D-Bus interface files are generated, so we need to look for them inside builddir instead of srcdir for the test suite to pass before installation. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index e841627..10d2935 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -38,4 +38,4 @@ TESTS = $(test_programs) TESTS_ENVIRONMENT = \ abs_top_builddir=$(abs_top_builddir) \ - VIRT_DBUS_INTERFACES_DIR=$(abs_top_srcdir)/data + VIRT_DBUS_INTERFACES_DIR=$(abs_top_builddir)/data -- 2.17.1

On Wed, Jun 20, 2018 at 02:20:27PM +0200, Andrea Bolognani wrote:
D-Bus interface files are generated, so we need to look for them inside builddir instead of srcdir for the test suite to pass before installation.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am index e841627..10d2935 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -38,4 +38,4 @@ TESTS = $(test_programs)
TESTS_ENVIRONMENT = \ abs_top_builddir=$(abs_top_builddir) \ - VIRT_DBUS_INTERFACES_DIR=$(abs_top_srcdir)/data + VIRT_DBUS_INTERFACES_DIR=$(abs_top_builddir)/data
NACK, they are not generated. Pavel

This only works if the caller has prepared the environment accordingly; however, there is already a fallback path in place and it works just fine, so much so that when test cases are executed manually through the 'run' script that's the only one being involved. Drop environment handling entirely and rely on path manipulation instead. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- tests/Makefile.am | 1 - tests/libvirttest.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 10d2935..81cb263 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -37,5 +37,4 @@ EXTRA_DIST = \ TESTS = $(test_programs) TESTS_ENVIRONMENT = \ - abs_top_builddir=$(abs_top_builddir) \ VIRT_DBUS_INTERFACES_DIR=$(abs_top_builddir)/data diff --git a/tests/libvirttest.py b/tests/libvirttest.py index 06e52c0..c1543e8 100644 --- a/tests/libvirttest.py +++ b/tests/libvirttest.py @@ -10,7 +10,7 @@ import time import xmldata -root = os.environ.get('abs_top_builddir', os.path.dirname(os.path.dirname(__file__))) +root = os.path.dirname(os.path.dirname(__file__)) exe = os.path.join(root, 'src', 'libvirt-dbus') DBusGMainLoop(set_as_default=True) -- 2.17.1

On Wed, Jun 20, 2018 at 02:20:28PM +0200, Andrea Bolognani wrote:
This only works if the caller has prepared the environment accordingly; however, there is already a fallback path in place and it works just fine, so much so that when test cases are executed manually through the 'run' script that's the only one being involved.
Drop environment handling entirely and rely on path manipulation instead.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- tests/Makefile.am | 1 - tests/libvirttest.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am index 10d2935..81cb263 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -37,5 +37,4 @@ EXTRA_DIST = \ TESTS = $(test_programs)
TESTS_ENVIRONMENT = \ - abs_top_builddir=$(abs_top_builddir) \ VIRT_DBUS_INTERFACES_DIR=$(abs_top_builddir)/data diff --git a/tests/libvirttest.py b/tests/libvirttest.py index 06e52c0..c1543e8 100644 --- a/tests/libvirttest.py +++ b/tests/libvirttest.py @@ -10,7 +10,7 @@ import time import xmldata
-root = os.environ.get('abs_top_builddir', os.path.dirname(os.path.dirname(__file__))) +root = os.path.dirname(os.path.dirname(__file__)) exe = os.path.join(root, 'src', 'libvirt-dbus')
NACK, this is essential for VPATH build. Pavel

According to the documentation[1], TESTS_ENVIRONMENT is reserved for the user, which means we shouldn't be using it. AM_TESTS_ENVIRONMENT needs to be terminated with a semicolon, so do that; that requires exporting the variables instead of merely declaring them as well. [1] https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Tes... Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- tests/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 81cb263..e27a24a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -36,5 +36,5 @@ EXTRA_DIST = \ TESTS = $(test_programs) -TESTS_ENVIRONMENT = \ - VIRT_DBUS_INTERFACES_DIR=$(abs_top_builddir)/data +AM_TESTS_ENVIRONMENT = \ + export VIRT_DBUS_INTERFACES_DIR=$(abs_top_builddir)/data; -- 2.17.1

On Wed, Jun 20, 2018 at 02:20:29PM +0200, Andrea Bolognani wrote:
According to the documentation[1], TESTS_ENVIRONMENT is reserved for the user, which means we shouldn't be using it.
AM_TESTS_ENVIRONMENT needs to be terminated with a semicolon, so do that; that requires exporting the variables instead of merely declaring them as well.
[1] https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Tes...
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- tests/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am index 81cb263..e27a24a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -36,5 +36,5 @@ EXTRA_DIST = \
TESTS = $(test_programs)
-TESTS_ENVIRONMENT = \ - VIRT_DBUS_INTERFACES_DIR=$(abs_top_builddir)/data +AM_TESTS_ENVIRONMENT = \ + export VIRT_DBUS_INTERFACES_DIR=$(abs_top_builddir)/data;
This will need to be modified to cover the original environment variables but otherwise looks good. Pavel
participants (2)
-
Andrea Bolognani
-
Pavel Hrdina