]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: delete VIR_ALLOC tests cases
authorJán Tomko <jtomko@redhat.com>
Thu, 8 Oct 2020 11:50:00 +0000 (13:50 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 8 Oct 2020 17:19:22 +0000 (19:19 +0200)
There are no more users of VIR_ALLOC or VIR_ALLOC_N.
Delete their test cases.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
tests/viralloctest.c

index 785728d6f96410f9e05ea4d88b66b90cd800b8a3..8ea98b8eca519c06301c374ff27351da4db0ecc3 100644 (file)
@@ -43,73 +43,6 @@ testCheckNonNull(void *t)
     return 0;
 }
 
-static int
-testAllocScalar(const void *opaque G_GNUC_UNUSED)
-{
-    testDummyStruct *t;
-    int ret = -1;
-
-    if (VIR_ALLOC(t) < 0)
-        return -1;
-
-    if (testCheckNonNull(t) < 0)
-        goto cleanup;
-
-    if (t->a != 0 ||
-        t->b != 0) {
-        fprintf(stderr, "Allocated ram was not zerod\n");
-        goto cleanup;
-    }
-
-    VIR_FREE(t);
-
-    if (t != NULL) {
-        fprintf(stderr, "Pointer is still set after free\n");
-        goto cleanup;
-    }
-
-    ret = 0;
- cleanup:
-    VIR_FREE(t);
-    return ret;
-}
-
-
-static int
-testAllocArray(const void *opaque G_GNUC_UNUSED)
-{
-    testDummyStruct *t;
-    size_t nt = 10, i;
-    int ret = -1;
-
-    if (VIR_ALLOC_N(t, nt) < 0)
-        return -1;
-
-    if (testCheckNonNull(t) < 0)
-        goto cleanup;
-
-    for (i = 0; i < nt; i++) {
-        if (t[i].a != 0 ||
-            t[i].b != 0) {
-            fprintf(stderr, "Allocated ram block %zu was not zerod\n", i);
-            goto cleanup;
-        }
-    }
-
-    VIR_FREE(t);
-
-    if (t != NULL) {
-        fprintf(stderr, "Pointer is still set after free\n");
-        goto cleanup;
-    }
-
-    ret = 0;
- cleanup:
-    VIR_FREE(t);
-    return ret;
-}
-
-
 static int
 testReallocArray(const void *opaque G_GNUC_UNUSED)
 {
@@ -330,7 +263,7 @@ testInsertArray(const void *opaque G_GNUC_UNUSED)
     int ret = -1;
     testDummyStruct *n = (void *)0xff;
 
-    t = g_new0(testDummyStruct, nt);
+    t = g_new0(testDummyStruct *, nt);
 
     if (testCheckNonNull(t) < 0)
         goto cleanup;
@@ -416,10 +349,6 @@ mymain(void)
 {
     int ret = 0;
 
-    if (virTestRun("alloc scalar", testAllocScalar, NULL) < 0)
-        ret = -1;
-    if (virTestRun("alloc array", testAllocArray, NULL) < 0)
-        ret = -1;
     if (virTestRun("realloc array", testReallocArray, NULL) < 0)
         ret = -1;
     if (virTestRun("expand array", testExpandArray, NULL) < 0)