[PATCH 08/19] tests: virbuffer: Drop 'infinite loop' tests

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

 



The tests are deeply based on internals of virBuffer which will be
replaced in an upcoming patch with glib's GString. Remove the tests.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/virbuftest.c | 41 -----------------------------------------
 1 file changed, 41 deletions(-)

diff --git a/tests/virbuftest.c b/tests/virbuftest.c
index 246c572bd2..21b6295bb3 100644
--- a/tests/virbuftest.c
+++ b/tests/virbuftest.c
@@ -13,45 +13,6 @@ struct testInfo {
     int doEscape;
 };

-static int testBufInfiniteLoop(const void *data)
-{
-    virBuffer bufinit = VIR_BUFFER_INITIALIZER;
-    virBufferPtr buf = &bufinit;
-    char *addstr = NULL, *bufret = NULL;
-    int ret = -1;
-    const struct testInfo *info = data;
-    int len;
-
-    virBufferAddChar(buf, 'a');
-
-    /*
-     * Infinite loop used to trigger if:
-     * (strlen + 1 > 1000) && (strlen == buf-size - buf-use - 1)
-     * which was the case after the above addchar at the time of the bug.
-     * This test is a bit fragile, since it relies on virBuffer internals.
-     */
-    len = buf->size - buf->use - 1;
-    if (virAsprintf(&addstr, "%*s", len, "a") < 0)
-        goto out;
-
-    if (info->doEscape)
-        virBufferEscapeString(buf, "%s", addstr);
-    else
-        virBufferAsprintf(buf, "%s", addstr);
-
-    ret = 0;
- out:
-    bufret = virBufferContentAndReset(buf);
-    if (!bufret) {
-        VIR_TEST_DEBUG("Buffer had error set");
-        ret = -1;
-    }
-
-    VIR_FREE(addstr);
-    VIR_FREE(bufret);
-    return ret;
-}
-
 static int testBufAutoIndent(const void *data G_GNUC_UNUSED)
 {
     virBuffer bufinit = VIR_BUFFER_INITIALIZER;
@@ -450,8 +411,6 @@ mymain(void)
             ret = -1; \
     } while (0)

-    DO_TEST("EscapeString infinite loop", testBufInfiniteLoop, 1);
-    DO_TEST("VSprintf infinite loop", testBufInfiniteLoop, 0);
     DO_TEST("Auto-indentation", testBufAutoIndent, 0);
     DO_TEST("Trim", testBufTrim, 0);
     DO_TEST("AddBuffer", testBufAddBuffer, 0);
-- 
2.21.0

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





[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