diff mbox

[3/4] pm_rps: Fix test to target original min and max

Message ID 1389388353-29980-4-git-send-email-jeff.mcgee@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

jeff.mcgee@intel.com Jan. 10, 2014, 9:12 p.m. UTC
From: Jeff McGee <jeff.mcgee@intel.com>

The goal of the test is to confirm that gt_cur_freq_mhz can be forced
to the boundaries of the frequency range by collapsing gt_min_freq_mhz
and gt_max_freq_mhz to the target value. But we miss testing the upper
end of the range by targetting the current value of max after it has
been set equal to min. So fix by targetting orginal max instead of
current max.

This correction exposes a problem in setfreq where min is always set
to target before max, which should fail if the target value is greater
than max. So fix that too.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
---
 tests/pm_rps.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index 69eeb81..c968ecb 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -101,8 +101,13 @@  static int do_writeval(FILE *filp, int val, int lerrno)
 
 static void setfreq(int val)
 {
-	writeval(stuff[MIN].filp, val);
-	writeval(stuff[MAX].filp, val);
+	if (val > fmax) {
+		writeval(stuff[MAX].filp, val);
+		writeval(stuff[MIN].filp, val);
+	} else {
+		writeval(stuff[MIN].filp, val);
+		writeval(stuff[MAX].filp, val);
+	}
 }
 
 static void checkit(void)
@@ -166,11 +171,11 @@  igt_simple_main
 		dumpit();
 
 	checkit();
-	setfreq(fmin);
+	setfreq(origmin);
 	if (verbose)
 		dumpit();
 	restore_assert(fcur == fmin);
-	setfreq(fmax);
+	setfreq(origmax);
 	if (verbose)
 		dumpit();
 	restore_assert(fcur == fmax);