[Intel-gfx] [PATCH] Fix the comments for igt case: pm_rc6_residency

Wendy Wang wendy.wang at intel.com
Wed Jun 18 09:39:36 CEST 2014


1. Replace abort() with igt_exit()
2. Combine two subtests(rc6_residency_check and rc6_residency_counter)
 into one subtest(residency_accuracy)
3. Replace printf with igt_info(f...)

Test result on multi platforms:
[root at x-bdw01 power]# ./pm_rc6_residency
IGT-Version: 1.7-gf2fcec6 (x86_64)
(Linux: 3.15.0-rc8_drm-intel-nightly_b438e8_20140615+ x86_64)
This machine doesn't support rc6pp
This machine doesn't support rc6p
This machine entry into rc6 state
The residency counter: 0.994333
Subtest residency-accuracy: SUCCESS

[root at x-byt06: power]# ./pm_rc6_residency
IGT-Version: 1.7-gf2fcec6 (x86_64)
(Linux: 3.15.0-rc8_drm-intel-next-queued_27b6c1_20140618+ x86_64)
This machine doesn't support rc6pp
This machine doesn't support rc6p
This machine entry into rc6 state
The residency counter: 1.144333
Test assertion failure function residency_accuracy, file pm_rc6_residency.c:141:
Last errno: 0, Success
Failed assertion: (flag_counter != 0) && (counter_result <=1)
Sysfs RC6 residency counter is inaccurate
Subtest residency-accuracy: FAIL

[root at x-hswu32 home]# ./pm_rc6_residency
IGT-Version: 1.7-gf2fcec6 (x86_64)
(Linux: 3.15.0-rc8_drm-intel-nightly_e9ce9f_20140617+ x86_64)
This machine doesn't support rc6pp
This machine doesn't support rc6p
This machine entry into rc6 state
The residency counter: 1.004333
Test assertion failure function residency_accuracy, file pm_rc6_residency.c:141:
Last errno: 0, Success
Failed assertion: (flag_counter != 0) && (counter_result <=1)
Sysfs RC6 residency counter is inaccurate
Subtest residency-accuracy: FAIL

[root at x-ivb16 power]# ./pm_rc6_residency
IGT-Version: 1.7-gf2fcec6 (x86_64)
(Linux: 3.15.0-rc8_drm-intel-nightly_fff6c5_20140618+ x86_64)
This machine doesn't support rc6pp
This machine entry into rc6p state
The residency counter: 0.993333
Subtest residency-accuracy: SUCCESS

[root at x-ivb16 power]# ./pm_rc6_residency --list
residency-accuracy

[root at x-ivb16 power]# ./pm_rc6_residency --run-subtest residency-accuracy
IGT-Version: 1.7-gf2fcec6 (x86_64)
(Linux: 3.15.0-rc8_drm-intel-nightly_fff6c5_20140618+ x86_64)
This machine doesn't support rc6pp
This machine entry into rc6p state
The residency counter: 0.993667
Subtest residency-accuracy: SUCCESS

Signed-off-by: Wendy Wang <wendy.wang at intel.com>

diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index d364369..0945364 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -47,7 +47,7 @@ static unsigned int readit(const char *path)
 	file = fopen(path, "r");
 	if (file == NULL) {
 		fprintf(stderr, "Couldn't open %s (%d)\n", path, errno);
-		abort();
+		igt_exit();
 	}
 	scanned = fscanf(file, "%u", &ret);
 	igt_assert(scanned == 1);
@@ -90,14 +90,24 @@ static void read_rc6_residency( int value[], const char *name_of_rc6_residency[]
 	free(path);
 }
 
-static void rc6_residency_counter(int value[],const char *name_of_rc6_residency[])
+static void residency_accuracy(int value[],const char *name_of_rc6_residency[])
 {
 	int flag;
 	unsigned int flag_counter,flag_support;
 	double counter_result = 0;
+	unsigned int diff;
 	flag_counter = 0;
 	flag_support = 0;
 
+	diff = (value[3] - value[0]) +
+			(value[4] - value[1]) +
+			(value[5] - value[2]);
+
+	igt_assert_f(diff <= (SLEEP_DURATION + RC6_FUDGE),"Diff was too high. That is unpossible\n");
+	igt_assert_f(diff >= (SLEEP_DURATION - RC6_FUDGE),"GPU was not in RC6 long enough. Check that "
+							"the GPU is as idle as possible(ie. no X, "
+							"running and running no other tests)\n");
+
 	for(flag = NUMBER_OF_RC6_RESIDENCY-1; flag >= 0; flag --)
 	{
 		unsigned int  tmp_counter, tmp_support;
@@ -113,7 +123,7 @@ static void rc6_residency_counter(int value[],const char *name_of_rc6_residency[
 
 		if( value [flag + 3] == 0){
 			tmp_support = 0;
-			printf("This machine doesn't support %s\n",name_of_rc6_residency[flag]);
+			igt_info("This machine doesn't support %s\n",name_of_rc6_residency[flag]);
 		}
 		else
 			tmp_support = 1;
@@ -124,26 +134,11 @@ static void rc6_residency_counter(int value[],const char *name_of_rc6_residency[
 		flag_support = flag_support + tmp_support;
 		flag_support = flag_support << 1;
 	}
+	igt_info("This machine entry into %s state\n", name_of_rc6_residency[(flag_counter / 2) - 1]);
+	igt_info("The residency counter: %f \n", counter_result);
 
-	printf("The residency counter: %f \n", counter_result);
-
-	igt_skip_on_f(flag_support == 0 , "This machine didn't entry any RC6 state.\n");
-	igt_assert_f((flag_counter != 0) && (counter_result <=1) , "Sysfs RC6 residency counter is inaccurate.\n");
-
-	printf("This machine entry %s state.\n", name_of_rc6_residency[(flag_counter / 2) - 1]);
-}
-
-static void rc6_residency_check(int value[])
-{
-	unsigned int diff;
-	diff = (value[3] - value[0]) +
-			(value[4] - value[1]) +
-			(value[5] - value[2]);
-
-	igt_assert_f(diff <= (SLEEP_DURATION + RC6_FUDGE),"Diff was too high. That is unpossible\n");
-	igt_assert_f(diff >= (SLEEP_DURATION - RC6_FUDGE),"GPU was not in RC6 long enough. Check that "
-							"the GPU is as idle as possible(ie. no X, "
-							"running and running no other tests)\n");
+	igt_skip_on_f(flag_support == 0 , "This machine didn't entry into any RC6 state\n");
+	igt_assert_f((flag_counter != 0) && (counter_result <=1) , "Sysfs RC6 residency counter is inaccurate\n");
 }
 
 igt_main
@@ -162,9 +157,6 @@ igt_main
 		read_rc6_residency(value, name_of_rc6_residency);
 	}
 
-	igt_subtest("rc6-residency-check")
-		rc6_residency_check(value);
-
-	igt_subtest("rc6-residency-counter")
-		rc6_residency_counter(value, name_of_rc6_residency);
+	igt_subtest("residency-accuracy")
+		residency_accuracy(value, name_of_rc6_residency);
 }
-- 
1.8.3.1




More information about the Intel-gfx mailing list