From patchwork Fri Feb 2 08:34:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gu Jinxiang X-Patchwork-Id: 10196391 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 1225960388 for ; Fri, 2 Feb 2018 08:34:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F30E628D69 for ; Fri, 2 Feb 2018 08:34:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E808028DB2; Fri, 2 Feb 2018 08:34:31 +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 746DC28DDF for ; Fri, 2 Feb 2018 08:34:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751514AbeBBIeW (ORCPT ); Fri, 2 Feb 2018 03:34:22 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:56066 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751129AbeBBIeU (ORCPT ); Fri, 2 Feb 2018 03:34:20 -0500 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="36673165" Received: from bogon (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 02 Feb 2018 16:34:17 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 7025949F19B8; Fri, 2 Feb 2018 16:34:15 +0800 (CST) Received: from ubuntu.g08.fujitsu.local (10.167.226.132) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 2 Feb 2018 16:34:13 +0800 From: Gu Jinxiang To: CC: , Subject: [RFC PATCH v2 1/4] btrfs-progs: Add package command for packaging tests Date: Fri, 2 Feb 2018 16:34:02 +0800 Message-ID: <1517560445-5712-2-git-send-email-gujx@cn.fujitsu.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1517560445-5712-1-git-send-email-gujx@cn.fujitsu.com> References: <1517560445-5712-1-git-send-email-gujx@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.132] X-yoursite-MailScanner-ID: 7025949F19B8.A5C91 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: gujx@cn.fujitsu.com 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 Export the testsuite files to a separate tar. Since fsck tests depend on btrfs-corrupt-block, and misc tests depends on both btrfs-corrupt-block and fssum, so set it as prerequisites for package commad. Because, althougth fssum can be generated by source that are all in tests directory, and has no rely on the btrfs's structure. But btrfs-corrupt-block deeply relys on btrfs's structure. For consistency, at the present stage, generete the two when create test tar. Signed-off-by: Gu Jinxiang --- Makefile | 4 ++++ tests/export-tests.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100755 tests/export-tests.sh diff --git a/Makefile b/Makefile index 6369e8f4..23decc4d 100644 --- a/Makefile +++ b/Makefile @@ -333,6 +333,10 @@ test-inst: all test: test-fsck test-mkfs test-convert test-misc test-fuzz test-cli +package: btrfs-corrupt-block fssum + @echo "Export tests as a package" + $(Q)bash tests/export-tests.sh + # # NOTE: For static compiles, you need to have all the required libs # static equivalent available diff --git a/tests/export-tests.sh b/tests/export-tests.sh new file mode 100755 index 00000000..d7f6ca17 --- /dev/null +++ b/tests/export-tests.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# export the testsuite files to a separate tar + +SCRIPT_DIR=$(dirname $(readlink -f "$0")) +TESTDIR=$(basename $SCRIPT_DIR) +FSSUM=fssum +CORRUPT=btrfs-corrupt-block +DESTNAME="tests.tar.gz" +DESTDIR="." + +test -n "$EXPORT" && DESTDIR=$(realpath "$EXPORT") +if [ ! -d $DESTDIR ]; then + echo "dest directory is not exsit." + exit 1 +fi + +DEST=$DESTDIR/$DESTNAME + +if [ -f $DEST ];then + echo "remove exsit package: " $DEST + rm $DEST +fi + +echo "begin create tar: " $DEST +tar --exclude-vcs-ignores -zScf $DEST $TESTDIR $FSSUM $CORRUPT +if [ $? -eq 0 ]; then + echo "create tar successfully." +fi