Re: [PATCH 3/3] tests: Use virDirOpenSorted()

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

 



On a Friday in 2022, Michal Privoznik wrote:
Since the directory content is not returned in a sorted manner it
may be harder than necessary to find a particular test case. For
instance domaincapstest runs individual test cases in "random"
order. At the first glance it may seem that we are missing a
particular version test. Well, now that we have
virDirOpenSorted() the test cases can run in more predictable
way.


I'm not convinced such predictability is needed - the test cases should be
isolated. On a higher level we run the individual test programs in
parallel, with no expectation of ordering.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
tests/testutilsqemu.c | 4 ++--
tests/virschematest.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 7648ead735..5ca5558b45 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -736,7 +736,7 @@ testQemuGetLatestCapsForArch(const char *arch,

    fullsuffix = g_strdup_printf("%s.%s", arch, suffix);

-    if (virDirOpen(&dir, TEST_QEMU_CAPS_PATH) < 0)
+    if (virDirOpenSorted(&dir, TEST_QEMU_CAPS_PATH) < 0)
        return NULL;

Here we only take note of the highest version number, sorting does not
give us anything extra.

Jano


    while ((rc = virDirRead(dir, &ent, TEST_QEMU_CAPS_PATH)) > 0) {
@@ -824,7 +824,7 @@ testQemuCapsIterate(const char *suffix,
        return -1;
    }

-    if (virDirOpen(&dir, TEST_QEMU_CAPS_PATH) < 0)
+    if (virDirOpenSorted(&dir, TEST_QEMU_CAPS_PATH) < 0)
        return -1;

Attachment: signature.asc
Description: PGP signature


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

  Powered by Linux