As evidenced by all existing callers, the only directory it makes
sense to use is TEST_QEMU_CAPS_PATH, so let's just bake that into
the function.

Signed-off-by: Andrea Bolognani <abolo...@redhat.com>
---
 tests/qemublocktest.c       |  3 +--
 tests/testutilsqemu.c       | 14 ++++++--------
 tests/testutilsqemu.h       |  3 +--
 tests/testutilsqemuschema.c |  3 +--
 4 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 1a365a411c..c221b8af30 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -327,8 +327,7 @@ mymain(void)
 
     diskxmljsondata.driver = &driver;
 
-    if (!(capslatest_x86_64 = testQemuGetLatestCapsForArch(abs_srcdir 
"/qemucapabilitiesdata",
-                                                           "x86_64", "xml")))
+    if (!(capslatest_x86_64 = testQemuGetLatestCapsForArch("x86_64", "xml")))
         return EXIT_FAILURE;
 
     VIR_TEST_VERBOSE("\nlatest caps x86_64: %s\n", capslatest_x86_64);
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 0f295dc9a9..ccc05233db 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -805,8 +805,7 @@ testQemuCapsSetGIC(virQEMUCapsPtr qemuCaps,
 
 
 char *
-testQemuGetLatestCapsForArch(const char *dirname,
-                             const char *arch,
+testQemuGetLatestCapsForArch(const char *arch,
                              const char *suffix)
 {
     struct dirent *ent;
@@ -822,10 +821,10 @@ testQemuGetLatestCapsForArch(const char *dirname,
     if (virAsprintf(&fullsuffix, "%s.%s", arch, suffix) < 0)
         goto cleanup;
 
-    if (virDirOpen(&dir, dirname) < 0)
+    if (virDirOpen(&dir, TEST_QEMU_CAPS_PATH) < 0)
         goto cleanup;
 
-    while ((rc = virDirRead(dir, &ent, dirname)) > 0) {
+    while ((rc = virDirRead(dir, &ent, TEST_QEMU_CAPS_PATH)) > 0) {
         VIR_FREE(tmp);
 
         if ((rc = VIR_STRDUP(tmp, STRSKIP(ent->d_name, "caps_"))) < 0)
@@ -853,11 +852,11 @@ testQemuGetLatestCapsForArch(const char *dirname,
 
     if (!maxname) {
         VIR_TEST_VERBOSE("failed to find capabilities for '%s' in '%s'\n",
-                         arch, dirname);
+                         arch, TEST_QEMU_CAPS_PATH);
         goto cleanup;
     }
 
-    ignore_value(virAsprintf(&ret, "%s/%s", dirname, maxname));
+    ignore_value(virAsprintf(&ret, "%s/%s", TEST_QEMU_CAPS_PATH, maxname));
 
  cleanup:
     VIR_FREE(tmp);
@@ -886,8 +885,7 @@ testQemuGetLatestCaps(void)
     VIR_TEST_VERBOSE("\n");
 
     for (i = 0; i < ARRAY_CARDINALITY(archs); ++i) {
-        char *cap = testQemuGetLatestCapsForArch(abs_srcdir 
"/qemucapabilitiesdata",
-                                                 archs[i], "xml");
+        char *cap = testQemuGetLatestCapsForArch(archs[i], "xml");
 
         if (!cap || virHashAddEntry(capslatest, archs[i], cap) < 0)
             goto error;
diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h
index 9ed633f8c0..949e98f591 100644
--- a/tests/testutilsqemu.h
+++ b/tests/testutilsqemu.h
@@ -92,8 +92,7 @@ int qemuTestCapsCacheInsert(virFileCachePtr cache,
 int testQemuCapsSetGIC(virQEMUCapsPtr qemuCaps,
                        int gic);
 
-char *testQemuGetLatestCapsForArch(const char *dirname,
-                                   const char *arch,
+char *testQemuGetLatestCapsForArch(const char *arch,
                                    const char *suffix);
 virHashTablePtr testQemuGetLatestCaps(void);
 
diff --git a/tests/testutilsqemuschema.c b/tests/testutilsqemuschema.c
index aa846e1e79..f1365e8846 100644
--- a/tests/testutilsqemuschema.c
+++ b/tests/testutilsqemuschema.c
@@ -533,8 +533,7 @@ testQEMUSchemaGetLatest(void)
     virJSONValuePtr reply = NULL;
     virJSONValuePtr schema = NULL;
 
-    if (!(capsLatestFile = testQemuGetLatestCapsForArch(abs_srcdir 
"/qemucapabilitiesdata",
-                                                        "x86_64", "replies"))) 
{
+    if (!(capsLatestFile = testQemuGetLatestCapsForArch("x86_64", "replies"))) 
{
         VIR_TEST_VERBOSE("failed to find latest caps replies\n");
         return NULL;
     }
-- 
2.20.1

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

Reply via email to