From patchwork Mon Jan 11 07:21:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia He X-Patchwork-Id: 7999791 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 381D69F3F6 for ; Mon, 11 Jan 2016 07:21:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5F1B02024C for ; Mon, 11 Jan 2016 07:21:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 82E352022D for ; Mon, 11 Jan 2016 07:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752117AbcAKHVm (ORCPT ); Mon, 11 Jan 2016 02:21:42 -0500 Received: from mail-ob0-f194.google.com ([209.85.214.194]:33163 "EHLO mail-ob0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751976AbcAKHVm (ORCPT ); Mon, 11 Jan 2016 02:21:42 -0500 Received: by mail-ob0-f194.google.com with SMTP id oj9so3947953obc.0 for ; Sun, 10 Jan 2016 23:21:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=lbfUv4O3Maow9hXdJ1AmK6LWmxacORTqWQcHVQbqMxc=; b=0a3Tz8AykeoX53pmhN//vemzYL6a9PJth37zF4mAKEtEftR2hozRb0MWw0OKrqcFHo G0T0Fur5g7CTDpHQ2wMamDwYMMewNNz1H6Nx0OgECWlMUiO2dduEM/WzeJkbAEYNOvcu W/fXbs5oyoG9L0nTC2hLnBFv1afqG1ZzT0RfE/AqQyPlvJo9LrvpBt13U2H1O7ovJpuu q7WXEt6VSu1WXo76BTSnPOhTyiCz4xAFcaQy56uxpRKDLq/cyAcMXySjT5zdRe6KioU+ MHXezCqga1uY0Rl0ETD5ZvAIKjpupPPZiopXgtG4FvDRReCXAX70VR1GZHPti7Q1hQeh vKYQ== X-Received: by 10.182.79.200 with SMTP id l8mr95995777obx.18.1452496901511; Sun, 10 Jan 2016 23:21:41 -0800 (PST) Received: from localhost.localdomain ([60.247.125.148]) by smtp.gmail.com with ESMTPSA id cd5sm29779645oec.15.2016.01.10.23.21.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 10 Jan 2016 23:21:41 -0800 (PST) From: Jia He To: fstests@vger.kernel.org Cc: david@fromorbit.com, Jia He Subject: [PATCH V2] fstests: add user friendly debug prompts for already mounted points name Date: Mon, 11 Jan 2016 15:21:27 +0800 Message-Id: <1452496887-20385-1-git-send-email-hejianet@gmail.com> X-Mailer: git-send-email 2.1.4 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This adds user friendly prompts to output the already mounted point from _mount. xfstests will do the cleanup (ie. umount) and user can not get the mount name information when directory is already mounted. V2: avoid to call _mount twice Signed-off-by: Jia He --- common/rc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/common/rc b/common/rc index 5135260..bf444ec 100644 --- a/common/rc +++ b/common/rc @@ -1266,12 +1266,15 @@ _require_scratch_nocheck() # mounted? # Note that we use -F here so grep doesn't try to interpret an NFS over # IPv6 server as a regular expression. - if _mount | grep -F -q $SCRATCH_DEV + mount_rec=`_mount | grep -F $SCRATCH_DEV` + if [ "$mount_rec" ] then # if it's mounted, make sure its on $SCRATCH_MNT - if ! _mount | grep -F $SCRATCH_DEV | grep -q $SCRATCH_MNT + if ! echo $mount_rec | grep -q $SCRATCH_MNT then - echo "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting" + echo "\$SCRATCH_DEV=$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT=$SCRATCH_MNT - aborting" + echo "Already mounted result:" + echo $mount_rec exit 1 fi # and then unmount it @@ -1348,12 +1351,15 @@ _require_test() # mounted? # Note that we use -F here so grep doesn't try to interpret an NFS over # IPv6 server as a regular expression. - if _mount | grep -F -q $TEST_DEV + mount_rec=`_mount | grep -F $TEST_DEV` + if [ "$mount_rec" ] then # if it's mounted, make sure its on $TEST_DIR - if ! _mount | grep -F $TEST_DEV | grep -q $TEST_DIR + if ! echo $mount_rec | grep -q $TEST_DIR then - echo "\$TEST_DEV is mounted but not on \$TEST_DIR - aborting" + echo "\$TEST_DEV=$TEST_DEV is mounted but not on \$TEST_DIR=$TEST_DIR - aborting" + echo "Already mounted result:" + echo $mount_rec exit 1 fi else