From patchwork Mon Sep 4 03:43:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 9936691 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 884F7603F9 for ; Mon, 4 Sep 2017 03:43:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 767FB1FF2D for ; Mon, 4 Sep 2017 03:43:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B72F204BD; Mon, 4 Sep 2017 03:43:51 +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.4 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM 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 C07291FFF8 for ; Mon, 4 Sep 2017 03:43:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753236AbdIDDnc (ORCPT ); Sun, 3 Sep 2017 23:43:32 -0400 Received: from mout.gmx.net ([212.227.17.20]:58313 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753221AbdIDDna (ORCPT ); Sun, 3 Sep 2017 23:43:30 -0400 Received: from localhost.localdomain ([45.32.39.184]) by mail.gmx.com (mrgmx102 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MfSrf-1e9H0f0biV-00P1cq; Mon, 04 Sep 2017 05:43:26 +0200 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz Subject: [PATCH 2/2] btrfs-progs: test/mkfs: Add test case for rootdir parameter Date: Mon, 4 Sep 2017 12:43:20 +0900 Message-Id: <20170904034320.25744-2-quwenruo.btrfs@gmx.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170904034320.25744-1-quwenruo.btrfs@gmx.com> References: <20170904034320.25744-1-quwenruo.btrfs@gmx.com> X-Provags-ID: V03:K0:LLtHqollP93fcvs5Payd9NEhKPFs6OwAfFDFLzXLPxgzw7iTfeU 86uQUWQwetTfj0YPT0Y4JD6CeKxnyrtyiEdikpzObBp6mIJm1ARSBO5YRzZGtmySEB2CjSP t++oJRzwLJ/ZpXRKgGg53X0Tq2dmpZQu1XR9WpyUXN8LkjlzkERTds7Hj4t/+1XtFhphQfL bysm0Vj7S+zRcsw1okjmg== X-UI-Out-Filterresults: notjunk:1; V01:K0:Fz3k6cZi2Cw=:8snBRKOpQIp+nepgNutUh9 b3TQ4ri19+44eXWh2Jg8z+2wnlzE9uwi5djKgbkRiiCIsyOCdxpHTYKTlUR3/1tAwAOT4p29Z U109lx4iaAyPFz93arzweuqkPwQjUdZpKK3MaDpYcH+76fbq+xp2KGFs+N1ayjCELOce1Jben feOPhtP5tDA/+hd5LGceIQMgeq7ubTf2efHb17NMU1BkfSXKx2qXPZ6n2vNtud+QqVEql4k+R ZcNntvhQVFA89211VoW8xHGjosg5BGfMOWngxUbo42CUUMP1UTJHD/SvThd4Niajx3OL90r4F DgibP+RJ+braF4GeGwXnQDFPObWmcdq/SD1MGmPnvNaPdp0MGe/TS9+NU60b/VLf6oSuvfRCz aDJszGoyGqUtGl0k1lCTgOxjkgsgT4Ne/gKLd/RwiuHq4G/aZRww9762/8kAt+cJYokhPwAia ZQz6eOpM7kAeR+udCsDA6x7VuTGNrhNNAoaTVdh7M1ORKOcE/A2ZRVWVaYnyDYfgxBRVBMzXD wsuLvUmQnHFzz+cHAR7NGDKV86tPb/zvgHYFIaeHO5BiLnPyaYsFiatHjCMXpvmKATFXaOFdr 3QB0H/Wjw2Gl2DrKMtLDvfcp374yHAHMPSPYLJc1/RhJ7d4A1dgRVpcb+ZuvXGXpKzBkxAnvu v5Fk46TcHp59S6rc9muXF3zHfHTuCNOnI/V9ecT7Wv0sBBcj9axZgQp/J8PJg6sIAAM970HsB imzQFFdr1e1LmsViKnYn2hKPN9Ppi7WaFNupJz2Wyp8p2IZyFY4OqZ/pQBQjlVuqkXu7Th+y3 6/XIqenq6HfBCF1J7o5CC6BwfwkDw== Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add test case which checks if -r|--rootdir mount option can handle softlink/char/block/fifo files. Signed-off-by: Qu Wenruo --- .../009-special-files-for-rootdir/test.sh | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 tests/mkfs-tests/009-special-files-for-rootdir/test.sh diff --git a/tests/mkfs-tests/009-special-files-for-rootdir/test.sh b/tests/mkfs-tests/009-special-files-for-rootdir/test.sh new file mode 100755 index 00000000..bc5297d0 --- /dev/null +++ b/tests/mkfs-tests/009-special-files-for-rootdir/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Check if --rootdir can handle special files (socket/fifo/char/block) correctly +# +# --rootdir had a problem of filling dir items/indexes with wrong type +# and caused btrfs check to report such error + +source "$TOP/tests/common" + +check_prereq mkfs.btrfs +check_prereq btrfs + +setup_root_helper # For mknod +prepare_test_dev 128M + +# mknod can create FIFO/CHAR/BLOCK file but not SOCK. +# No neat tool to create socket file, unless using python or similar. +# So no SOCK is tested here +check_global_prereq mknod + +# Also check regular file +check_global_prereq dd + +# And dir +check_global_prereq mkdir + +tmp="/tmp/btrfs_selftest_$$" + +run_check mkdir $tmp +run_check mkdir $tmp/dir +run_check mkdir -p $tmp/dir/in/dir +run_check mknod $tmp/fifo p +run_check $SUDO_HELPER mknod $tmp/char c 1 1 +run_check $SUDO_HELPER mknod $tmp/block b 1 1 +run_check dd if=/dev/zero bs=1M count=1 of=$tmp/regular + +run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f -r "$tmp" $TEST_DEV + +rm "$tmp" -rf + +run_check $SUDO_HELPER "$TOP/btrfs" check $TEST_DEV