From f0fa35b00462b96ce7da342f51eb1bad3e828cd8 Mon Sep 17 00:00:00 2001 From: "Hui, Chunyang" Date: Tue, 23 Feb 2021 12:54:58 +0000 Subject: [PATCH] Add errno info when return error in make test --- test/include/test.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/include/test.h b/test/include/test.h index 9af38aa7..496b866f 100644 --- a/test/include/test.h +++ b/test/include/test.h @@ -4,6 +4,8 @@ #include #include #include +#include +#include #define _STR(x) #x #define STR(x) _STR(x) @@ -21,8 +23,8 @@ typedef struct { #define TEST_CASE(name) { STR(name), name } #define THROW_ERROR(fmt, ...) do { \ - printf("\t\tERROR:" fmt " in func %s at line %d of file %s\n", \ - ##__VA_ARGS__, __func__, __LINE__, __FILE__); \ + printf("\t\tERROR:" fmt " in func %s at line %d of file %s with errno %d: %s\n", \ + ##__VA_ARGS__, __func__, __LINE__, __FILE__, errno, strerror(errno)); \ return -1; \ } while (0)