public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: jeff.mcgee@intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 1/4] pm_rps: Expand on min and max config testing
Date: Tue, 21 Jan 2014 17:14:31 -0600	[thread overview]
Message-ID: <1390346074-15774-2-git-send-email-jeff.mcgee@intel.com> (raw)
In-Reply-To: <1390346074-15774-1-git-send-email-jeff.mcgee@intel.com>

From: Jeff McGee <jeff.mcgee@intel.com>

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 <jeff.mcgee@intel.com>
---
 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();
 }
-- 
1.8.5.2

  reply	other threads:[~2014-01-21 23:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-21 23:14 Expansion of pm_rps subtest min-max-config-at-idle jeff.mcgee
2014-01-21 23:14 ` jeff.mcgee [this message]
2014-01-21 23:14 ` [PATCH 2/4] pm_rps: Remove repeat sysfs reads jeff.mcgee
2014-01-21 23:14 ` [PATCH 3/4] pm_rps: Make frequency logging more compact jeff.mcgee
2014-01-21 23:14 ` [PATCH 4/4] pm_rps: Require that cur reaches min at idle jeff.mcgee
2014-01-23 10:40   ` Daniel Vetter
2014-01-23 17:15     ` Jeff McGee
2014-01-23 18:49       ` Daniel Vetter
2014-01-23 20:24         ` Jeff McGee
2014-01-23 21:54           ` [PATCH 4/4 v2] " jeff.mcgee
2014-01-25 19:46             ` Daniel Vetter
2014-01-27 16:24               ` Jeff McGee
2014-01-27 16:50                 ` Daniel Vetter
2014-01-27 22:23                   ` Jeff McGee
2014-01-27 22:39                     ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1390346074-15774-2-git-send-email-jeff.mcgee@intel.com \
    --to=jeff.mcgee@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox