]> granicus.if.org Git - strace/commitdiff
tests: add error_msg_and_fail function to libtests
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 21 Jan 2016 23:46:43 +0000 (23:46 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 21 Jan 2016 23:46:43 +0000 (23:46 +0000)
* tests/tests.h (error_msg_and_fail): New prototype.
* tests/error_msg.c (error_msg_and_fail): New function.

tests/error_msg.c
tests/tests.h

index 3fd34113751a815b4c187146636851a0aa886541..498a88213e6890bb74d89de068bd85a6e316a536 100644 (file)
@@ -47,6 +47,17 @@ perror_msg_and_fail(const char *fmt, ...)
        exit(1);
 }
 
+void
+error_msg_and_fail(const char *fmt, ...)
+{
+       va_list p;
+
+       va_start(p, fmt);
+       vfprintf(stderr, fmt, p);
+       putc('\n', stderr);
+       exit(1);
+}
+
 void
 error_msg_and_skip(const char *fmt, ...)
 {
index c55b32961c6b607541f14db187d31cfe5582ab2f..513aa10cd622f59039af3291a4fcb410c1245e0f 100644 (file)
@@ -41,6 +41,9 @@ size_t get_page_size(void);
 /* Print message and strerror(errno) to stderr, then exit(1). */
 void perror_msg_and_fail(const char *, ...)
        ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
+/* Print message to stderr, then exit(1). */
+void error_msg_and_fail(const char *, ...)
+       ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
 /* Print message to stderr, then exit(77). */
 void error_msg_and_skip(const char *, ...)
        ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;