[PATCH 1/2] tests/pc8+: Only skip i2c subtest if i2c /dev interface is unavailable

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

 



Through the magic of igt_skip we only need to fail this subtest, not
the entire thing.

Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
---
 tests/pc8.c | 35 +++++++++++++----------------------
 1 file changed, 13 insertions(+), 22 deletions(-)

diff --git a/tests/pc8.c b/tests/pc8.c
index 9070a6b..e93d928 100644
--- a/tests/pc8.c
+++ b/tests/pc8.c
@@ -580,10 +580,6 @@ static bool test_i2c(struct mode_set_data *data)
 
 static bool setup_environment(void)
 {
-	int i2c_dev_files;
-	DIR *dev_dir;
-	struct dirent *dirent;
-
 	drm_fd = drm_open_any();
 	if (drm_fd <= 0)
 		return false;
@@ -603,23 +599,6 @@ static bool setup_environment(void)
 		return false;
 	}
 
-	/* Make sure the /dev/i2c-* files exist. */
-	dev_dir = opendir("/dev");
-	if (!dev_dir) {
-		printf("Can't open /dev.\n");
-		return false;
-	}
-	i2c_dev_files = 0;
-	while ((dirent = readdir(dev_dir))) {
-		if (strncmp(dirent->d_name, "i2c-", 4) == 0)
-			i2c_dev_files++;
-	}
-	closedir(dev_dir);
-	if (!i2c_dev_files) {
-		printf("No /dev/i2c-* files.\n");
-		return false;
-	}
-
 	/* Non-ULT machines don't support PC8+. */
 	if (!supports_pc8_plus_residencies()) {
 		printf("Machine doesn't support PC8+ residencies.\n");
@@ -701,7 +680,19 @@ static void batch_subtest(void)
 /* Try to use raw I2C, which also needs interrupts. */
 static void i2c_subtest(void)
 {
-	printf("Testing raw i2c protocol calls.\n");
+	int i2c_dev_files = 0;
+	DIR *dev_dir;
+	struct dirent *dirent;
+
+	/* Make sure the /dev/i2c-* files exist. */
+	dev_dir = opendir("/dev");
+	igt_assert(dev_dir);
+	while ((dirent = readdir(dev_dir))) {
+		if (strncmp(dirent->d_name, "i2c-", 4) == 0)
+			i2c_dev_files++;
+	}
+	closedir(dev_dir);
+	igt_require(i2c_dev_files);
 
 	enable_one_screen(&ms_data);
 	igt_assert(pc8_plus_disabled());
-- 
1.8.3.2

_______________________________________________
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