]> www.infradead.org Git - mtd-utils.git/commitdiff
fs-tests: integck: check errno in pvc macro
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tue, 3 May 2011 12:02:58 +0000 (15:02 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 20 May 2011 09:48:41 +0000 (12:48 +0300)
All errors but write errors have corresponding CHECK(), so if something
gets wrong we fail. But in case of I/O errors we do not fail if an
unexpected error happens, which makes it difficult to trace issues.
Inject the errno checking to the pvc macro to make sure we fail if
errno is not EROFS.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
tests/fs-tests/integrity/integck.c

index 1b08acc114bda14ffbd99722216cbbc83cf000c4..b411a68ab73fa9fe2f882b2baca41940143983f2 100644 (file)
                check_failed(stringify(cond), __func__, __FILE__, __LINE__); \
 } while(0)
 
+#define CHECK_ERRNO() do {                                                   \
+       if (args.power_cut_mode)                                             \
+               CHECK(errno == EROFS);                                       \
+       else                                                                 \
+               CHECK(0);                                                    \
+} while(0)
+
 #define pcv(fmt, ...) do {                                                   \
        if (!args.power_cut_mode || (args.power_cut_mode && args.verbose))   \
                normsg(fmt " (line %d, error %d (%s))",                      \
                       ##__VA_ARGS__, __LINE__, errno, strerror(errno));     \
-       if (!args.power_cut_mode)                                            \
-               CHECK(0);                                                    \
+       CHECK_ERRNO();                                                       \
 } while(0)
 
 /* The variables below are set by command line arguments */