From patchwork Fri Apr 16 17:22:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1467183 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FMNLz6J5lz9sRR for ; Sat, 17 Apr 2021 03:22:35 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 7EBD03C6F70 for ; Fri, 16 Apr 2021 19:22:33 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id DAF793C1B3C for ; Fri, 16 Apr 2021 19:22:31 +0200 (CEST) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 6926C100046C for ; Fri, 16 Apr 2021 19:22:31 +0200 (CEST) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id AC50EB2E9; Fri, 16 Apr 2021 17:22:30 +0000 (UTC) From: Petr Vorel To: ltp@lists.linux.it Date: Fri, 16 Apr 2021 19:22:25 +0200 Message-Id: <20210416172225.14524-1-pvorel@suse.cz> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH 1/1] tst_test.sh: Use 'command -v' instead of 'which' X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Martin Loviska Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" to avoid unnecessary dependency. 'which' is a binary file, which might not be installed (common on containers). 'command' is a shell builtin, available everywhere, we already use non-standard -v option commonly supported (bash, dash, busybox ash). Fixes: 7783ac3a0 ("lib/tst_test.sh: Add new shell library") Signed-off-by: Petr Vorel Reviewed-by: Cyril Hrubis --- testcases/lib/tst_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh index 7f98e06bf..95ece42f6 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -685,7 +685,7 @@ else fi if [ -z "$TST_NO_DEFAULT_RUN" ]; then - if TST_TEST_PATH=$(which $0) 2>/dev/null; then + if TST_TEST_PATH=$(command -v $0) 2>/dev/null; then if ! grep -q tst_run "$TST_TEST_PATH"; then tst_brk TBROK "Test $0 must call tst_run!" fi