From patchwork Wed Feb 24 12:10:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 8405751 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 940B5C0553 for ; Wed, 24 Feb 2016 12:11:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 96E002034E for ; Wed, 24 Feb 2016 12:11:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 69D3D2034C for ; Wed, 24 Feb 2016 12:11:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751803AbcBXMLF (ORCPT ); Wed, 24 Feb 2016 07:11:05 -0500 Received: from mx2.suse.de ([195.135.220.15]:56770 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750763AbcBXMLD (ORCPT ); Wed, 24 Feb 2016 07:11:03 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AC8CFADA9; Wed, 24 Feb 2016 12:11:00 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 44EC6DAB43; Wed, 24 Feb 2016 13:10:51 +0100 (CET) Date: Wed, 24 Feb 2016 13:10:51 +0100 From: David Sterba To: Qu Wenruo Cc: linux-btrfs@vger.kernel.org, dsterba@suse.cz Subject: Re: [PATCH 5/5] btrfs-progs: misc-test: Add regression test for find-root gives empty result Message-ID: <20160224121051.GB23746@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Qu Wenruo , linux-btrfs@vger.kernel.org References: <1456124397-21403-1-git-send-email-quwenruo@cn.fujitsu.com> <1456124397-21403-6-git-send-email-quwenruo@cn.fujitsu.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1456124397-21403-6-git-send-email-quwenruo@cn.fujitsu.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 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 On Mon, Feb 22, 2016 at 02:59:57PM +0800, Qu Wenruo wrote: > zA}GrL`3QeIdg)w^i(C5r-$jn2OSESOZGFpc5^m2cCgLRjc8Y&wBj@6PxG Mne-=t|1Sdn0?V+~RR910 > > literal 0 > HcmV?d00001 > > diff --git a/tests/misc-tests/012-find-root-no-result/test.sh b/tests/misc-tests/012-find-root-no-result/test.sh > new file mode 100644 > index 0000000..4951633 > --- /dev/null > +++ b/tests/misc-tests/012-find-root-no-result/test.sh > @@ -0,0 +1,20 @@ > +#!/bin/bash > +# Regression test for case btrfs-find-root may print no result on a > +# recent fs or balanced fs, whose metadata chunk is the first chunk > +# and the only metadata chunk > + > +source $TOP/tests/common > + > +check_prereq btrfs-find-root > +check_prereq btrfs-image > + > +$TOP/btrfs-image -r first_meta_chunk.btrfs-image test.img || \ > + _fail "failed to extract first_meta_chunk.btrfs-image" > + > +result=$($TOP/btrfs-find-root test.img | sed '/^Superblock/d') > + > +if [ -z "$result" ]; then > + _fail "btrfs-find-root failed to find tree root" > +fi > + > +rm test.img Applied with following fixups: --- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/tests/misc-tests/012-find-root-no-result/test.sh +++ b/tests/misc-tests/012-find-root-no-result/test.sh @@ -8,13 +8,17 @@ source $TOP/tests/common check_prereq btrfs-find-root check_prereq btrfs-image -$TOP/btrfs-image -r first_meta_chunk.btrfs-image test.img || \ +run_check $TOP/btrfs-image -r first_meta_chunk.btrfs-image test.img || \ _fail "failed to extract first_meta_chunk.btrfs-image" -result=$($TOP/btrfs-find-root test.img | sed '/^Superblock/d') +result=$(run_check_stdout $TOP/btrfs-find-root test.img | sed '/^Superblock/d') if [ -z "$result" ]; then _fail "btrfs-find-root failed to find tree root" fi +if ! echo "$result" | grep -q 'Found tree root at'; then + _fail "btrfs-find-root failed to find tree root, unexpected output" +fi + rm test.img