diff mbox

[4/4] pm_rps: New subtest min-max-config-loaded

Message ID 1390955106-29853-5-git-send-email-jeff.mcgee@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

jeff.mcgee@intel.com Jan. 29, 2014, 12:25 a.m. UTC
From: Jeff McGee <jeff.mcgee@intel.com>

Like subtest basic-api, but additionally requires that current
frequency is increasing to the configured maximum within reasonable
time since we are loaded.

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

Patch

diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index 555bb7c..709e341 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -371,6 +371,29 @@  static void idle_check(void)
 	log("Required %d msec to reach cur=min\n", wait);
 }
 
+#define LOADED_WAIT_TIMESTEP_MSEC 100
+#define LOADED_WAIT_TIMEOUT_MSEC 3000
+static void loaded_check(void)
+{
+	int freqs[NUMFREQ];
+	int wait = 0;
+
+	/* Monitor frequencies until cur increases to max, which should
+	 * happen within the allotted time */
+	do {
+		read_freqs(freqs);
+		dump(freqs);
+		checkit(freqs);
+		if (freqs[CUR] == freqs[MAX])
+			break;
+		usleep(1000 * LOADED_WAIT_TIMESTEP_MSEC);
+		wait += LOADED_WAIT_TIMESTEP_MSEC;
+	} while (wait < LOADED_WAIT_TIMEOUT_MSEC);
+
+	igt_assert(freqs[CUR] == freqs[MAX]);
+	log("Required %d msec to reach cur=max\n", wait);
+}
+
 static void pm_rps_exit_handler(int sig)
 {
 	if (origfreqs[MIN] > readval(stuff[MAX].filp)) {
@@ -456,5 +479,11 @@  int main(int argc, char **argv)
 	igt_subtest("min-max-config-idle")
 		min_max_config(idle_check);
 
+	igt_subtest("min-max-config-loaded") {
+		load_helper_run();
+		min_max_config(loaded_check);
+		load_helper_stop();
+	}
+
 	igt_exit();
 }