From nobody Sat Nov 23 16:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) 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 171575685449029.949868437187547; Wed, 15 May 2024 00:07:34 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 60A0019C1; Wed, 15 May 2024 03:07:33 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 3DDA91B57; Wed, 15 May 2024 03:05:23 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5685F19F7; Wed, 15 May 2024 03:05:16 -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 CBA6D1B13 for ; Wed, 15 May 2024 03:04:55 -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-106-zGAe_HBpPxGo2RzFW_2oPg-1; Wed, 15 May 2024 03:04:43 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (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 A3EAF800206 for ; Wed, 15 May 2024 07:04:43 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 159BE200B4DB for ; Wed, 15 May 2024 07:04:42 +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.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715756695; h=from:from: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; bh=JsIk9KvQHerCgCUgE+19EIcLt77cbAhuSwbX6nSS5R4=; b=hOfZZ0ORKKhLOY00BSPvQ+Jh0vE1o0gqLKf8xPaFqxr7VIHEHsOuz/gXS3PBkGdRkee4WX uC3W7rXCLuVxYBH3y9WKNqXqTkeCLgV2O+iadIxIn1+xKyvGPjSsnH2CIT4CXLYgDmP16x iDem0zlquxUcIdZI50o0M7559jNIqRM= X-MC-Unique: zGAe_HBpPxGo2RzFW_2oPg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 2/3] virshtest: Add tests for '--help' Date: Wed, 15 May 2024 09:04:39 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: G5AAQHXYLYCORQV44CRMKB4I2FQ5NBLZ X-Message-ID-Hash: G5AAQHXYLYCORQV44CRMKB4I2FQ5NBLZ 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: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1715756856262100001 Content-Type: text/plain; charset="utf-8" Add test cases for help handling. Signed-off-by: Peter Krempa --- tests/virshtest.c | 3 ++ tests/virshtestdata/help-option.in | 4 ++ tests/virshtestdata/help-option.out | 64 +++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 tests/virshtestdata/help-option.in create mode 100644 tests/virshtestdata/help-option.out diff --git a/tests/virshtest.c b/tests/virshtest.c index 03d499b759..b86c39285a 100644 --- a/tests/virshtest.c +++ b/tests/virshtest.c @@ -309,6 +309,9 @@ mymain(void) DO_TEST("#unbalanced; 'quotes\"\necho a # b"); DO_TEST("\\# ignored;echo a\n'#also' ignored"); + /* test of the --help option handling */ + DO_TEST_SCRIPT("help-option", NULL, VIRSH_DEFAULT, "-q"); + /* test of splitting in vshStringToArray */ DO_TEST_SCRIPT("echo-split", NULL, VIRSH_DEFAULT, "-q"); diff --git a/tests/virshtestdata/help-option.in b/tests/virshtestdata/help-= option.in new file mode 100644 index 0000000000..655952eefb --- /dev/null +++ b/tests/virshtestdata/help-option.in @@ -0,0 +1,4 @@ +help echo +echo --help +echo --help=3Ddata +echo --help data diff --git a/tests/virshtestdata/help-option.out b/tests/virshtestdata/help= -option.out new file mode 100644 index 0000000000..5b7510b612 --- /dev/null +++ b/tests/virshtestdata/help-option.out @@ -0,0 +1,64 @@ + NAME + echo - echo arguments. Used for internal testing. + + SYNOPSIS + echo [--shell] [--xml] [--split] [--err] [--prefix ] [= ]... + + DESCRIPTION + Echo back arguments, possibly with quoting. Used for internal testing. + + OPTIONS + --shell escape for shell use + --xml escape for XML use + --split split each argument on ','; ',,' is an escape sequence + --err output to stderr + --prefix prefix the message + [--string] ... arguments to echo + NAME + echo - echo arguments. Used for internal testing. + + SYNOPSIS + echo [--shell] [--xml] [--split] [--err] [--prefix ] [= ]... + + DESCRIPTION + Echo back arguments, possibly with quoting. Used for internal testing. + + OPTIONS + --shell escape for shell use + --xml escape for XML use + --split split each argument on ','; ',,' is an escape sequence + --err output to stderr + --prefix prefix the message + [--string] ... arguments to echo + NAME + echo - echo arguments. Used for internal testing. + + SYNOPSIS + echo [--shell] [--xml] [--split] [--err] [--prefix ] [= ]... + + DESCRIPTION + Echo back arguments, possibly with quoting. Used for internal testing. + + OPTIONS + --shell escape for shell use + --xml escape for XML use + --split split each argument on ','; ',,' is an escape sequence + --err output to stderr + --prefix prefix the message + [--string] ... arguments to echo + NAME + echo - echo arguments. Used for internal testing. + + SYNOPSIS + echo [--shell] [--xml] [--split] [--err] [--prefix ] [= ]... + + DESCRIPTION + Echo back arguments, possibly with quoting. Used for internal testing. + + OPTIONS + --shell escape for shell use + --xml escape for XML use + --split split each argument on ','; ',,' is an escape sequence + --err output to stderr + --prefix prefix the message + [--string] ... arguments to echo --=20 2.45.0