From patchwork Thu Mar 29 01:26:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10314325 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 D256D600F6 for ; Thu, 29 Mar 2018 01:27:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF8DB29FD5 for ; Thu, 29 Mar 2018 01:27:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE4932A04E; Thu, 29 Mar 2018 01:27: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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 29EA22A02F for ; Thu, 29 Mar 2018 01:27:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751200AbeC2B07 (ORCPT ); Wed, 28 Mar 2018 21:26:59 -0400 Received: from prv3-mh.provo.novell.com ([137.65.250.26]:48830 "EHLO prv3-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750971AbeC2B06 (ORCPT ); Wed, 28 Mar 2018 21:26:58 -0400 Received: from adam-pc.lan (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Wed, 28 Mar 2018 19:26:48 -0600 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH] btrfs-progs: tests/mkfs: Test if mkfs.btrfs --rootdir can handle broken soft link well Date: Thu, 29 Mar 2018 09:26:44 +0800 Message-Id: <20180329012644.17822-1-wqu@suse.com> X-Mailer: git-send-email 2.16.2 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 Signed-off-by: Qu Wenruo --- .../016-rootdir-bad-symbolic-link/test.sh | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 tests/mkfs-tests/016-rootdir-bad-symbolic-link/test.sh diff --git a/tests/mkfs-tests/016-rootdir-bad-symbolic-link/test.sh b/tests/mkfs-tests/016-rootdir-bad-symbolic-link/test.sh new file mode 100755 index 000000000000..d12efa629042 --- /dev/null +++ b/tests/mkfs-tests/016-rootdir-bad-symbolic-link/test.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Regression test for mkfs.btrfs --rootdir with bad symbolic link +# (points to non-existing location) +# +# Since mkfs.btrfs --rootdir will just create symbolic link other than +# follow it, we shouldn't hit any problem + +source "$TEST_TOP/common" + +check_prereq mkfs.btrfs + +prepare_test_dev + +tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX) + +non_existing="/no/such/file" + +if [ -f "$non_existing" ]; then + # Some smartass don't want to this test case to run + _not_run "Some one created $non_exist, which is not expect to exist" +fi + +run_check ln -sf "$non_existing" "$tmp/foobar" + +run_check "$TOP/mkfs.btrfs" -f --rootdir "$tmp" "$TEST_DEV" +run_check "$TOP/btrfs" check "$TEST_DEV"