From patchwork Tue Jul 4 11:40:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9824637 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 ED671604D9 for ; Tue, 4 Jul 2017 11:40:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF8C52811E for ; Tue, 4 Jul 2017 11:40:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D39962845D; Tue, 4 Jul 2017 11:40:25 +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 77ACE28397 for ; Tue, 4 Jul 2017 11:40:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752099AbdGDLkV (ORCPT ); Tue, 4 Jul 2017 07:40:21 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:33882 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752051AbdGDLkU (ORCPT ); Tue, 4 Jul 2017 07:40:20 -0400 Received: by mail-wm0-f65.google.com with SMTP id p204so25784119wmg.1; Tue, 04 Jul 2017 04:40:19 -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=PTV57JOOVc1k1AHhzcEPzQDNnFpOantW4/S8LIbWSArtk7bLNG0rGeQY1vrHqD5HTf 5a8lxMIUBoKbM9uHkx7zH/f49+vwqxPc1OgJGo3CyOHNt1Cp08FFS8kb+lUEH+LzDR2V c0jHUqocybh7k91+at9jma65K6FqZyJSLPSQYxrv3HPf8/+WgVk+0Y8tL6NWYAjZnQeS lWo9bApennAs3PRGycV+Z/k0ahwL6FONTz/GynP5WVSlEQtmUawxbkhCBA62adFXHgFq NoIfXxZ4n4JKMA3VSeLgKC+9DL1lL7cPlu1B5ImTcB8XZgccDeDS8tKwQ4oiDAYj/qzm muOw== 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=Xesu1iq/9MIMloTSHZobnHvycF0jY1N1T6pzjJ/ucBKaylJYQ2Vd3hztiloH8pvWvB 1cBucYU5OJimPEb9HrviOjDVz+bG/8TMrCcy/FdDJVNQF9AsYUrWpWRmMgEdXSl0p8sK TL+9uSTGsuSRCoUECCra2Gm2HZQczy3t/moBf0I26h3IRDYNaQS8W+2wKi0avq6SOlm5 PONcUfznM9M7tUVOZra8XWdrFbP/1j0Aw5vdw268lH3QsRVIJd4coM+QGIIIXcI4L6PF 7tmTT6E6eaSFS8bVSnq4N3CnUVO+75SyJRu/CYI32O+X+xt9x9b1hfLX2YiU2GeMtM0+ kucg== X-Gm-Message-State: AIVw112XGS4QJNKJxzDA/okz0fMrXJmPW/fNhUbtqi6gIBQhKEnlCa/w 51aJuikV9+GlW/ti X-Received: by 10.28.225.5 with SMTP id y5mr1373197wmg.18.1499168418721; Tue, 04 Jul 2017 04:40:18 -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 90sm18842912wrk.38.2017.07.04.04.40.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Jul 2017 04:40:18 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v2 1/7] overlay/018: re-factor and add to hardlink group Date: Tue, 4 Jul 2017 14:40:28 +0300 Message-Id: <1499168434-23859-2-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499168434-23859-1-git-send-email-amir73il@gmail.com> References: <1499168434-23859-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