From de9d98bb6e8736907458a28921aee5fcc507ca6d Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Thu, 12 Apr 2012 23:12:24 +0200 Subject: [PATCH] tests: skip rc6_residency test if not supported Fixes spurious failures. Signed-Off-by: Daniel Vetter --- tests/sysfs_rc6_residency.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/sysfs_rc6_residency.c b/tests/sysfs_rc6_residency.c index 3fcdbeb..2f33697 100644 --- a/tests/sysfs_rc6_residency.c +++ b/tests/sysfs_rc6_residency.c @@ -57,6 +57,7 @@ int main(int argc, char *argv[]) char *path, *pathp, *pathpp; int fd, ret; unsigned int value1, value1p, value1pp, value2, value2p, value2pp; + FILE *file; int diff; /* Use drm_open_any to verify device existence */ @@ -70,6 +71,13 @@ int main(int argc, char *argv[]) * Let's add a sleept just to make it happy. */ sleep(5); + file = fopen(path, "r"); + if (!file) { + printf("kernel too old or rc6 not supported on this platform.\n"); + exit(77); + } + + /* claim success if no rc6 enabled. */ if (readit(path) == 0) exit(EXIT_SUCCESS); -- 2.7.4