From patchwork Wed Jul 5 12:02:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9826425 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 6A04C603B5 for ; Wed, 5 Jul 2017 12:02:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61BE828397 for ; Wed, 5 Jul 2017 12:02:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5367027F54; Wed, 5 Jul 2017 12:02:02 +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 E19E827F54 for ; Wed, 5 Jul 2017 12:02:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752831AbdGEMB5 (ORCPT ); Wed, 5 Jul 2017 08:01:57 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36360 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752820AbdGEMBz (ORCPT ); Wed, 5 Jul 2017 08:01:55 -0400 Received: by mail-wm0-f67.google.com with SMTP id y5so31937080wmh.3; Wed, 05 Jul 2017 05:01:54 -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=4D3g2sdMq3i6npVcEM7T6x7KVJZOfOLDfj4ISP6g70E=; b=h6pbrZVGgBAKTOgrqnPCtmHarRTLX2J2y3qvplCUDLvES60SJ+e4l7SQ1k+QvNbXJm ejMxYvCYY87LFKTEoAv113KgIs6TZZ8qQOXbHEL08qmXRbtz3c0p3scv3agRpWtSXz+q msecuVICqXguYnOupgTDBm+VXuAx4uTgPQSRI+ShK/L0zlBYHFF0CXQqg9yVseYFyzFD bloiFl6xmsMtCmyfrJ/BH9rQGjbetIzmzDE9dxnTbkqFVQCw+bkfYpRW6YY3pmVXH5jn ojLQMnz4E8acwv43XzQP2ijyWFVF4Kvr77ZJKycrcsrYPBZlqQWEYbKigJBjL7CosTRv RcGA== 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=4D3g2sdMq3i6npVcEM7T6x7KVJZOfOLDfj4ISP6g70E=; b=Rce2SORi8ov5pdg/7STfDrZfL9j9JWhUBwjZ+P/oXQ/T4OIUMrKKbNZ0YM9/lZ6owv ikkscL2enC1zUx+KTbKnzG4+ulEn0pS/3q7EB6Nqc60eihmEXVSNKK4J/fYA3OY9RfY0 GW0Xs7FaLFhemqj+4NTrU9mrR3wQ7GFXyXXc6nANv7BkSw/caSbUb+To0aMlO5VYpn5b YkbBdNO8r838DE7dbznn0+ZSHMeyLLCna9hFVcK/zydknGZJ4EVQ6h3NllKN2nmyWpaJ cdHjnO/Dk2dC4Q5N1wjtpLkLDinX4VTXFjVsGdR44UwY4Ij03eGR/ejLVXS6I5m0QMkI fGKg== X-Gm-Message-State: AKS2vOwkJRX9xySRbEBMicpBzq12f8C67WyvVeW1vFwDxSZzx9Q05za2 UkRPM1ZiE6b+Pw== X-Received: by 10.28.64.196 with SMTP id n187mr30443016wma.94.1499256108680; Wed, 05 Jul 2017 05:01:48 -0700 (PDT) Received: from amir-VirtualBox.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id 143sm155578wmg.9.2017.07.05.05.01.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 05 Jul 2017 05:01:48 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v3 1/7] overlay/018: re-factor and add to hardlink group Date: Wed, 5 Jul 2017 15:02:00 +0300 Message-Id: <1499256126-21866-2-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499256126-21866-1-git-send-email-amir73il@gmail.com> References: <1499256126-21866-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 Use helpers to records and check inode numbers so we can repeat the same test after each hardlink copy up and mount cycle. Signed-off-by: Amir Goldstein --- tests/overlay/018 | 33 +++++++++++++++++++++++++-------- tests/overlay/group | 2 +- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/tests/overlay/018 b/tests/overlay/018 index 7e47732..527b9d1 100755 --- a/tests/overlay/018 +++ b/tests/overlay/018 @@ -61,25 +61,42 @@ echo "patient zero" >> $lowerdir/foo ln $lowerdir/foo $lowerdir/bar +# Record inode numbers in format +function record_ino_nlink() +{ + ls -li $FILES | awk '{ print $1, $3 }' > $1 +} + +# Check inode numbers match recorded inode numbers +function check_ino_nlink() +{ + before=$1 + after=$2 + + record_ino_nlink $after + + # Test constant stat(2) st_ino/st_nlink - + # Compare before..after - expect silence + # We use diff -u so out.bad will tell us which stage failed + diff -u $before $after +} + _scratch_mount -rm -f $tmp.before $tmp.after +rm -f $tmp.* foo=$SCRATCH_MNT/foo bar=$SCRATCH_MNT/bar -# Record inode number and nlink before copy up -ls -li $foo $bar | awk '{ print $1, $3 }' > $tmp.before +FILES="$foo $bar" + +record_ino_nlink $tmp.before # Modify content of one of the hardlinks echo "mutated" >> $foo -# Record inode number and nlink after copy up -ls -li $foo $bar | awk '{ print $1, $3 }' > $tmp.after - -# Compare ino/nlink before..after - expect silence -diff $tmp.before $tmp.after +check_ino_nlink $tmp.before $tmp.after # Compare content of files - expect silence diff $foo $bar diff --git a/tests/overlay/group b/tests/overlay/group index 64d200c..28df5b6 100644 --- a/tests/overlay/group +++ b/tests/overlay/group @@ -20,7 +20,7 @@ 015 auto quick whiteout 016 auto quick copyup 017 auto quick copyup -018 auto quick copyup +018 auto quick copyup hardlink 019 auto stress 020 auto quick copyup perms 021 auto quick copyup