From nobody Mon Feb 9 12:29:15 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1711194761812756.0537128930191; Sat, 23 Mar 2024 04:52:41 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B4CC51D12; Sat, 23 Mar 2024 07:52:40 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 5D6291BCD; Sat, 23 Mar 2024 07:35:46 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 94A091BC1; Sat, 23 Mar 2024 07:35:40 -0400 (EDT) Received: from mx1.osci.io (polly.osci.io [8.43.85.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 1DEC31BF5 for ; Sat, 23 Mar 2024 07:32:53 -0400 (EDT) Received: by mx1.osci.io (Postfix, from userid 994) id 6F605223D7; Fri, 22 Mar 2024 13:56:39 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by mx1.osci.io (Postfix) with ESMTPS id B135F223D4 for ; Fri, 22 Mar 2024 13:56:38 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-613-fJ_Evnx4MbGdWImkjhMHwA-1; Fri, 22 Mar 2024 13:56:36 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D355A29AB426 for ; Fri, 22 Mar 2024 17:56:35 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AAF8492BDB for ; Fri, 22 Mar 2024 17:56:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: fJ_Evnx4MbGdWImkjhMHwA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 17/35] virshtest: Adapt 'snapshot-create-as' arg handling tests from 'virsh-optparse' Date: Fri, 22 Mar 2024 18:55:55 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: R4YYR4DBZRIWIKJEJYVUO55IE7AXPH2S X-Message-ID-Hash: R4YYR4DBZRIWIKJEJYVUO55IE7AXPH2S X-MailFrom: SRS0=Xa5W=K4=redhat.com=pkrempa@osci.io X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1711194762887100001 Move the argument parsing tests excercising 'virsh snapshot-create-as' from 'virsh-optparse' to 'virshtest'. Signed-off-by: Peter Krempa --- tests/virsh-optparse | 60 -------------- tests/virshtest.c | 1 + tests/virshtestdata/snapshot-create-args.in | 9 +++ tests/virshtestdata/snapshot-create-args.out | 82 ++++++++++++++++++++ 4 files changed, 92 insertions(+), 60 deletions(-) create mode 100644 tests/virshtestdata/snapshot-create-args.in create mode 100644 tests/virshtestdata/snapshot-create-args.out diff --git a/tests/virsh-optparse b/tests/virsh-optparse index 77e754d73a..10fdf7727e 100755 --- a/tests/virsh-optparse +++ b/tests/virsh-optparse @@ -32,66 +32,6 @@ fail=3D0 test_url=3Dtest:///default -# Another complex parsing example -cat <<\EOF > exp-out || framework_failure - - 1<2 - - - - - - - - - -EOF -$VIRSH -q -c $test_url snapshot-create-as --print-xml test \ - --diskspec 'vda,file=3Da&b,,c,snapshot=3Dexternal' --description '1<2' \ - --diskspec vdb --memspec file=3Dd,,e >out 2>>err || fail=3D1 -compare exp-out out || fail=3D1 - -cat <<\EOF > exp-out || framework_failure - - name - vda - - - - - -EOF -$VIRSH -q -c $test_url snapshot-create-as --print-xml test name vda vdb \ - >out 2>>err || fail=3D1 -compare exp-out out || fail=3D1 - -cat <<\EOF > exp-out || framework_failure - - name - desc - - - - - - -EOF -for args in \ - 'test name desc vda vdb' \ - 'test name desc --diskspec vda vdb' \ - 'test name desc --diskspec vda --diskspec vdb' \ - 'test name desc vda vdb' \ - 'test --diskspec vda name --diskspec vdb desc' \ - '--description desc --name name --domain test vda vdb' \ - '--description desc --diskspec vda --name name --domain test vdb' \ -; do - $VIRSH -q -c $test_url snapshot-create-as --print-xml $args \ - >out 2>>err || fail=3D1 - compare exp-out out || fail=3D1 -done - -test -s err && fail=3D1 - # Test a required argv cat <<\EOF > exp-err || framework_failure error: this function is not supported by the connection driver: virDomainQ= emuMonitorCommand diff --git a/tests/virshtest.c b/tests/virshtest.c index 1baa402648..453b1d7a9e 100644 --- a/tests/virshtest.c +++ b/tests/virshtest.c @@ -200,6 +200,7 @@ mymain(void) /* comprehensive coverage of argument assignment */ DO_TEST_SCRIPT("argument-assignment", NULL, VIRSH_DEFAULT, "-k0", "-d0= "); + DO_TEST_SCRIPT("snapshot-create-args", NULL, VIRSH_DEFAULT, "-q"); VIR_FREE(custom_uri); return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; diff --git a/tests/virshtestdata/snapshot-create-args.in b/tests/virshtestd= ata/snapshot-create-args.in new file mode 100644 index 0000000000..195b7d62f2 --- /dev/null +++ b/tests/virshtestdata/snapshot-create-args.in @@ -0,0 +1,9 @@ +snapshot-create-as --print-xml test name desc vda vdb +snapshot-create-as --print-xml test name desc --diskspec vda vdb +snapshot-create-as --print-xml test name desc --diskspec vda --diskspec vdb +snapshot-create-as --print-xml test name desc vda vdb +snapshot-create-as --print-xml test --diskspec vda name --diskspec vdb desc +snapshot-create-as --print-xml --description desc --name name --domain tes= t vda vdb +snapshot-create-as --print-xml --description desc --diskspec vda --name na= me --domain test vdb +snapshot-create-as --print-xml test name vda vdb +snapshot-create-as --print-xml test --diskspec vda,file=3Da&b,,c,snapshot= =3Dexternal --description 1<2 --diskspec vdb --memspec file=3Dd,,e diff --git a/tests/virshtestdata/snapshot-create-args.out b/tests/virshtest= data/snapshot-create-args.out new file mode 100644 index 0000000000..1a87b97dab --- /dev/null +++ b/tests/virshtestdata/snapshot-create-args.out @@ -0,0 +1,82 @@ + + name + desc + + + + + + + + name + desc + + + + + + + + name + desc + + + + + + + + name + desc + + + + + + + + name + desc + + + + + + + + name + desc + + + + + + + + name + desc + + + + + + + + name + vda + + + + + + + 1<2 + + + + + + + + + --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org