tests: add file:line to perror_msg_and_fail/error_msg_and_fail output

* tests/tests.h [!perror_msg_and_fail] (perror_msg_and_fail): New macro
wrapper around the homonymous function.
[!error_msg_and_fail] (error_msg_and_fail): Likewise.
* tests/error_msg.c (perror_msg_and_fail, error_msg_and_fail): New
macros defined to themselves.
This commit is contained in:
Дмитрий Левин 2018-01-23 21:17:05 +00:00
parent 7494f63faa
commit 030fae537f
2 changed files with 12 additions and 0 deletions

View File

@ -25,6 +25,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define perror_msg_and_fail perror_msg_and_fail
#define error_msg_and_fail error_msg_and_fail
#include "tests.h"
#include <errno.h>
#include <stdarg.h>

View File

@ -75,6 +75,15 @@ void error_msg_and_skip(const char *, ...)
void perror_msg_and_skip(const char *, ...)
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
#ifndef perror_msg_and_fail
# define perror_msg_and_fail(fmt_, ...) \
perror_msg_and_fail("%s:%d: " fmt_, __FILE__, __LINE__, ##__VA_ARGS__)
#endif
#ifndef perror_msg_and_fail
# define error_msg_and_fail(fmt_, ...) \
error_msg_and_fail("%s:%d: " fmt_, __FILE__, __LINE__, ##__VA_ARGS__)
#endif
/* Stat the specified file and skip the test if the stat call failed. */
void skip_if_unavailable(const char *);