From patchwork Mon Jul 19 09:21:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Liang X-Patchwork-Id: 1506867 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) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GSxDr4249z9sW8 for ; Mon, 19 Jul 2021 19:21:48 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 22CF13C6480 for ; Mon, 19 Jul 2021 11:21:46 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.7]) (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 96BDC3C0F6A for ; Mon, 19 Jul 2021 11:21:43 +0200 (CEST) Received: from ATCSQR.andestech.com (atcsqr.andestech.com [60.248.187.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id D09B62001D7 for ; Mon, 19 Jul 2021 11:21:42 +0200 (CEST) Received: from mail.andestech.com (atcpcs16.andestech.com [10.0.1.222]) by ATCSQR.andestech.com with ESMTP id 16J9LBb5073639; Mon, 19 Jul 2021 17:21:11 +0800 (GMT-8) (envelope-from ycliang@andestech.com) Received: from atcfdc88 (10.0.15.120) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.498.0; Mon, 19 Jul 2021 17:21:13 +0800 Date: Mon, 19 Jul 2021 17:21:11 +0800 From: Leo Liang To: Message-ID: <20210719092107.GA1406@atcfdc88> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [10.0.15.120] X-DNSRBL: X-MAIL: ATCSQR.andestech.com 16J9LBb5073639 X-Virus-Scanned: clamav-milter 0.102.4 at in-7.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-7.smtp.seeweb.it Subject: [LTP] [PATCH v4, 1/2] lib/tst_test.sh: Make tst_umount work with argument has trailing slash 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: richiejp@f-m.fm, Alan Quey-Liang Kao , metan@ucw.cz, ycliang@cs.nctu.edu.tw, ltp@lists.linux.it Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" /proc/mounts shows the mount point without trailing slashes, e.g. ~ $ cat /proc/mounts xxx /root/cgroup cgroup rw,relatime,cpu 0 0 So current tst_umount would not work with argument that has trailing slash, e.g. tst_umount cgroup/ would give "The device is not mounted". Fix this by filtering out the trailing slash in the argument for grep. Signed-off-by: Leo Yu-Chi Liang Reviewed-by: Petr Vorel --- 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 c6aa2c487..cbdfb707a 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -282,7 +282,7 @@ tst_umount() [ -z "$device" ] && return - if ! grep -q "$device" /proc/mounts; then + if ! grep -q "${device%/}" /proc/mounts; then tst_res TINFO "The $device is not mounted, skipping umount" return fi