From patchwork Mon Mar 20 08:23:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Bachinin X-Patchwork-Id: 1758881 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sberdevices.ru header.i=@sberdevices.ru header.a=rsa-sha256 header.s=mail header.b=iog0QK84; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Pg76n6WQFz247d for ; Mon, 20 Mar 2023 19:23:45 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 05E3185C27; Mon, 20 Mar 2023 09:23:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=sberdevices.ru Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=sberdevices.ru header.i=@sberdevices.ru header.b="iog0QK84"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C9BB085BD1; Mon, 20 Mar 2023 09:23:39 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 74ECB85B34 for ; Mon, 20 Mar 2023 09:23:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=sberdevices.ru Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=EABachinin@sberdevices.ru Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id B7F615FD0A; Mon, 20 Mar 2023 11:23:34 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1679300614; bh=FxQ4ybnAHhlMHCyud5JuD/fMoRyG63WKZuz8e0tJMHM=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=iog0QK84FgKC+RwHFirm0tgJiexh2IwfDi4jBgK4iJkmoNiuUhSem4AlffBkJmGaU vfoNyuw7RuFfAqOtQXCzQzyEoxjEjJwCse94EFZXCT+3JH4zz4KaOgxs6MKrV3Bhvr ZctgsgTkl+XZTOX9EmUMUnmGFXVA3QYQBzsqMHKk3OYQtLE40zNhyV+dU4EWqxAtL+ snk0aojAqVD6qkOrrj72CSbeof6XeYYfIz/0SXiY7GOIXfvdUHMWTSf1TxXzEa1GuN /tnFr2Q8jEmA5tsoQoHOk7vsFZf/NLyFwTltBVXxzQer4GmDGfyC9tXbq0EP9AvMSq zdHnWL8kjRsgw== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Mon, 20 Mar 2023 11:23:31 +0300 (MSK) From: Evgeny Bachinin To: Simon Glass , Hector Palacios , Marek Vasut , Heinrich Schuchardt , John Keeping CC: , , , Evgeny Bachinin Subject: [PATCH v2 0/4] cli: run_commandf() coverage and small fixups Date: Mon, 20 Mar 2023 11:23:10 +0300 Message-ID: <20230320082314.2018-1-EABachinin@sberdevices.ru> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [172.16.1.6] X-ClientProxiedBy: S-MS-EXCH01.sberdevices.ru (172.16.1.4) To S-MS-EXCH01.sberdevices.ru (172.16.1.4) X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2023/03/20 04:57:00 #20976224 X-KSMG-AntiVirus-Status: Clean, skipped X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Our company has been using custom variadic version of run_command() since the beginning of the 2022Y. Recently, we had started upstreaming activity and figured out, that similar functionality already exists. Thanks, it's very helpful, because our code uses such variadic API. Let me share test-cases for run_commandf() to improve coverage and btw provide several fixups for run_commandf(), found during applying this API to our custom sources. Patchset has been tested on our set of devices and sandbox64 (appropriate unit-tests were checked: ut_cmd, ut fdt, ut exit). Additionally, github CI loop has been passed successfully without regression in context of github PR [1]. Changes v2 since v1 at [2]: - rebase - run_commandf: apply comments - command_ut: re-write truncation test-case - test/cmd/fdt.c: fix compilation after rebase Links: [1] https://github.com/u-boot/u-boot/pull/277/checks [2] https://lore.kernel.org/u-boot/20230310185409.22254-1-EABachinin@sberdevices.ru/ Evgeny Bachinin (4): cli: run_commandf(): small fixups unit-test: cover run_commandf() by test-cases test: fdt: fix run_commandf() warnings test: exit: fix run_commandf() warnings common/cli.c | 25 +++++++++++++++++++------ include/command.h | 13 ++++++++++--- test/cmd/exit.c | 18 +++++++++--------- test/cmd/fdt.c | 16 ++++++++-------- test/command_ut.c | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 80 insertions(+), 26 deletions(-)