[PATCH] tests: Run igt.cocci

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
Cc: Matt Roper <matthew.d.roper@xxxxxxxxx>
Cc: Wendy Wang <wendy.wang@xxxxxxxxx>
Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
---
 tests/kms_plane.c           |  3 +--
 tests/kms_universal_plane.c |  8 +++-----
 tests/pm_rc6_residency.c    | 11 ++++-------
 3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index c3c0e5efbca4..93a05bb998b6 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -284,8 +284,7 @@ test_plane_panning_with_output(data_t *data,
 	drmModeModeInfo *mode;
 	igt_crc_t crc;
 
-	fprintf(stdout, "Testing connector %s using pipe %c plane %d\n",
-		igt_output_name(output), pipe_name(pipe), plane);
+	igt_info("Testing connector %s using pipe %c plane %d\n", igt_output_name(output), pipe_name(pipe), plane);
 
 	test_init(data, pipe);
 
diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c
index c64cdbb9d2ca..94d89b87e6c5 100644
--- a/tests/kms_universal_plane.c
+++ b/tests/kms_universal_plane.c
@@ -62,9 +62,8 @@ functional_test_init(functional_test_t *test, igt_output_t *output, enum pipe pi
 	drmModeModeInfo *mode;
 
 	test->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
-	if (!test->pipe_crc)
-		igt_skip("auto crc not supported on this connector with pipe %i\n",
-		       pipe);
+	igt_skip_on_f(!test->pipe_crc,
+		      "auto crc not supported on this connector with pipe %i\n", pipe);
 
 
 	igt_output_set_pipe(output, pipe);
@@ -136,8 +135,7 @@ functional_test_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
 	igt_assert(data->display.has_universal_planes);
 	igt_skip_on(pipe >= display->n_pipes);
 
-	fprintf(stdout, "Testing connector %s using pipe %c\n",
-		igt_output_name(output), pipe_name(pipe));
+	igt_info("Testing connector %s using pipe %c\n", igt_output_name(output), pipe_name(pipe));
 
 	functional_test_init(&test, output, pipe);
 
diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index d364369f8a73..8cf7be392340 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[])
-- 
2.0.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux