From nobody Thu May 2 02:57:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1600868585; cv=none; d=zohomail.com; s=zohoarc; b=R5cPtxX0VxcuYEGGkOmNSns32bdAjJZBRblGy3KRX6oY5NvDbknhoEM9Ek/sBPttnCG0skE1Kg+yS1J+Pj9AkJEESJUFO0sxMmigQ3+oDX0Vpe/LSXf1Qr9ZFQ/cQ1twd4PpGVv81fs1Bc3kzxfcn9y7S5LGMOeMpzIJleHdRpo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600868585; 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=cSMteSnD2bpDDwoTmCtHSsXnz4eQLC0TM/7nt6tJ7y8=; b=O1rDdRGNltEsKgD7rWA8bniMZxPPooki1Kfgfd0/VmRwCCMLqjLjdkGBUoQ44/wPL/ww5t+TlO2En4knK4l+dqdmPIDY391JaBVVSZYFCAep1u5MqYIUsALsQJ82w5vrbBGQXI9YEMAFqDD38hfEevo8SFcFfD1/eZwLoU+oeE4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1600868585710948.4112621416439; Wed, 23 Sep 2020 06:43:05 -0700 (PDT) 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-490-dO7qNQHiMxupmL8ac0ey0Q-1; Wed, 23 Sep 2020 09:43:01 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 752578ECE7C; Wed, 23 Sep 2020 13:42:55 +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 2B87673682; Wed, 23 Sep 2020 13:42:55 +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 1F1F48C7AC; Wed, 23 Sep 2020 13:42:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08NDe3Od014756 for ; Wed, 23 Sep 2020 09:40:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 116367368B; Wed, 23 Sep 2020 13:40:03 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D27D73682 for ; Wed, 23 Sep 2020 13:40:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600868584; 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=cSMteSnD2bpDDwoTmCtHSsXnz4eQLC0TM/7nt6tJ7y8=; b=SmYhnjDqlh6gLI771k2Kbf8nuEHqF6rFkOrmAfz9RTCU+peqkw/Pq8q3gJtqa4TSJcb4nw vJm+rTnaCrSOTeJ/VDSr7U3+T+EyO8gIKple/c1OXE+l6YpavE8H+pZlHC6IC1DUC+d8WM nGYVik9PDJ7vAmYQBvUSlVZxJ5+Fwj8= X-MC-Unique: dO7qNQHiMxupmL8ac0ey0Q-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv2 1/2] tests: build SELinux tests Date: Wed, 23 Sep 2020 15:39:49 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) We set WITH_LIBATTR in meson.build, not WITH_ATTR. Signed-off-by: J=C3=A1n Tomko Fixes: 3ace72965c3b11fc763f781ae7ce3ca29dd36507 --- tests/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/meson.build b/tests/meson.build index 31e8d66c7a..eaf6628fb9 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -477,7 +477,7 @@ if conf.has('WITH_REMOTE') endif =20 if conf.has('WITH_SECDRIVER_SELINUX') - if conf.has('WITH_ATTR') + if conf.has('WITH_LIBATTR') tests +=3D [ { 'name': 'securityselinuxtest' }, { 'name': 'viridentitytest' }, --=20 2.26.2 From nobody Thu May 2 02:57:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1600868589; cv=none; d=zohomail.com; s=zohoarc; b=fRjCbLiSS30kod5M0AmTYgk0bN4UWqdiTP8bfCZOBBYvd+W0L3ZHYs0OSPTu60d28gIKmsYPw8u+//IrjBntUw9BLK5FefrUN7ad8BS8zWAzUSb+bBInbo5Dfg/fIQqzWSXCWp3s6UFy9FcCRBaQWHY+46LcIwV46bp50f6/2qs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600868589; 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=uw78NWJBB/nGMB2irbRx/AfYxP6TQr8D768ThJfzxFM=; b=EXDttPpldYA4YHX6RjuYsl/XeJZwExZkgkvm8tF7l+EQQnag4z5VBLcXq3lI+JE2YZTtycIlyVzf5eHOMKfLa+80xg/OGOnCkH/Ctu35BWie+TxCN+2dpNoJc9d1gef/iaTrGlaF/jJqSFKVPaO3l8lv5Rdb9gOk1AVR9Sjt/JE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1600868589505677.226440690181; Wed, 23 Sep 2020 06:43:09 -0700 (PDT) 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-82-usmmKp9VPxuXIcy2VOcQuw-1; Wed, 23 Sep 2020 09:43:05 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C483A188C129; Wed, 23 Sep 2020 13:43:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A39827882B; Wed, 23 Sep 2020 13:43:00 +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 70B05183D040; Wed, 23 Sep 2020 13:43:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08NDe4MT014764 for ; Wed, 23 Sep 2020 09:40:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0ADA77368B; Wed, 23 Sep 2020 13:40:04 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F6E373682 for ; Wed, 23 Sep 2020 13:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600868588; 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=uw78NWJBB/nGMB2irbRx/AfYxP6TQr8D768ThJfzxFM=; b=B/29BhMdDbkoq3lgKvuuoLiG0ydz1yBgF0KV4GhK2Qf1FpLUv8LAu8ac2VLzcdbt7+hj/l bmVCHPKR9eeO9Qa4JAHeDckbfbbbwY1F2HaVERJXSTD5LxpxkwhtYN6TuZiBpzpDxND9x2 FCMqBo2cOfHrShqNmPNHkiayNq4yrAI= X-MC-Unique: usmmKp9VPxuXIcy2VOcQuw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv2 2/2] tests: use g_new0 instead of VIR_ALLOC_N Date: Wed, 23 Sep 2020 15:39:50 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- tests/commandtest.c | 7 +++---- tests/domaincapstest.c | 3 +-- tests/fdstreamtest.c | 10 ++++------ tests/qemuxml2argvtest.c | 3 +-- tests/securityselinuxlabeltest.c | 3 +-- tests/securityselinuxtest.c | 3 +-- tests/testutils.c | 8 ++------ tests/testutilsqemu.c | 6 ++---- tests/vircgrouptest.c | 3 +-- tests/vircryptotest.c | 5 ++--- tests/virhostcputest.c | 3 +-- tests/virnetmessagetest.c | 6 ++---- tests/virnetsockettest.c | 6 +----- tests/virnettlshelpers.c | 3 +-- tests/virstringtest.c | 3 +-- tests/xlconfigtest.c | 3 +-- tests/xmconfigtest.c | 3 +-- 17 files changed, 26 insertions(+), 52 deletions(-) diff --git a/tests/commandtest.c b/tests/commandtest.c index cbbcda4e5f..df86725f0e 100644 --- a/tests/commandtest.c +++ b/tests/commandtest.c @@ -1057,10 +1057,9 @@ static int test27(const void *unused G_GNUC_UNUSED) "%s%s%s" \ "END STDERR\n" =20 - if (VIR_ALLOC_N(buffer0, buflen) < 0 || - VIR_ALLOC_N(buffer1, buflen) < 0 || - VIR_ALLOC_N(buffer2, buflen) < 0) - goto cleanup; + buffer0 =3D g_new0(char, buflen); + buffer1 =3D g_new0(char, buflen); + buffer2 =3D g_new0(char, buflen); =20 memset(buffer0, 'H', buflen - 2); buffer0[buflen - 2] =3D '\n'; diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index f817ed5452..7a082705c6 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -147,8 +147,7 @@ fillXenCaps(virDomainCapsPtr domCaps) virFirmwarePtr *firmwares; int ret =3D -1; =20 - if (VIR_ALLOC_N(firmwares, 2) < 0) - return ret; + firmwares =3D g_new0(virFirmwarePtr, 2); =20 firmwares[0] =3D g_new0(virFirmware, 1); firmwares[1] =3D g_new0(virFirmware, 1); diff --git a/tests/fdstreamtest.c b/tests/fdstreamtest.c index 83973137e7..7a2fe27477 100644 --- a/tests/fdstreamtest.c +++ b/tests/fdstreamtest.c @@ -54,9 +54,8 @@ static int testFDStreamReadCommon(const char *scratchdir,= bool blocking) if (!(conn =3D virConnectOpen("test:///default"))) goto cleanup; =20 - if (VIR_ALLOC_N(pattern, PATTERN_LEN) < 0 || - VIR_ALLOC_N(buf, PATTERN_LEN) < 0) - goto cleanup; + pattern =3D g_new0(char, PATTERN_LEN); + buf =3D g_new0(char, PATTERN_LEN); =20 for (i =3D 0; i < PATTERN_LEN; i++) pattern[i] =3D i; @@ -185,9 +184,8 @@ static int testFDStreamWriteCommon(const char *scratchd= ir, bool blocking) if (!(conn =3D virConnectOpen("test:///default"))) goto cleanup; =20 - if (VIR_ALLOC_N(pattern, PATTERN_LEN) < 0 || - VIR_ALLOC_N(buf, PATTERN_LEN) < 0) - goto cleanup; + pattern =3D g_new0(char, PATTERN_LEN); + buf =3D g_new0(char, PATTERN_LEN); =20 for (i =3D 0; i < PATTERN_LEN; i++) pattern[i] =3D i; diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index e93948e3fc..463e4c003d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -753,8 +753,7 @@ mymain(void) driver.config->nbdTLSx509certdir =3D g_strdup("/etc/pki/libvirt-nbd/du= mmy,path"); =20 VIR_FREE(driver.config->hugetlbfs); - if (VIR_ALLOC_N(driver.config->hugetlbfs, 2) < 0) - return EXIT_FAILURE; + driver.config->hugetlbfs =3D g_new0(virHugeTLBFS, 2); driver.config->nhugetlbfs =3D 2; driver.config->hugetlbfs[0].mnt_dir =3D g_strdup("/dev/hugepages2M"); driver.config->hugetlbfs[1].mnt_dir =3D g_strdup("/dev/hugepages1G"); diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabelt= est.c index 2989a668b7..168acc2bdf 100644 --- a/tests/securityselinuxlabeltest.c +++ b/tests/securityselinuxlabeltest.c @@ -114,8 +114,7 @@ testSELinuxLoadFileList(const char *testname, if (!(fp =3D fopen(path, "r"))) goto cleanup; =20 - if (VIR_ALLOC_N(line, 1024) < 0) - goto cleanup; + line =3D g_new0(char, 1024); =20 while (!feof(fp)) { char *file =3D NULL, *context =3D NULL, *tmp; diff --git a/tests/securityselinuxtest.c b/tests/securityselinuxtest.c index 297cc0e53d..a75ff495eb 100644 --- a/tests/securityselinuxtest.c +++ b/tests/securityselinuxtest.c @@ -71,8 +71,7 @@ testBuildDomainDef(bool dynamic, goto error; =20 def->virtType =3D VIR_DOMAIN_VIRT_KVM; - if (VIR_ALLOC_N(def->seclabels, 1) < 0) - goto error; + def->seclabels =3D g_new0(virSecurityLabelDefPtr, 1); =20 secdef =3D g_new0(virSecurityLabelDef, 1); =20 diff --git a/tests/testutils.c b/tests/testutils.c index 3f53f635fc..b747f65eea 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -211,10 +211,7 @@ virTestLoadFile(const char *file, char **buf) =20 tmplen =3D buflen =3D st.st_size + 1; =20 - if (VIR_ALLOC_N(*buf, buflen) < 0) { - VIR_FORCE_FCLOSE(fp); - return -1; - } + *buf =3D g_new0(char, buflen); =20 tmp =3D *buf; (*buf)[0] =3D '\0'; @@ -977,8 +974,7 @@ virTestCapsBuildNUMATopology(int seq) =20 id =3D 0; for (cell_id =3D 0; cell_id < MAX_CELLS; cell_id++) { - if (VIR_ALLOC_N(cell_cpus, MAX_CPUS_IN_CELL) < 0) - goto error; + cell_cpus =3D g_new0(virCapsHostNUMACellCPU, MAX_CPUS_IN_CELL); =20 for (core_id =3D 0; core_id < MAX_CPUS_IN_CELL; core_id++) { cell_cpus[core_id].id =3D id + core_id; diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 51ac59bade..eb37bbfdad 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -204,8 +204,7 @@ virCapsPtr testQemuCapsInit(void) =20 /* Add dummy 'none' security_driver. This is equal to setting * security_driver =3D "none" in qemu.conf. */ - if (VIR_ALLOC_N(caps->host.secModels, 1) < 0) - goto cleanup; + caps->host.secModels =3D g_new0(virCapsHostSecModel, 1); caps->host.nsecModels =3D 1; =20 caps->host.secModels[0].model =3D g_strdup("none"); @@ -459,8 +458,7 @@ testQemuCapsSetGIC(virQEMUCapsPtr qemuCaps, virGICCapability *gicCapabilities =3D NULL; size_t ngicCapabilities =3D 0; =20 - if (VIR_ALLOC_N(gicCapabilities, 2) < 0) - return -1; + gicCapabilities =3D g_new0(virGICCapability, 2); =20 # define IMPL_BOTH \ VIR_GIC_IMPLEMENTATION_KERNEL|VIR_GIC_IMPLEMENTATION_EMULATED diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c index 44e72cbfa9..e5be556104 100644 --- a/tests/vircgrouptest.c +++ b/tests/vircgrouptest.c @@ -708,8 +708,7 @@ static int testCgroupGetPercpuStats(const void *args G_= GNUC_UNUSED) 635751356ULL, 0, 0, 0, 0, 0, 0, 0, }; =20 - if (VIR_ALLOC_N(params, EXPECTED_NCPUS) < 0) - goto cleanup; + params =3D g_new0(virTypedParameter, EXPECTED_NCPUS); =20 if ((rv =3D virCgroupNewPartition("/virtualmachines", true, (1 << VIR_CGROUP_CONTROLLER_CPU) | diff --git a/tests/vircryptotest.c b/tests/vircryptotest.c index 42ef0b8900..90140077cf 100644 --- a/tests/vircryptotest.c +++ b/tests/vircryptotest.c @@ -83,9 +83,8 @@ testCryptoEncrypt(const void *opaque) return EXIT_AM_SKIP; } =20 - if (VIR_ALLOC_N(enckey, enckeylen) < 0 || - VIR_ALLOC_N(iv, ivlen) < 0) - goto cleanup; + enckey =3D g_new0(uint8_t, enckeylen); + iv =3D g_new0(uint8_t, ivlen); =20 if (virRandomBytes(enckey, enckeylen) < 0 || virRandomBytes(iv, ivlen) < 0) { diff --git a/tests/virhostcputest.c b/tests/virhostcputest.c index 7b83c7ae5d..786a363e48 100644 --- a/tests/virhostcputest.c +++ b/tests/virhostcputest.c @@ -124,8 +124,7 @@ linuxCPUStatsCompareFiles(const char *cpustatfile, if (virHostCPUGetStatsLinux(NULL, 0, NULL, &nparams) < 0) goto fail; =20 - if (VIR_ALLOC_N(params, nparams) < 0) - goto fail; + params =3D g_new0(virNodeCPUStats, nparams); =20 if (virHostCPUGetStatsLinux(cpustat, VIR_NODE_CPU_STATS_ALL_CPUS, para= ms, &nparams) < 0) diff --git a/tests/virnetmessagetest.c b/tests/virnetmessagetest.c index 76cc3d182f..9f6115f226 100644 --- a/tests/virnetmessagetest.c +++ b/tests/virnetmessagetest.c @@ -102,8 +102,7 @@ static int testMessageHeaderDecode(const void *args G_G= NUC_UNUSED) return -1; =20 msg->bufferLength =3D 4; - if (VIR_ALLOC_N(msg->buffer, msg->bufferLength) < 0) - goto cleanup; + msg->buffer =3D g_new0(char, msg->bufferLength); memcpy(msg->buffer, input_buf, msg->bufferLength); =20 msg->header.prog =3D 0x11223344; @@ -332,8 +331,7 @@ static int testMessagePayloadDecode(const void *args G_= GNUC_UNUSED) return -1; =20 msg->bufferLength =3D 4; - if (VIR_ALLOC_N(msg->buffer, msg->bufferLength) < 0) - goto cleanup; + msg->buffer =3D g_new0(char, msg->bufferLength); memcpy(msg->buffer, input_buffer, msg->bufferLength); =20 if (virNetMessageDecodeLength(msg) < 0) { diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c index d6b461cbc8..5216b98424 100644 --- a/tests/virnetsockettest.c +++ b/tests/virnetsockettest.c @@ -206,11 +206,7 @@ testSocketAccept(const void *opaque) if (virNetSocketNewListenUNIX(path, 0700, -1, getegid(), &usock) <= 0) goto cleanup; =20 - if (VIR_ALLOC_N(lsock, 1) < 0) { - virObjectUnref(usock); - goto cleanup; - } - + lsock =3D g_new0(virNetSocketPtr, 1); lsock[0] =3D usock; nlsock =3D 1; =20 diff --git a/tests/virnettlshelpers.c b/tests/virnettlshelpers.c index e0a4771894..ce38571b0a 100644 --- a/tests/virnettlshelpers.c +++ b/tests/virnettlshelpers.c @@ -117,8 +117,7 @@ static void testTLSDerEncode(ASN1_TYPE src, size =3D 0; asn1_der_coding(src, src_name, NULL, &size, NULL); =20 - if (VIR_ALLOC_N(data, size) < 0) - abort(); + data =3D g_new0(char, size); =20 asn1_der_coding(src, src_name, data, &size, NULL); =20 diff --git a/tests/virstringtest.c b/tests/virstringtest.c index b2ef57c338..7305190691 100644 --- a/tests/virstringtest.c +++ b/tests/virstringtest.c @@ -555,8 +555,7 @@ testVirStringListFreeCount(const void *opaque G_GNUC_UN= USED) { char **list; =20 - if (VIR_ALLOC_N(list, 4) < 0) - return -1; + list =3D g_new0(char *, 4); =20 list[0] =3D g_strdup("test1"); list[2] =3D g_strdup("test2"); diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c index 3ad66ccfa1..ab1a834f1b 100644 --- a/tests/xlconfigtest.c +++ b/tests/xlconfigtest.c @@ -73,8 +73,7 @@ testCompareParseXML(const char *xlcfg, const char *xml, b= ool replaceVars) virDomainDefPtr def =3D NULL; char *replacedXML =3D NULL; =20 - if (VIR_ALLOC_N(gotxlcfgData, wrote) < 0) - goto fail; + gotxlcfgData =3D g_new0(char, wrote); =20 conn =3D virGetConnect(); if (!conn) goto fail; diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c index 43949fe3b5..8d6b2378fd 100644 --- a/tests/xmconfigtest.c +++ b/tests/xmconfigtest.c @@ -46,8 +46,7 @@ testCompareParseXML(const char *xmcfg, const char *xml) int wrote =3D 4096; virDomainDefPtr def =3D NULL; =20 - if (VIR_ALLOC_N(gotxmcfgData, wrote) < 0) - goto fail; + gotxmcfgData =3D g_new0(char, wrote); =20 conn =3D virGetConnect(); if (!conn) goto fail; --=20 2.26.2