[PATCH i-g-t] tests/kms_sysfs_edid_timing: Create basic subtest
Kamil Konieczny <[email protected]>
| Newsgroups | org.freedesktop.lists.igt-dev |
|---|---|
| Message-ID | <[email protected]> |
Create a basic subtest for probing connectors, also adding an info about which connectors were probed. There is also a change when no GPU cards or drivers were present, in which case instead of failing test will skip. Signed-off-by: Kamil Konieczny <[email protected]> --- tests/kms_sysfs_edid_timing.c | 37 +++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/tests/kms_sysfs_edid_timing.c b/tests/kms_sysfs_edid_timing.c index 6dbd762e4..c04d286c2 100644 --- a/tests/kms_sysfs_edid_timing.c +++ b/tests/kms_sysfs_edid_timing.c @@ -37,7 +37,7 @@ #include <sys/stat.h> /** - * SUBTEST: + * SUBTEST: basic * Description: This test checks the time it takes to reprobe each connector and * fails if either the time it takes for one reprobe is too long or * if the mean time it takes to reprobe one connector is too long. @@ -57,32 +57,29 @@ IGT_TEST_DESCRIPTION("This test checks the time it takes to reprobe each " "make sure that the mean time for all connectors is " "not too long."); -int igt_simple_main() +static void reprobe_connectors(DIR *dirp) { - DIR *dirp; struct dirent *de; struct igt_mean all_mean; - dirp = opendir("/sys/class/drm"); - igt_assert(dirp != NULL); - igt_mean_init(&all_mean); - while ((de = readdir(dirp))) { struct igt_mean mean = {}; struct stat st; char path[PATH_MAX]; + bool checked; int i; if (*de->d_name == '.') - continue;; + continue; snprintf(path, sizeof(path), "/sys/class/drm/%s/status", - de->d_name); + de->d_name); if (stat(path, &st)) continue; + checked = false; igt_mean_init(&mean); for (i = 0; i < CHECK_TIMES; i++) { struct timespec ts = {}; @@ -92,6 +89,7 @@ int igt_simple_main() if ((fd = open(path, O_WRONLY)) < 0) continue; + checked = true; igt_kmsg(KMSG_DEBUG "%s: start detect\n", path); igt_nsec_elapsed(&ts); igt_ignore_warn(write(fd, "detect\n", 7)); @@ -111,6 +109,9 @@ int igt_simple_main() de->d_name, i, current/1e6, mean.max/1e6, mean.min/1e6); } + if (checked) + igt_info("Probed connector: %s\n", de->d_name); + igt_debug("%s: mean.max %.2fns, %.2fus, %.2fms, " "mean.avg %.2fns, %.2fus, %.2fms\n", de->d_name, @@ -134,6 +135,22 @@ int igt_simple_main() "Mean of all connector means exceeds %dms, max=%.2fms, mean=%.2fms\n", THRESHOLD_ALL_CONNECTORS_MEAN, all_mean.max / 1e6, all_mean.mean / 1e6); +} - closedir(dirp); +int igt_main() +{ + DIR *dirp; + + igt_fixture() { + dirp = opendir("/sys/class/drm"); + igt_require_f(dirp, "No DRM devices present\n"); + } + + igt_subtest("basic") + reprobe_connectors(dirp); + + igt_fixture() { + if (dirp) + closedir(dirp); + } } -- 2.55.0