From patchwork Tue Jul 4 11:20:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9824593 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 731DA602F0 for ; Tue, 4 Jul 2017 11:20:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 617DC2844E for ; Tue, 4 Jul 2017 11:20:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53DD628462; Tue, 4 Jul 2017 11:20:22 +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 DE16A2844E for ; Tue, 4 Jul 2017 11:20:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752292AbdGDLUV (ORCPT ); Tue, 4 Jul 2017 07:20:21 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:32795 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752284AbdGDLUU (ORCPT ); Tue, 4 Jul 2017 07:20:20 -0400 Received: by mail-wm0-f68.google.com with SMTP id j85so25601766wmj.0; Tue, 04 Jul 2017 04:20:20 -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=MSrRC5/W7QZa+IHItu1Q/VwHXBSYcAFS45Nwn6ZY87zjlOQykJl5GMQcwPOsXOc60G 0uxxBIbYt+onrVNpRYKv8fufa1wOANBsZ95G2GD5avK+bulcnXLr9ZoQ278uRdeFzAzY 1RZ1YoRwVzGQp8oFR/WuWEdoNOS/7+b36mXRYrRiL8J726RpAmaqAiRdyWu8N+5jo78m PND7oaZAaBuWc87TYYgaNV+2kr4vLsMKEGyncfFNyAdE9bG31oWoxiAiKjM5JVlTNOVn WzbfcBtH4Qt5APHYPSwSVpq4+P6MIJp7+nrUYdkaSRIVSCYarkMwOlUJ+fb61ZHFkmkL l4DA== 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=mvb80+Oap8Kf35+hT1HknXWlIkSyGSJql0s7HU7hGJdERPamfSb706TBuuSjFTRws0 cMJmEsbrERSnPjSe5GTynnKGHUidbr0hTdRH54xDzrXjEdwnthVphxuRogler6dDP7CT 1l6E+zFX9LQIXFeLpoxY6h+svJAoYYKJjjeyxEa67GWqXU1M/YVvhD+TV0pL3noKmsqS 4FVQdmROlmsYJVuJ/scKRsFNsGckJBNzxHaL63sWOWmPMahN65OAkNeEko2nuYehNzrV 1RI72Hpb41WE/aQs0vGZimr0sv7BQENaorhzFRJcLc1gB4ZK41OKkI0wujZlFo4qgC2q TWJA== X-Gm-Message-State: AKS2vOxex4JkB8lVsR3K8o7qFAoZ4B+4kBAY7CgUASWjHQMZ9DNMK691 HWz3luEjazm5HFaw X-Received: by 10.28.100.8 with SMTP id y8mr22486033wmb.83.1499167219300; Tue, 04 Jul 2017 04:20:19 -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 l20sm14121449wre.25.2017.07.04.04.20.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Jul 2017 04:20:18 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH 1/6] overlay/018: re-factor and add to hardlink group Date: Tue, 4 Jul 2017 14:20:29 +0300 Message-Id: <1499167234-22779-2-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499167234-22779-1-git-send-email-amir73il@gmail.com> References: <1499167234-22779-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