pm_rps: Add read back checking on sysfs writes
authorJeff McGee <jeff.mcgee@intel.com>
Fri, 17 Jan 2014 22:56:04 +0000 (16:56 -0600)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Sat, 18 Jan 2014 14:17:16 +0000 (15:17 +0100)
Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
tests/pm_rps.c

index 7c739b6..ec07dd2 100644 (file)
@@ -68,15 +68,20 @@ static int readval(FILE *filp)
 
 static int do_writeval(FILE *filp, int val, int lerrno)
 {
-       int ret;
+       int ret, orig;
+
+       orig = readval(filp);
        rewind(filp);
        ret = fprintf(filp, "%d", val);
+
        if (lerrno) {
                /* Expecting specific error */
                igt_assert(ret == EOF && errno == lerrno);
+               igt_assert(readval(filp) == orig);
        } else {
                /* Expecting no error */
                igt_assert(ret != EOF);
+               igt_assert(readval(filp) == val);
        }
 
        return ret;