From patchwork Fri Aug 28 03:42:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaolei X-Patchwork-Id: 7089381 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D3FB09F358 for ; Fri, 28 Aug 2015 03:44:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E37C420A1C for ; Fri, 28 Aug 2015 03:44:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 85E5E20A17 for ; Fri, 28 Aug 2015 03:44:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751272AbbH1DoL (ORCPT ); Thu, 27 Aug 2015 23:44:11 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:47321 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751210AbbH1DoK (ORCPT ); Thu, 27 Aug 2015 23:44:10 -0400 X-IronPort-AV: E=Sophos;i="5.15,520,1432569600"; d="scan'208";a="100113001" Received: from bogon (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 28 Aug 2015 11:47:16 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id t7S3i0K8010343 for ; Fri, 28 Aug 2015 11:44:00 +0800 Received: from localhost.localdomain (10.167.226.114) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server id 14.3.181.6; Fri, 28 Aug 2015 11:44:07 +0800 From: Zhao Lei To: CC: Zhao Lei Subject: [PATCH] btrfs-progs: tests: Introduce subvolume sync test Date: Fri, 28 Aug 2015 11:42:11 +0800 Message-ID: <0375c5ddbbc6f00df7f67265df81d71cfd2ab0f8.1440733313.git.zhaolei@cn.fujitsu.com> X-Mailer: git-send-email 1.8.5.1 MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Current code have following bug for subvolume sync: 1: If there are more than 1 subvolume to sync, the program will infinitely loop. 2: return !0 in exit This patch add misc-tests/007-subvolume-sync for above case. Signed-off-by: Zhao Lei --- tests/misc-tests/007-subvolume-sync/test.sh | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 tests/misc-tests/007-subvolume-sync/test.sh diff --git a/tests/misc-tests/007-subvolume-sync/test.sh b/tests/misc-tests/007-subvolume-sync/test.sh new file mode 100755 index 0000000..d4019f4 --- /dev/null +++ b/tests/misc-tests/007-subvolume-sync/test.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# test btrfs subvolume run normally with more than one subvolume +# +# - btrfs subvolume must not loop indefinetelly +# - btrfs subvolume return 0 in normal case + +source $TOP/tests/common + +check_prereq mkfs.btrfs +check_prereq btrfs + +setup_root_helper +prepare_test_dev + +run_check $SUDO_HELPER $TOP/mkfs.btrfs -f "$TEST_DEV" +run_check $SUDO_HELPER mount "$TEST_DEV" "$TEST_MNT" + +# to check following thing in both 1 and multiple subvolume case: +# 1: is subvolume sync loop indefinetelly +# 2: is return value right +# +run_check $SUDO_HELPER $TOP/btrfs subvolume create "$TEST_MNT"/mysubvol1 +run_check $SUDO_HELPER $TOP/btrfs subvolume create "$TEST_MNT"/mysubvol2 +run_check $SUDO_HELPER $TOP/btrfs subvolume delete "$TEST_MNT"/mysubvol1 +run_check $SUDO_HELPER $TOP/btrfs subvolume delete "$TEST_MNT"/mysubvol2 +run_check $SUDO_HELPER $TOP/btrfs subvolume sync "$TEST_MNT" + +run_check $SUDO_HELPER $TOP/btrfs subvolume create "$TEST_MNT"/mysubvol +run_check $SUDO_HELPER $TOP/btrfs subvolume delete "$TEST_MNT"/mysubvol +run_check $SUDO_HELPER $TOP/btrfs subvolume sync "$TEST_MNT" + +run_check $SUDO_HELPER umount $TEST_MNT