[libgovirt: 2/4] tests: Use g_test_build_filename() instead of g_test_get_filename()
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgovirt: 2/4] tests: Use g_test_build_filename() instead of g_test_get_filename()
- Date: Wed, 4 Jul 2018 16:01:24 +0000 (UTC)
commit 7248ef6ef6ac0ce8a6f1ce0aabb689e0100ca76c
Author: Eduardo Lima (Etrunko) <etrunko redhat com>
Date: Tue Jun 26 13:19:05 2018 -0300
tests: Use g_test_build_filename() instead of g_test_get_filename()
Running 'make distcheck', the test expects the mock file to be installed
under the following dir:
libgovirt-0.3.4/_build/sub/tests/mock-xml-data/
But as it is shipped with the tarball and is found in:
libgovirt-0.3.4/tests/mock-xml-data/test-parse-vm-host-cluster.xml
To fix this problem, we pass 'srcdir' to the test and use it with
g_test_build_filename() instead of g_test_get_filename(), because it
requires environment variables G_TEST_SRCDIR and G_TEST_BUILDDIR to be
set by glib-tap.mk and related files, bringing some extra complexity to
the build system.
Signed-off-by: Eduardo Lima (Etrunko) <etrunko redhat com>
tests/Makefile.am | 1 +
tests/test-govirt.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 05733e4..efd3ed7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -20,6 +20,7 @@ AM_CFLAGS = \
$(GLIB_CFLAGS) \
$(REST_CFLAGS) \
-Dabs_srcdir="\"$(abs_srcdir)\"" \
+ -Dsrcdir="\"$(srcdir)\"" \
-I$(top_srcdir) \
-I$(top_srcdir)/govirt
diff --git a/tests/test-govirt.c b/tests/test-govirt.c
index 5b137ae..e55a595 100644
--- a/tests/test-govirt.c
+++ b/tests/test-govirt.c
@@ -263,7 +263,7 @@ static void govirt_mock_httpd_add_vms(GovirtMockHttpd *httpd, MockOvirtVm vms[],
} else if (vm->filename != NULL) {
char *body;
- if (!g_file_get_contents(g_test_get_filename(G_TEST_DIST, "mock-xml-data", vm->filename, NULL),
+ if (!g_file_get_contents(g_test_build_filename(G_TEST_DIST, srcdir, "mock-xml-data",
vm->filename, NULL),
&body, NULL, NULL)) {
g_warn_if_reached();
continue;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]