From patchwork Thu Apr 27 15:09:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9703009 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3E58C6032C for ; Thu, 27 Apr 2017 15:09:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EAB928652 for ; Thu, 27 Apr 2017 15:09:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3349C285EA; Thu, 27 Apr 2017 15:09:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D36FA285EA for ; Thu, 27 Apr 2017 15:09:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932592AbdD0PJe (ORCPT ); Thu, 27 Apr 2017 11:09:34 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:34910 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932171AbdD0PJe (ORCPT ); Thu, 27 Apr 2017 11:09:34 -0400 Received: by mail-wr0-f193.google.com with SMTP id g12so4110172wrg.2; Thu, 27 Apr 2017 08:09:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TpFdx6HKmtUQc2RKnGlOOFr8ddazjjfq9cj1SpwqVkI=; b=AIoLlb8HekVcsVLuWQkkO9q+vPimicx0UL/d6fUtje1KHl3oxld4L/cmHeoYn9AzUK xjdAHeNg/V+CBzm0GaITBGP6JUkxreLIlSPgh7wJYkjBY/CAjLhUDGpDZ+BuSnTDzhW8 UrLdWVd+DFf6XyObhE0UK7KEtVTfXEj5xv9uUNgYLnPjcu6cmTp2u5VHcnf2yEzRw0DJ rMlK0B4VAdqB7to/YfWT8YGfm2gMjMM2ubFP+mifJSpRGDYMccycNCXnSWIo2InWa6XU ABJjGaP60g4pF/dgSi2fZYVVdExNNCMXaqlY8iF94/GasZWuSKyvoMRPzU0b+pa+BJWA bn0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TpFdx6HKmtUQc2RKnGlOOFr8ddazjjfq9cj1SpwqVkI=; b=F9pCFT4rWeQU2fEd4Ird53ygLpnw+7HsfvSp9eVwsA0sXOyLURiQM5f938V76MM1OL LW/SItrZKyUrAnyTxBWoYPA7uqpvQC+tgiIRrTHvmHLcs3ZtQT2pI9iAHiBUPBS6NSHU TDzz2Zqq6JMQ8W7KwxxzNRfwQJfsgx02I88jBNAv3J3D+1YT+5bctYdMPZeSInD+vtHB 5J5Z4OIcICRvG+dKLIpjZqjF8LWZeNspgu2hEMD5OO0Xweof5blPHSb9i4zoY4lJbCbF mUov8iU54QzG+kHdyrnTs/S7JBGP8t/NilLYOJVqo1GzfKpAngMqHsWNnG0WGYZAXVau zLpQ== X-Gm-Message-State: AN3rC/7+jUdGuqsYT7ikD8S6dqcooWcLALHrq1SCznrSJAPjrZbDqpno gj8CYRvo6/EuM7JE X-Received: by 10.223.170.70 with SMTP id q6mr4644012wrd.162.1493305772551; Thu, 27 Apr 2017 08:09:32 -0700 (PDT) Received: from amir-VirtualBox.lan (bzq-79-179-55-127.red.bezeqint.net. [79.179.55.127]) by smtp.gmail.com with ESMTPSA id p17sm3519265wmd.11.2017.04.27.08.09.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 27 Apr 2017 08:09:32 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , Xiong Zhou , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH 3/5] overlay/017: create a helper to record inode number Date: Thu, 27 Apr 2017 18:09:33 +0300 Message-Id: <1493305775-12559-4-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493305775-12559-1-git-send-email-amir73il@gmail.com> References: <1493305775-12559-1-git-send-email-amir73il@gmail.com> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP helper records inode number and file basename, so the output is independant of the files full path. This is needed for adding rename test. Signed-off-by: Amir Goldstein --- tests/overlay/017 | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/tests/overlay/017 b/tests/overlay/017 index 66a028f..f3bf454 100755 --- a/tests/overlay/017 +++ b/tests/overlay/017 @@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _cleanup() { + cd / rm -f $tmp.* } @@ -72,22 +73,41 @@ mknod $lowerdir/blkdev b 1 1 mknod $lowerdir/fifo p $here/src/af_unix $lowerdir/socket +FILES="dir file symlink chrdev blkdev fifo socket" + +# record inode numbers in format +function record_inode_numbers() +{ + dir=$1 + outfile=$2 + + for f in $FILES; do + ls -id $dir/$f + done | \ + while read ino file; do + echo $ino `basename $file` >> $outfile + done +} + _scratch_mount -rm -f $tmp.before $tmp.after +rm -f $tmp.* # Test stable stat(2) st_ino -# Record inode numbers before and after copy up -for f in dir file symlink chrdev blkdev fifo socket; do - ls -id $SCRATCH_MNT/$f >> $tmp.before +# Record inode numbers before copy up +record_inode_numbers $SCRATCH_MNT $tmp.before + +for f in $FILES; do # chown -h modifies all those file types chown -h 100 $SCRATCH_MNT/$f - ls -id $SCRATCH_MNT/$f >> $tmp.after done +# Record inode numbers after copy up +record_inode_numbers $SCRATCH_MNT $tmp.after + # Test stable readdir(3)/getdents(2) d_ino # find by inode number - expect to find file by inode number