From patchwork Tue Jul 27 05:59:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Liang X-Patchwork-Id: 1510314 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 4GYmNB2Vq3z9sRK for ; Tue, 27 Jul 2021 15:59:54 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 488C13C6598 for ; Tue, 27 Jul 2021 07:59:52 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [IPv6:2001:4b78:1:20::3]) (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 576AA3C57B2 for ; Tue, 27 Jul 2021 07:59:50 +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-3.smtp.seeweb.it (Postfix) with ESMTPS id 391D71A00E09 for ; Tue, 27 Jul 2021 07:59:47 +0200 (CEST) Received: from mail.andestech.com (atcpcs16.andestech.com [10.0.1.222]) by ATCSQR.andestech.com with ESMTP id 16R5xGWX008254; Tue, 27 Jul 2021 13:59:16 +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; Tue, 27 Jul 2021 13:59:17 +0800 Date: Tue, 27 Jul 2021 13:59:14 +0800 From: Leo Liang To: Message-ID: <20210727055859.GA16380@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 16R5xGWX008254 X-Virus-Scanned: clamav-milter 0.102.4 at in-3.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-3.smtp.seeweb.it Subject: [LTP] [PATCH v5, 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, ycliang@cs.nctu.edu.tw, alankao@andestech.com, metan@ucw.cz 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