summaryrefslogtreecommitdiff
path: root/tests/pm_rc6_residency.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-07-10 20:04:19 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-07-10 20:06:54 +0200
commit282482db70188a3cbc653cebbf407715373255d1 (patch)
tree37133f637f634c792b3eb9861d4d5d261e2b0192 /tests/pm_rc6_residency.c
parent329f7a3734331cb57895a675d4fc87c261f338bd (diff)
tests: Run igt.cocci
New stuff caught. Plus manually simplify the massive igt_fail_on_f(file == NULL, ...) to a simple igt_assert(file). We already print the errno (if applicapable) and the condition, which is equally informative. Cc: Yi Sun <yi.sun@intel.com> Cc: Matt Roper <matthew.d.roper@intel.com> Cc: Wendy Wang <wendy.wang@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'tests/pm_rc6_residency.c')
-rw-r--r--tests/pm_rc6_residency.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index d364369f..8cf7be39 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -45,10 +45,7 @@ static unsigned int readit(const char *path)
FILE *file;
file = fopen(path, "r");
- if (file == NULL) {
- fprintf(stderr, "Couldn't open %s (%d)\n", path, errno);
- abort();
- }
+ igt_assert(file);
scanned = fscanf(file, "%u", &ret);
igt_assert(scanned == 1);
@@ -113,7 +110,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;
@@ -125,12 +122,12 @@ static void rc6_residency_counter(int value[],const char *name_of_rc6_residency[
flag_support = flag_support << 1;
}
- printf("The residency counter: %f \n", counter_result);
+ igt_info("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]);
+ igt_info("This machine entry %s state.\n", name_of_rc6_residency[(flag_counter / 2) - 1]);
}
static void rc6_residency_check(int value[])