From nobody Mon Feb 9 15:48:40 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 1711632987547816.7154028988571; Thu, 28 Mar 2024 06:36:27 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 4FD901A6F; Thu, 28 Mar 2024 09:36:26 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 85D652211; Thu, 28 Mar 2024 09:23:15 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 35CCC2165; Thu, 28 Mar 2024 09:23:01 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 D78E41F6E for ; Thu, 28 Mar 2024 09:22:45 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-692-YeJyI05fNVWzl-zTiGKFaQ-1; Thu, 28 Mar 2024 09:22:44 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 1CCC9101A586 for ; Thu, 28 Mar 2024 13:22:44 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8823B2024517 for ; Thu, 28 Mar 2024 13:22:43 +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,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: YeJyI05fNVWzl-zTiGKFaQ-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 09/35] virshtest: Test against output files ("echo" tests) Date: Thu, 28 Mar 2024 14:22:31 +0100 Message-ID: <1126f5374a990a25e514906f7728b97ae3a5c017.1711129973.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: QZNRIKE2RLWDCPUPUQAAE26WHELBNNJU X-Message-ID-Hash: QZNRIKE2RLWDCPUPUQAAE26WHELBNNJU X-MailFrom: pkrempa@redhat.com 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: 1711632988213100001 Managing output files is much simpler especially with VIR_TEST_REGENERATE_OUTPUT compared to putting the expected string blobs into the C source file. For now the output is tested both against the hardcoded strings as well as the output files. Signed-off-by: Peter Krempa --- tests/virshtest.c | 2 +- tests/virshtestdata/dash-dash-argument-1.out | 1 + tests/virshtestdata/dash-dash-argument-2.out | 1 + tests/virshtestdata/dash-dash-argument-3.out | 1 + tests/virshtestdata/dash-dash-argument-4.out | 1 + tests/virshtestdata/dash-dash-argument-5.out | 1 + tests/virshtestdata/dash-dash-argument-6.out | 1 + tests/virshtestdata/echo-alias-argv.out | 1 + tests/virshtestdata/echo-escaping-1.out | 2 ++ tests/virshtestdata/echo-escaping-2.out | 2 ++ tests/virshtestdata/echo-escaping-3.out | 2 ++ tests/virshtestdata/echo-quote-removal-1.out | 1 + tests/virshtestdata/echo-quote-removal-2.out | 1 + tests/virshtestdata/echo-quote-removal-3.out | 1 + tests/virshtestdata/echo-quote-removal-4.out | 1 + tests/virshtestdata/echo-quote-removal-5.out | 1 + tests/virshtestdata/echo-quote-removal-6.out | 1 + tests/virshtestdata/echo-quote-removal-7.out | 2 ++ tests/virshtestdata/echo-quote-removal-8.out | 1 + tests/virshtestdata/multiple-commands-1.out | 2 ++ tests/virshtestdata/multiple-commands-10.out | 1 + tests/virshtestdata/multiple-commands-11.out | 1 + tests/virshtestdata/multiple-commands-12.out | 1 + tests/virshtestdata/multiple-commands-2.out | 2 ++ tests/virshtestdata/multiple-commands-3.out | 2 ++ tests/virshtestdata/multiple-commands-4.out | 2 ++ tests/virshtestdata/multiple-commands-5.out | 3 +++ tests/virshtestdata/multiple-commands-6.out | 1 + tests/virshtestdata/multiple-commands-7.out | 2 ++ tests/virshtestdata/multiple-commands-8.out | 2 ++ tests/virshtestdata/multiple-commands-9.out | 1 + 31 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 tests/virshtestdata/dash-dash-argument-1.out create mode 100644 tests/virshtestdata/dash-dash-argument-2.out create mode 100644 tests/virshtestdata/dash-dash-argument-3.out create mode 100644 tests/virshtestdata/dash-dash-argument-4.out create mode 100644 tests/virshtestdata/dash-dash-argument-5.out create mode 100644 tests/virshtestdata/dash-dash-argument-6.out create mode 100644 tests/virshtestdata/echo-alias-argv.out create mode 100644 tests/virshtestdata/echo-escaping-1.out create mode 100644 tests/virshtestdata/echo-escaping-2.out create mode 100644 tests/virshtestdata/echo-escaping-3.out create mode 100644 tests/virshtestdata/echo-quote-removal-1.out create mode 100644 tests/virshtestdata/echo-quote-removal-2.out create mode 100644 tests/virshtestdata/echo-quote-removal-3.out create mode 100644 tests/virshtestdata/echo-quote-removal-4.out create mode 100644 tests/virshtestdata/echo-quote-removal-5.out create mode 100644 tests/virshtestdata/echo-quote-removal-6.out create mode 100644 tests/virshtestdata/echo-quote-removal-7.out create mode 100644 tests/virshtestdata/echo-quote-removal-8.out create mode 100644 tests/virshtestdata/multiple-commands-1.out create mode 100644 tests/virshtestdata/multiple-commands-10.out create mode 100644 tests/virshtestdata/multiple-commands-11.out create mode 100644 tests/virshtestdata/multiple-commands-12.out create mode 100644 tests/virshtestdata/multiple-commands-2.out create mode 100644 tests/virshtestdata/multiple-commands-3.out create mode 100644 tests/virshtestdata/multiple-commands-4.out create mode 100644 tests/virshtestdata/multiple-commands-5.out create mode 100644 tests/virshtestdata/multiple-commands-6.out create mode 100644 tests/virshtestdata/multiple-commands-7.out create mode 100644 tests/virshtestdata/multiple-commands-8.out create mode 100644 tests/virshtestdata/multiple-commands-9.out diff --git a/tests/virshtest.c b/tests/virshtest.c index fc1246a96d..1750cc7abd 100644 --- a/tests/virshtest.c +++ b/tests/virshtest.c @@ -585,7 +585,7 @@ mymain(void) do { \ const char *testname =3D testname_; \ const char *myargv[] =3D { __VA_ARGS__, NULL }; \ - const struct testInfo info =3D { NULL, NULL, myargv, result }; \ + const struct testInfo info =3D { testname, NULL, myargv, result };= \ if (virTestRun(testname, testCompare, &info) < 0) \ ret =3D -1; \ } while (0) diff --git a/tests/virshtestdata/dash-dash-argument-1.out b/tests/virshtest= data/dash-dash-argument-1.out new file mode 100644 index 0000000000..7898192261 --- /dev/null +++ b/tests/virshtestdata/dash-dash-argument-1.out @@ -0,0 +1 @@ +a diff --git a/tests/virshtestdata/dash-dash-argument-2.out b/tests/virshtest= data/dash-dash-argument-2.out new file mode 100644 index 0000000000..7898192261 --- /dev/null +++ b/tests/virshtestdata/dash-dash-argument-2.out @@ -0,0 +1 @@ +a diff --git a/tests/virshtestdata/dash-dash-argument-3.out b/tests/virshtest= data/dash-dash-argument-3.out new file mode 100644 index 0000000000..b9f81e916d --- /dev/null +++ b/tests/virshtestdata/dash-dash-argument-3.out @@ -0,0 +1 @@ +a --shell diff --git a/tests/virshtestdata/dash-dash-argument-4.out b/tests/virshtest= data/dash-dash-argument-4.out new file mode 100644 index 0000000000..9367d302cc --- /dev/null +++ b/tests/virshtestdata/dash-dash-argument-4.out @@ -0,0 +1 @@ +-- --shell a diff --git a/tests/virshtestdata/dash-dash-argument-5.out b/tests/virshtest= data/dash-dash-argument-5.out new file mode 100644 index 0000000000..7898192261 --- /dev/null +++ b/tests/virshtestdata/dash-dash-argument-5.out @@ -0,0 +1 @@ +a diff --git a/tests/virshtestdata/dash-dash-argument-6.out b/tests/virshtest= data/dash-dash-argument-6.out new file mode 100644 index 0000000000..ab8d1a1b1f --- /dev/null +++ b/tests/virshtestdata/dash-dash-argument-6.out @@ -0,0 +1 @@ +--shell a diff --git a/tests/virshtestdata/echo-alias-argv.out b/tests/virshtestdata/= echo-alias-argv.out new file mode 100644 index 0000000000..ce01362503 --- /dev/null +++ b/tests/virshtestdata/echo-alias-argv.out @@ -0,0 +1 @@ +hello diff --git a/tests/virshtestdata/echo-escaping-1.out b/tests/virshtestdata/= echo-escaping-1.out new file mode 100644 index 0000000000..ff7ee063bf --- /dev/null +++ b/tests/virshtestdata/echo-escaping-1.out @@ -0,0 +1,2 @@ +a A 0 + * ; . ' " / ? =3D =20 + < > & diff --git a/tests/virshtestdata/echo-escaping-2.out b/tests/virshtestdata/= echo-escaping-2.out new file mode 100644 index 0000000000..e04d19b8e0 --- /dev/null +++ b/tests/virshtestdata/echo-escaping-2.out @@ -0,0 +1,2 @@ +a A 0 + '*' ';' . ''\''' '"' / '?' =3D ' ' ' +' '<' '>' '&' diff --git a/tests/virshtestdata/echo-escaping-3.out b/tests/virshtestdata/= echo-escaping-3.out new file mode 100644 index 0000000000..f98b72d213 --- /dev/null +++ b/tests/virshtestdata/echo-escaping-3.out @@ -0,0 +1,2 @@ +a A 0 + * ; . ' " / ? =3D =20 + < > & diff --git a/tests/virshtestdata/echo-quote-removal-1.out b/tests/virshtest= data/echo-quote-removal-1.out new file mode 100644 index 0000000000..b2901ea97c --- /dev/null +++ b/tests/virshtestdata/echo-quote-removal-1.out @@ -0,0 +1 @@ +a b diff --git a/tests/virshtestdata/echo-quote-removal-2.out b/tests/virshtest= data/echo-quote-removal-2.out new file mode 100644 index 0000000000..927ce33b9b --- /dev/null +++ b/tests/virshtestdata/echo-quote-removal-2.out @@ -0,0 +1 @@ +a b diff --git a/tests/virshtestdata/echo-quote-removal-3.out b/tests/virshtest= data/echo-quote-removal-3.out new file mode 100644 index 0000000000..927ce33b9b --- /dev/null +++ b/tests/virshtestdata/echo-quote-removal-3.out @@ -0,0 +1 @@ +a b diff --git a/tests/virshtestdata/echo-quote-removal-4.out b/tests/virshtest= data/echo-quote-removal-4.out new file mode 100644 index 0000000000..927ce33b9b --- /dev/null +++ b/tests/virshtestdata/echo-quote-removal-4.out @@ -0,0 +1 @@ +a b diff --git a/tests/virshtestdata/echo-quote-removal-5.out b/tests/virshtest= data/echo-quote-removal-5.out new file mode 100644 index 0000000000..00f7191294 --- /dev/null +++ b/tests/virshtestdata/echo-quote-removal-5.out @@ -0,0 +1 @@ +' " \;echo a diff --git a/tests/virshtestdata/echo-quote-removal-6.out b/tests/virshtest= data/echo-quote-removal-6.out new file mode 100644 index 0000000000..6af6f47e48 --- /dev/null +++ b/tests/virshtestdata/echo-quote-removal-6.out @@ -0,0 +1 @@ +' " ;echo a diff --git a/tests/virshtestdata/echo-quote-removal-7.out b/tests/virshtest= data/echo-quote-removal-7.out new file mode 100644 index 0000000000..e5ec314ba9 --- /dev/null +++ b/tests/virshtestdata/echo-quote-removal-7.out @@ -0,0 +1,2 @@ +' " \ +a diff --git a/tests/virshtestdata/echo-quote-removal-8.out b/tests/virshtest= data/echo-quote-removal-8.out new file mode 100644 index 0000000000..1b5a28c5b3 --- /dev/null +++ b/tests/virshtestdata/echo-quote-removal-8.out @@ -0,0 +1 @@ +' " \\ diff --git a/tests/virshtestdata/multiple-commands-1.out b/tests/virshtestd= ata/multiple-commands-1.out new file mode 100644 index 0000000000..422c2b7ab3 --- /dev/null +++ b/tests/virshtestdata/multiple-commands-1.out @@ -0,0 +1,2 @@ +a +b diff --git a/tests/virshtestdata/multiple-commands-10.out b/tests/virshtest= data/multiple-commands-10.out new file mode 100644 index 0000000000..a5ce8f1469 --- /dev/null +++ b/tests/virshtestdata/multiple-commands-10.out @@ -0,0 +1 @@ +a # b diff --git a/tests/virshtestdata/multiple-commands-11.out b/tests/virshtest= data/multiple-commands-11.out new file mode 100644 index 0000000000..7898192261 --- /dev/null +++ b/tests/virshtestdata/multiple-commands-11.out @@ -0,0 +1 @@ +a diff --git a/tests/virshtestdata/multiple-commands-12.out b/tests/virshtest= data/multiple-commands-12.out new file mode 100644 index 0000000000..7898192261 --- /dev/null +++ b/tests/virshtestdata/multiple-commands-12.out @@ -0,0 +1 @@ +a diff --git a/tests/virshtestdata/multiple-commands-2.out b/tests/virshtestd= ata/multiple-commands-2.out new file mode 100644 index 0000000000..422c2b7ab3 --- /dev/null +++ b/tests/virshtestdata/multiple-commands-2.out @@ -0,0 +1,2 @@ +a +b diff --git a/tests/virshtestdata/multiple-commands-3.out b/tests/virshtestd= ata/multiple-commands-3.out new file mode 100644 index 0000000000..422c2b7ab3 --- /dev/null +++ b/tests/virshtestdata/multiple-commands-3.out @@ -0,0 +1,2 @@ +a +b diff --git a/tests/virshtestdata/multiple-commands-4.out b/tests/virshtestd= ata/multiple-commands-4.out new file mode 100644 index 0000000000..fa70605cd2 --- /dev/null +++ b/tests/virshtestdata/multiple-commands-4.out @@ -0,0 +1,2 @@ +a + b diff --git a/tests/virshtestdata/multiple-commands-5.out b/tests/virshtestd= ata/multiple-commands-5.out new file mode 100644 index 0000000000..b89bc872d4 --- /dev/null +++ b/tests/virshtestdata/multiple-commands-5.out @@ -0,0 +1,3 @@ +a +\ + b diff --git a/tests/virshtestdata/multiple-commands-6.out b/tests/virshtestd= ata/multiple-commands-6.out new file mode 100644 index 0000000000..7898192261 --- /dev/null +++ b/tests/virshtestdata/multiple-commands-6.out @@ -0,0 +1 @@ +a diff --git a/tests/virshtestdata/multiple-commands-7.out b/tests/virshtestd= ata/multiple-commands-7.out new file mode 100644 index 0000000000..0f7bc76605 --- /dev/null +++ b/tests/virshtestdata/multiple-commands-7.out @@ -0,0 +1,2 @@ +a +c diff --git a/tests/virshtestdata/multiple-commands-8.out b/tests/virshtestd= ata/multiple-commands-8.out new file mode 100644 index 0000000000..0f7bc76605 --- /dev/null +++ b/tests/virshtestdata/multiple-commands-8.out @@ -0,0 +1,2 @@ +a +c diff --git a/tests/virshtestdata/multiple-commands-9.out b/tests/virshtestd= ata/multiple-commands-9.out new file mode 100644 index 0000000000..a5ce8f1469 --- /dev/null +++ b/tests/virshtestdata/multiple-commands-9.out @@ -0,0 +1 @@ +a # b --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org