From patchwork Wed Mar 18 18:10:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Tulak X-Patchwork-Id: 6042591 Return-Path: X-Original-To: patchwork-fstests@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 10835BF90F for ; Wed, 18 Mar 2015 18:11:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 33D6D2041F for ; Wed, 18 Mar 2015 18:11:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 453E620483 for ; Wed, 18 Mar 2015 18:11:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754773AbbCRSLd (ORCPT ); Wed, 18 Mar 2015 14:11:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54337 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754803AbbCRSLd (ORCPT ); Wed, 18 Mar 2015 14:11:33 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2IIBWUi012167 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 18 Mar 2015 14:11:33 -0400 Received: from jtulak.redhat.com (ovpn-200-19.brq.redhat.com [10.40.200.19]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2IIBNMB018231; Wed, 18 Mar 2015 14:11:32 -0400 From: =?UTF-8?q?Jan=20=C5=A4ul=C3=A1k?= To: fstests@vger.kernel.org Cc: =?UTF-8?q?Jan=20=C5=A4ul=C3=A1k?= Subject: [PATCH 6/6] new: environments - added to the skeleton in ./new script and README Date: Wed, 18 Mar 2015 19:10:30 +0100 Message-Id: <1426702230-22085-7-git-send-email-jtulak@redhat.com> In-Reply-To: <1426702230-22085-1-git-send-email-jtulak@redhat.com> References: <1426702230-22085-1-git-send-email-jtulak@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 New section in README file to shortly describe the environments. Adds support for environments into the skeleton generated by the ./new script, so new tests can easily opt-in into using the environments. Signed-off-by: Jan ?ulák --- README | 12 +++++++++++- new | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/README b/README index 0c9449a..2e14b6c 100644 --- a/README +++ b/README @@ -194,7 +194,17 @@ Test script environment: and the content of the NIS database if it is likely to be present) - 5. General recommendations, usage conventions, etc.: + 5. For setting up files and state of the filesystem before a test, + you can use environments. These scripts allows both sharing of the + set-up between tests, and running a single test in different + conditions (like empty and full filesystem). + In new tests, you can simply add them to a list at the beginning + of the test script (see "environments" directory for all available + environments). The skeleton created by ./new script already contains + everything necessary. + + + 6. General recommendations, usage conventions, etc.: - When the content of the password or group file is required, get it using the _cat_passwd and _cat_group functions, to ensure NIS information is included if NIS diff --git a/new b/new index 86f9075..62a051b 100755 --- a/new +++ b/new @@ -137,6 +137,15 @@ cat <$tdir/$id #----------------------------------------------------------------------- # +# List of environments this test can use for preparing files for the testing. +# They are independent of each other (multiple entries = multiple runs). +# If "none" is given, the test can be run without any environment, +# ommiting it signifies that the test won't run without any of them. +# +# Example: supported_environments="none empty_files full_partition" + +supported_environments="none" + seq=\`basename \$0\` seqres=\$RESULT_DIR/\$seq echo "QA output created by \$seq" @@ -163,8 +172,29 @@ _supported_fs generic _supported_os IRIX Linux _require_test -# if error -exit +run_test(){ + # If you don't set any environment at the beginning, + # this will do nothing. + _environment_require \$TEST_DIR + + # PUT TEST BELOW + + # if error + exit + + # PUT TEST ABOVE + _environment_clean \$TEST_DIR +} + + +# Filter the supported_environments by user input (-eo/-ex arguments) +# and run the test for all environments in the intersect of +# the supported and user-allowed environments. +for environment in \$(_filter_environments "\$supported_environments") +do + export ENV_NAME="\$environment" + run_test +done # optional stuff if your test has verbose output to help resolve problems #echo