From patchwork Tue Jan 21 23:14:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jeff.mcgee@intel.com X-Patchwork-Id: 3521001 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 275B0C02DC for ; Tue, 21 Jan 2014 23:08:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4862220122 for ; Tue, 21 Jan 2014 23:08:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7505620117 for ; Tue, 21 Jan 2014 23:08:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 83985FAF31; Tue, 21 Jan 2014 15:08:03 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id B4F40FAD23 for ; Tue, 21 Jan 2014 15:07:51 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 21 Jan 2014 15:07:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,697,1384329600"; d="scan'208";a="462523459" Received: from jeffdesk.fso.intel.com ([10.5.53.1]) by fmsmga001.fm.intel.com with ESMTP; 21 Jan 2014 15:07:50 -0800 From: jeff.mcgee@intel.com To: intel-gfx@lists.freedesktop.org Date: Tue, 21 Jan 2014 17:14:31 -0600 Message-Id: <1390346074-15774-2-git-send-email-jeff.mcgee@intel.com> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1390346074-15774-1-git-send-email-jeff.mcgee@intel.com> References: <1390346074-15774-1-git-send-email-jeff.mcgee@intel.com> Subject: [Intel-gfx] [PATCH 1/4] pm_rps: Expand on min and max config testing X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 From: Jeff McGee Add a function that methodically varies min and max to exercise several valid and invalid combinations. Allow the caller to define what is to be checked between each step. Signed-off-by: Jeff McGee --- tests/pm_rps.c | 106 +++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 77 insertions(+), 29 deletions(-) diff --git a/tests/pm_rps.c b/tests/pm_rps.c index f7f119c..e5cbfd1 100644 --- a/tests/pm_rps.c +++ b/tests/pm_rps.c @@ -134,6 +134,81 @@ static void dumpit(void) #define dump() if (verbose) dumpit() #define log(...) if (verbose) printf(__VA_ARGS__) +static void min_max_config(void (*check)(void)) +{ + int fmid = (frpn + frp0) / 2; + + log("Check original min and max...\n"); + check(); + + log("Set min=RPn and max=RP0...\n"); + writeval(stuff[MIN].filp, frpn); + writeval(stuff[MAX].filp, frp0); + check(); + + log("Increase min to midpoint...\n"); + writeval(stuff[MIN].filp, fmid); + check(); + + log("Increase min to RP0...\n"); + writeval(stuff[MIN].filp, frp0); + check(); + + log("Increase min above RP0 (invalid)...\n"); + writeval_inval(stuff[MIN].filp, frp0 + 1000); + check(); + + log("Decrease max to RPn (invalid)...\n"); + writeval_inval(stuff[MAX].filp, frpn); + check(); + + log("Decrease min to midpoint...\n"); + writeval(stuff[MIN].filp, fmid); + check(); + + log("Decrease min to RPn...\n"); + writeval(stuff[MIN].filp, frpn); + check(); + + log("Decrease min below RPn (invalid)...\n"); + writeval_inval(stuff[MIN].filp, 0); + check(); + + log("Decrease max to midpoint...\n"); + writeval(stuff[MAX].filp, fmid); + check(); + + log("Decrease max to RPn...\n"); + writeval(stuff[MAX].filp, frpn); + check(); + + log("Decrease max below RPn (invalid)...\n"); + writeval_inval(stuff[MAX].filp, 0); + check(); + + log("Increase min to RP0 (invalid)...\n"); + writeval_inval(stuff[MIN].filp, frp0); + check(); + + log("Increase max to midpoint...\n"); + writeval(stuff[MAX].filp, fmid); + check(); + + log("Increase max to RP0...\n"); + writeval(stuff[MAX].filp, frp0); + check(); + + log("Increase max above RP0 (invalid)...\n"); + writeval_inval(stuff[MAX].filp, frp0 + 1000); + check(); +} + +static void idle_check(void) +{ + dump(); + checkit(); +} + static void pm_rps_exit_handler(int sig) { if (origmin > fmax) { @@ -210,35 +285,8 @@ int main(int argc, char **argv) igt_install_exit_handler(pm_rps_exit_handler); } - igt_subtest("min-max-config-at-idle") { - log("Original min = %d\nOriginal max = %d\n", origmin, origmax); - - dump(); - - checkit(); - setfreq(origmin); - dump(); - igt_assert(fcur == fmin); - setfreq(origmax); - dump(); - igt_assert(fcur == fmax); - checkit(); - - /* And some errors */ - writeval_inval(stuff[MIN].filp, frpn - 1); - writeval_inval(stuff[MAX].filp, frp0 + 1000); - checkit(); - - writeval_inval(stuff[MIN].filp, fmax + 1000); - writeval_inval(stuff[MAX].filp, fmin - 1); - checkit(); - - writeval_inval(stuff[MIN].filp, 0x11111110); - writeval_inval(stuff[MAX].filp, 0); - - writeval(stuff[MIN].filp, origmin); - writeval(stuff[MAX].filp, origmax); - } + igt_subtest("min-max-config-at-idle") + min_max_config(idle_check); igt_exit(); }