From patchwork Thu May 30 10:23:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murphy Zhou X-Patchwork-Id: 1107690 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45F3b31GXMz9s1c for ; Thu, 30 May 2019 20:23:58 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id EA73A3EA65D for ; Thu, 30 May 2019 12:23:54 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [217.194.8.2]) by picard.linux.it (Postfix) with ESMTP id EA6D73EA166 for ; Thu, 30 May 2019 12:23:52 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id 85A526012CD for ; Thu, 30 May 2019 12:23:52 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1BE0430C4F49; Thu, 30 May 2019 10:23:51 +0000 (UTC) Received: from localhost (dhcp-12-130.nay.redhat.com [10.66.12.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id B33465F9BA; Thu, 30 May 2019 10:23:48 +0000 (UTC) From: Murphy Zhou To: ltp@lists.linux.it Date: Thu, 30 May 2019 18:23:35 +0800 Message-Id: <20190530102336.10898-1-xzhou@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 30 May 2019 10:23:51 +0000 (UTC) X-Virus-Scanned: clamav-milter 0.99.2 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH 1/2] lib/tst_test: introduce tst_test->some_filesystems X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Like all_filesystems, some_filesystems option let tcase to run on specific filesystems. In order to implement this, change run_tcases_per_fs to accept a parameter indicating which filesystems need to test. To let tcase use this option, we need some other flags set Eg: static char *some_filesystems[] = {"ext4", "xfs", "btrfs"}; .mount_device = 0, .needs_device = 1, .format_device = 1, .mntpoint = MNTPOINT, .some_filesystems = some_filesystems, Signed-off-by: Murphy Zhou --- include/tst_test.h | 1 + lib/tst_test.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/tst_test.h b/include/tst_test.h index e4b935c45..8dc4fb6b4 100644 --- a/include/tst_test.h +++ b/include/tst_test.h @@ -137,6 +137,7 @@ struct tst_test { * to the test function. */ int all_filesystems:1; + char **some_filesystems; /* * If set non-zero denotes number of test variant, the test is executed diff --git a/lib/tst_test.c b/lib/tst_test.c index 2d88adbd7..72260f027 100644 --- a/lib/tst_test.c +++ b/lib/tst_test.c @@ -867,7 +867,7 @@ static void do_setup(int argc, char *argv[]) else tdev.fs_type = tst_dev_fs_type(); - if (!tst_test->all_filesystems) + if (!tst_test->all_filesystems && !tst_test->some_filesystems) prepare_device(); } @@ -1143,11 +1143,11 @@ static int fork_testrun(void) return 0; } -static int run_tcases_per_fs(void) +static int run_tcases_per_fs(char **fses) { int ret = 0; unsigned int i; - const char *const *filesystems = tst_get_supported_fs_types(); + const char *const *filesystems = fses; if (!filesystems[0]) tst_brk(TCONF, "There are no supported filesystems"); @@ -1202,8 +1202,11 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self) for (tst_variant = 0; tst_variant < test_variants; tst_variant++) { if (tst_test->all_filesystems) - ret |= run_tcases_per_fs(); - else + ret |= run_tcases_per_fs(tst_get_supported_fs_types()); + else if (tst_test->some_filesystems) { + tst_test->mount_device = 1; + ret |= run_tcases_per_fs(tst_test->some_filesystems); + } else ret |= fork_testrun(); if (ret & ~(TCONF))