Re: [PATCH] test: Fix testNodeGetFreePages

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

 



On Tue, Sep 26, 2023 at 02:20:43PM +0200, Martin Kletzander wrote:
The function is supposed to return the number of items filled into the
array and not zero.  Also change the initialization of the "randomness"
to be based on the startCell so that the values are different for each
cell even for separate calls.


And for this to be really true consider the following also squashed in
(already done locally):

diff --git c/src/test/test_driver.c i/src/test/test_driver.c
index 998d102ddc5a..a352fcb7b070 100644
--- c/src/test/test_driver.c
+++ i/src/test/test_driver.c
@@ -4503,11 +4503,12 @@ testNodeGetFreePages(virConnectPtr conn G_GNUC_UNUSED,
                      unsigned int flags)
 {
     size_t i = 0, j = 0;
-    int x = startCell * 6;

     virCheckFlags(0, -1);

     for (i = 0; i < cellCount; i++) {
+        int x = (startCell + i) * 6;
+
         for (j = 0; j < npages; j++) {
             x = x * 2 + 7;
             counts[(i * npages) +  j] = x;
--

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
src/test/test_driver.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index c962aa74786e..998d102ddc5a 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -4503,7 +4503,7 @@ testNodeGetFreePages(virConnectPtr conn G_GNUC_UNUSED,
                     unsigned int flags)
{
    size_t i = 0, j = 0;
-    int x = 6;
+    int x = startCell * 6;

    virCheckFlags(0, -1);

@@ -4514,7 +4514,7 @@ testNodeGetFreePages(virConnectPtr conn G_GNUC_UNUSED,
        }
    }

-    return 0;
+    return cellCount * npages;
}

static int testDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)
--
2.42.0

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