From nobody Sun Feb 8 11:40:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573578125; cv=none; d=zoho.com; s=zohoarc; b=aTosi1P7CPkEMyBAenAcz1jyn554MIxl9YvV/mfEt1UtRcK3H2dm55RyMhJDJkbSENBBHS7JqYOJ83h8+rpUmbwySN0Uc4RHt8l9eKnSQOtZt+3wVJNRXscKVzCfEGWtD2H8kJ2S12pJ8MggoGSHEssyrrVdApsOCxIH5yYELLA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573578125; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eJOGkjVlOEAkgVsAX/7HiVKsyMU8nNEap7YcHfb5Nuo=; b=YJ80kNfLFkTX1HSBMbRWNxudR+tIqGe93xeEOkHF63E6ATfYjkuBER97JtbPoIbNquwLkFjPmsUvsm610B/oW1ZrWi+/sF83FsUP2/x/YVcfCXK2vBuG+PqL62NwL1rLoS7i0mUgPwD/tlseicIXpGYfGFThnnqhRZP4Co8CQQI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1573578125240826.1163546536508; Tue, 12 Nov 2019 09:02:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-34-NGOOwoEaNFqu-q_eaI7j1w-1; Tue, 12 Nov 2019 12:02:00 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4C7B6B0242; Tue, 12 Nov 2019 17:01:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0E7FEBA4E; Tue, 12 Nov 2019 17:01:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A1AB44E57F; Tue, 12 Nov 2019 17:01:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xACH1WXB012323 for ; Tue, 12 Nov 2019 12:01:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id C28E7600D5; Tue, 12 Nov 2019 17:01:32 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49D3060173 for ; Tue, 12 Nov 2019 17:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573578124; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=eJOGkjVlOEAkgVsAX/7HiVKsyMU8nNEap7YcHfb5Nuo=; b=OO8uHEk0JLL6iZJwLC4L73+q0HXwo527Hm126cOseJoZoHljGVJa38d5A8yEaQaGGbndq6 LHqu3yhPMlFT0IosskBfdI9+pALPKsxjhkOU6UfFMpIjOiMtNjlcqnPTVhsaax13O4Ujyb 50q8EF2Fv/u8wuNzOvhg9rgzQsBBAKk= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 12 Nov 2019 18:02:15 +0100 Message-Id: <23651b7a24a6fd90997a2faf97e0bbae08f946d7.1573578043.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 7/9] tests: delete tests for VIR_STR(N)DUP X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: NGOOwoEaNFqu-q_eaI7j1w-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza --- tests/virstringtest.c | 136 ------------------------------------------ 1 file changed, 136 deletions(-) diff --git a/tests/virstringtest.c b/tests/virstringtest.c index 1e408f2757..992b25df92 100644 --- a/tests/virstringtest.c +++ b/tests/virstringtest.c @@ -236,136 +236,6 @@ static int testRemove(const void *args) } =20 =20 -static bool fail; - -static const char * -testStrdupLookup1(size_t i) -{ - switch (i) { - case 0: - return "hello"; - case 1: - return NULL; - default: - fail =3D true; - return "oops"; - } -} - -static size_t -testStrdupLookup2(size_t i) -{ - if (i) - fail =3D true; - return 5; -} - -static int -testStrdup(const void *data G_GNUC_UNUSED) -{ - char *array[] =3D { NULL, NULL }; - size_t i =3D 0; - size_t j =3D 0; - size_t k =3D 0; - int ret =3D -1; - int value; - - value =3D VIR_STRDUP(array[i++], testStrdupLookup1(j++)); - if (value !=3D 1) { - virFilePrintf(stderr, "unexpected strdup result %d, expected 1\n",= value); - goto cleanup; - } - /* coverity[dead_error_begin] */ - if (i !=3D 1) { - virFilePrintf(stderr, "unexpected side effects i=3D%zu, expected 1= \n", i); - goto cleanup; - } - /* coverity[dead_error_begin] */ - if (j !=3D 1) { - virFilePrintf(stderr, "unexpected side effects j=3D%zu, expected 1= \n", j); - goto cleanup; - } - if (STRNEQ_NULLABLE(array[0], "hello") || array[1]) { - virFilePrintf(stderr, "incorrect array contents '%s' '%s'\n", - NULLSTR(array[0]), NULLSTR(array[1])); - goto cleanup; - } - - value =3D VIR_STRNDUP(array[i++], testStrdupLookup1(j++), - testStrdupLookup2(k++)); - if (value !=3D 0) { - virFilePrintf(stderr, "unexpected strdup result %d, expected 0\n",= value); - goto cleanup; - } - /* coverity[dead_error_begin] */ - if (i !=3D 2) { - virFilePrintf(stderr, "unexpected side effects i=3D%zu, expected 2= \n", i); - goto cleanup; - } - /* coverity[dead_error_begin] */ - if (j !=3D 2) { - virFilePrintf(stderr, "unexpected side effects j=3D%zu, expected 2= \n", j); - goto cleanup; - } - /* coverity[dead_error_begin] */ - if (k !=3D 1) { - virFilePrintf(stderr, "unexpected side effects k=3D%zu, expected 1= \n", k); - goto cleanup; - } - if (STRNEQ_NULLABLE(array[0], "hello") || array[1]) { - virFilePrintf(stderr, "incorrect array contents '%s' '%s'\n", - NULLSTR(array[0]), NULLSTR(array[1])); - goto cleanup; - } - - if (fail) { - virFilePrintf(stderr, "side effects failed\n"); - goto cleanup; - } - - ret =3D 0; - cleanup: - for (i =3D 0; i < G_N_ELEMENTS(array); i++) - VIR_FREE(array[i]); - return ret; -} - -static int -testStrndupNegative(const void *opaque G_GNUC_UNUSED) -{ - int ret =3D -1; - char *dst; - const char *src =3D "Hello world"; - int value; - - if ((value =3D VIR_STRNDUP(dst, src, 5)) !=3D 1) { - fprintf(stderr, "unexpected virStrndup result %d, expected 1\n", v= alue); - goto cleanup; - } - - if (STRNEQ_NULLABLE(dst, "Hello")) { - fprintf(stderr, "unexpected content '%s'", dst); - goto cleanup; - } - - VIR_FREE(dst); - if ((value =3D VIR_STRNDUP(dst, src, -1)) !=3D 1) { - fprintf(stderr, "unexpected virStrndup result %d, expected 1\n", v= alue); - goto cleanup; - } - - if (STRNEQ_NULLABLE(dst, src)) { - fprintf(stderr, "unexpected content '%s'", dst); - goto cleanup; - } - - ret =3D 0; - cleanup: - VIR_FREE(dst); - return ret; -} - - static int testStringSortCompare(const void *opaque G_GNUC_UNUSED) { @@ -853,12 +723,6 @@ mymain(void) const char *tokens8[] =3D { "gluster", "rdma", NULL }; TEST_SPLIT("gluster+rdma", "+", 2, tokens8); =20 - if (virTestRun("strdup", testStrdup, NULL) < 0) - ret =3D -1; - - if (virTestRun("strdup", testStrndupNegative, NULL) < 0) - ret =3D -1; - if (virTestRun("virStringSortCompare", testStringSortCompare, NULL) < = 0) ret =3D -1; =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list