From nobody Sun Feb 8 15:07:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1596473902; cv=none; d=zohomail.com; s=zohoarc; b=dcXR3ryFSRmMck57zIuHulwYqbqofDa6hVjec96Q9cVMASowg0YsznyFMd6QJ7+UoVCZXP1dPjRhiNHaTcPBl8++bwgQ84HLbpnJBaRhdkPTFiQo01yqqQ/DEl2+BdVdpdzU3EvFtkcovtNYEWk8qH5ulDObIoyFaz3U1PqB5Ns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596473902; 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=6TDS00FccgTQZAfizWKYt78aF4srwoAX/QAJKaMvZHo=; b=CQ23lgCzoZbynNkBpdfvXuXIWjw99qhe/7l6qDBRoUWneiCSR63t68sM0KpN2CF0N9O3gqCwGfNyNORRCqgE2MG2FawnpfRuoBpam5/IITqN7nlUxb8MQU8pctq83/wKazHe/kYhwktvoHdTYq7In08o6jCSFyQN1a1owYpDoMo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1596473902277423.8111667450115; Mon, 3 Aug 2020 09:58:22 -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-367-L5tg26Y-M_CHPzVwMsmjBQ-1; Mon, 03 Aug 2020 12:57:37 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 67981101C8AE; Mon, 3 Aug 2020 16:57:29 +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 443AD277C0; Mon, 3 Aug 2020 16:57:29 +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 162A39A11B; Mon, 3 Aug 2020 16:57:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 073GvRs9007817 for ; Mon, 3 Aug 2020 12:57:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3649971770; Mon, 3 Aug 2020 16:57:27 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8579D71775 for ; Mon, 3 Aug 2020 16:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596473901; 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=6TDS00FccgTQZAfizWKYt78aF4srwoAX/QAJKaMvZHo=; b=Vlk7yT87O6+uDEK/esVpWXA/rmwzUR13R40U/Lz9PiVF209Eb1ltVohMj33EKzvlOtvzWU Qef3Wt0SbSHNBACmvs4GAcLDfAeG7WRL87mZ6YLDP5PLIw3a3WdV554CuzYHIvVkAwQxow 6S986HisnolAfSSNE4gOHn+9On2nDVA= X-MC-Unique: L5tg26Y-M_CHPzVwMsmjBQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 14/19] tests: iscsitest: split out testISCSIScanTargetsTests Date: Mon, 3 Aug 2020 18:56:51 +0200 Message-Id: <763c14794b340366da048373a622468cb5edf381.1596473604.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.84 on 10.5.11.23 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) The ScanTargets testing code declares some variables in the middle of main. Split it out into a separate function. Signed-off-by: J=C3=A1n Tomko --- tests/viriscsitest.c | 47 ++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/tests/viriscsitest.c b/tests/viriscsitest.c index 76f0aa2946..e86d3970b6 100644 --- a/tests/viriscsitest.c +++ b/tests/viriscsitest.c @@ -311,26 +311,8 @@ testISCSIConnectionLogin(const void *data) =20 =20 static int -mymain(void) +testISCSIScanTargetsTests(void) { - int rv =3D 0; - -# define DO_SESSION_TEST(name, session) \ - do { \ - struct testSessionInfo info =3D {name, false, session}; \ - if (virTestRun("ISCSI get session test" name, \ - testISCSIGetSession, &info) < 0) \ - rv =3D -1; \ - info.output_version =3D true; \ - if (virTestRun("ISCSI get (non-flash) session test" name, \ - testISCSIGetSession, &info) < 0) \ - rv =3D -1; \ - } while (0) - - DO_SESSION_TEST("iqn.2004-06.example:example1:iscsi.test", "1"); - DO_SESSION_TEST("iqn.2009-04.example:example1:iscsi.seven", "7"); - DO_SESSION_TEST("iqn.2009-04.example:example1:iscsi.eight", NULL); - const char *targets[] =3D { "iqn.2004-06.example:example1:iscsi.test", "iqn.2005-05.example:example1:iscsi.hello", @@ -346,6 +328,33 @@ mymain(void) .nexpected =3D G_N_ELEMENTS(targets), }; if (virTestRun("ISCSI scan targets", testISCSIScanTargets, &infoTarget= s) < 0) + return -1; + return 0; +} + + +static int +mymain(void) +{ + int rv =3D 0; + +# define DO_SESSION_TEST(name, session) \ + do { \ + struct testSessionInfo info =3D {name, false, session}; \ + if (virTestRun("ISCSI get session test" name, \ + testISCSIGetSession, &info) < 0) \ + rv =3D -1; \ + info.output_version =3D true; \ + if (virTestRun("ISCSI get (non-flash) session test" name, \ + testISCSIGetSession, &info) < 0) \ + rv =3D -1; \ + } while (0) + + DO_SESSION_TEST("iqn.2004-06.example:example1:iscsi.test", "1"); + DO_SESSION_TEST("iqn.2009-04.example:example1:iscsi.seven", "7"); + DO_SESSION_TEST("iqn.2009-04.example:example1:iscsi.eight", NULL); + + if (testISCSIScanTargetsTests() < 0) rv =3D -1; =20 # define DO_LOGIN_TEST(portal, iqn, target) \ --=20 2.26.2