diff mbox

[i-g-t,1/2] lib: use a critical warning when unable to open a data file

Message ID 1428943716-19775-1-git-send-email-thomas.wood@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Wood April 13, 2015, 4:48 p.m. UTC
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 lib/igt_core.c      | 5 +++++
 tests/testdisplay.c | 5 +----
 2 files changed, 6 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/lib/igt_core.c b/lib/igt_core.c
index daef8c6..700604f 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -1751,5 +1751,10 @@  FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir,
 		snprintf(path, sizeof(path), "%s/%s", igt_srcdir, filename);
 		fp = fopen(path, "r");
 	}
+
+	if (!fp)
+		igt_critical("Could not open data file \"%s\": %s", filename,
+			     strerror(errno));
+
 	return fp;
 }
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 92ea08c..58f56a3 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -262,11 +262,8 @@  static void paint_image(cairo_t *cr, const char *file)
 	img_x = (width / 2) - (img_w / 2);
 
 	fp = igt_fopen_data(file);
-	if (!fp) {
-                igt_warn("data file \'%s\' missing: %s\n",
-		         file, strerror(errno));
+	if (!fp)
                 return;
-	}
 	image = cairo_image_surface_create_from_png_stream(&stdio_read_func,
 							   (void*)fp);