aboutsummaryrefslogtreecommitdiff
path: root/tests/fs-tests
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-26 14:58:26 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-27 15:55:08 +0300
commitc0f504fec29666a1b7e4e26fb22bdd72ca561185 (patch)
tree478ad00bd1795a367a8c2fb9d08708d7347258f2 /tests/fs-tests
parenta6c05d9a6033f04ded278e29b71c46a98efd6bf3 (diff)
fs-tests: integck: print error message on error
Currently pcv macro print the error message only if we are not doing power cut testing or if we have -v flag. But if we run without -v and an error happen and the error code is not EROFS/EIO, pcv() does not print anything. This patch makes it print the error message in that case as well. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'tests/fs-tests')
-rw-r--r--tests/fs-tests/integrity/integck.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index 8b1fb40..e2a878f 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -70,27 +70,22 @@
check_failed(stringify(cond), __func__, __FILE__, __LINE__); \
} while(0)
-#define CHECK_ERRNO() do { \
- if (args.power_cut_mode) \
- /* \
- * In case of emulated power cut failures the FS has to \
- * return EROFS. But unfortunately, the Linux kernel \
- * sometimes returns EIO to user-space anyway (when write- \
- * back fails the return code is awayse EIO). \
- */ \
- CHECK(errno == EROFS || errno == EIO); \
- else \
- CHECK(0); \
-} while(0)
-
+/*
+ * In case of emulated power cut failures the FS has to return EROFS. But
+ * unfortunately, the Linux kernel sometimes returns EIO to user-space anyway
+ * (when write-back fails the return code is awayse EIO).
+ */
#define pcv(fmt, ...) do { \
- if (!args.power_cut_mode || args.verbose) \
+ int __err = 1; \
+ if (args.power_cut_mode && (errno == EROFS || errno == EIO)) \
+ __err = 0; \
+ if (!args.power_cut_mode || args.verbose || __err) \
normsg(fmt " (line %d, error %d (%s))", \
##__VA_ARGS__, __LINE__, errno, strerror(errno)); \
- CHECK_ERRNO(); \
+ CHECK(!__err); \
} while(0)
-#define v(fmt, ...) do { \
+#define v(fmt, ...) do { \
if (args.verbose) \
normsg(fmt " (line %d)", ##__VA_ARGS__, __LINE__); \
} while(0)