From patchwork Wed Mar 6 15:21:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Hrubis X-Patchwork-Id: 1052387 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=none (p=none dis=none) header.from=ucw.cz 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 44DyD24h2rz9s9N for ; Thu, 7 Mar 2019 02:21:54 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 431403EADBA for ; Wed, 6 Mar 2019 16:21:50 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) by picard.linux.it (Postfix) with ESMTP id 1E6E93EA05E for ; Wed, 6 Mar 2019 16:21:40 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 3102B100157E for ; Wed, 6 Mar 2019 16:21:37 +0100 (CET) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id CD236AFBE; Wed, 6 Mar 2019 15:21:38 +0000 (UTC) From: Cyril Hrubis To: ltp@lists.linux.it Date: Wed, 6 Mar 2019 16:21:03 +0100 Message-Id: <20190306152104.24828-1-metan@ucw.cz> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-4.smtp.seeweb.it Cc: Mark Salyzyn Subject: [LTP] [RFC PATCH 1/2] tst_test: Add test multiplex function 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" From: Cyril Hrubis The test multiplex function is intended for running the test function in a loop for a different settings. The indended purpose is to run tests for both libc wrapper and raw syscall as well as for different syscall variants. The commit itself adds a test_multiplex() function into the tst_test structure, if set this function is called in a loop before each test iteration and is responsible for changing the test variant into next one. The iterations continue until the function returns zero. Signed-off-by: Cyril Hrubis CC: Mark Salyzyn CC: Steve Muckle CC: Jan Stancek --- include/tst_test.h | 14 ++++++++++++++ lib/tst_test.c | 11 +++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/include/tst_test.h b/include/tst_test.h index da41f776d..b747b24d5 100644 --- a/include/tst_test.h +++ b/include/tst_test.h @@ -146,6 +146,20 @@ struct tst_test { */ int all_filesystems:1; + /* + * If set this function is used to mutiplex between different test + * variants. + * + * Multiplexers are the way how to run the same test for different + * settings. The intended use is to test different syscall + * wrappers/variants but the API is generic and does not limit the + * usage in any way. + * + * Each time the function is called it switches to next test variant, + * returns zero if all variants has been iterated over. + */ + int (*test_multiplex)(void); + /* Minimal device size in megabytes */ unsigned int dev_min_size; diff --git a/lib/tst_test.c b/lib/tst_test.c index 7dd890b8d..6b033c879 100644 --- a/lib/tst_test.c +++ b/lib/tst_test.c @@ -1009,8 +1009,15 @@ static void testrun(void) if (!cont) break; - run_tests(); - heartbeat(); + if (tst_test->test_multiplex) { + while (tst_test->test_multiplex()) { + run_tests(); + heartbeat(); + } + } else { + run_tests(); + heartbeat(); + } } do_test_cleanup();