Commit 603929ca authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

zdtm: print correct errno messages from err() and fail()

"%m" can't be used to print strerror(errno), because test_msg()
calls gettimeofday() which can overwrite errno.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 55a7c7a7
...@@ -91,6 +91,7 @@ extern int parse_opt_string(char *param, void *arg); ...@@ -91,6 +91,7 @@ extern int parse_opt_string(char *param, void *arg);
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#define __stringify_1(x) #x #define __stringify_1(x) #x
#define __stringify(x) __stringify_1(x) #define __stringify(x) __stringify_1(x)
...@@ -99,11 +100,11 @@ extern int parse_opt_string(char *param, void *arg); ...@@ -99,11 +100,11 @@ extern int parse_opt_string(char *param, void *arg);
extern void setup_outfile(void); extern void setup_outfile(void);
extern int test_log_init(const char *outfile, const char *suffix); extern int test_log_init(const char *outfile, const char *suffix);
#define err(format, arg...) \ #define err(format, arg...) \
test_msg("ERR: %s:%d: " format " (errno = %d (%m))\n", \ test_msg("ERR: %s:%d: " format " (errno = %d (%s))\n", \
__FILE__, __LINE__, ## arg, errno) __FILE__, __LINE__, ## arg, errno, strerror(errno))
#define fail(format, arg...) \ #define fail(format, arg...) \
test_msg("FAIL: %s:%d: " format " (errno = %d (%m))\n", \ test_msg("FAIL: %s:%d: " format " (errno = %d (%s))\n", \
__FILE__, __LINE__, ## arg, errno) __FILE__, __LINE__, ## arg, errno, strerror(errno))
#define skip(format, arg...) \ #define skip(format, arg...) \
test_msg("SKIP: %s:%d: " format "\n", \ test_msg("SKIP: %s:%d: " format "\n", \
__FILE__, __LINE__, ## arg) __FILE__, __LINE__, ## arg)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment