public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/5] open_posix: add SAFE_PFUNC macro
@ 2016-02-19 10:03 Jan Stancek
  2016-02-19 10:03 ` [LTP] [PATCH 2/5] open_posix: condvar/schedule: use SAFE_PFUNC Jan Stancek
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Jan Stancek @ 2016-02-19 10:03 UTC (permalink / raw)
  To: ltp

Simple macro to exit test and print error if a pthread_* function
returned non-zero.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/open_posix_testsuite/include/safe_helpers.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 testcases/open_posix_testsuite/include/safe_helpers.h

diff --git a/testcases/open_posix_testsuite/include/safe_helpers.h b/testcases/open_posix_testsuite/include/safe_helpers.h
new file mode 100644
index 000000000000..655e158f65d0
--- /dev/null
+++ b/testcases/open_posix_testsuite/include/safe_helpers.h
@@ -0,0 +1,17 @@
+#ifndef __SAFE_MACROS_H__
+#define __SAFE_MACROS_H__
+
+#include <string.h>
+
+#define SAFE_PFUNC(op) \
+do {\
+	int ret = (op); \
+	if (ret != 0) { \
+		printf("Test %s unresolved: got %i (%s) on line %i\n  %s\n", \
+			__FILE__, ret, strerror(ret), __LINE__, #op); \
+		fflush(stdout); \
+		exit(PTS_UNRESOLVED); \
+	} \
+} while (0)
+
+#endif
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-02-23 12:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-19 10:03 [LTP] [PATCH 1/5] open_posix: add SAFE_PFUNC macro Jan Stancek
2016-02-19 10:03 ` [LTP] [PATCH 2/5] open_posix: condvar/schedule: use SAFE_PFUNC Jan Stancek
2016-02-22 13:42   ` Cyril Hrubis
2016-02-19 10:03 ` [LTP] [PATCH 3/5] open_posix: condvar/schedule: remove useless waiting Jan Stancek
2016-02-22 14:57   ` Cyril Hrubis
2016-02-19 10:03 ` [LTP] [PATCH 4/5] open_posix: condvar/schedule: remove duplicit setsched calls Jan Stancek
2016-02-22 15:38   ` Cyril Hrubis
2016-02-19 10:03 ` [LTP] [PATCH 5/5] open_posix: condvar/schedule: mask SIGALRM in SCHED_OTHER threads Jan Stancek
2016-02-22 16:09   ` Cyril Hrubis
2016-02-23  7:34     ` Jan Stancek
2016-02-23 10:00       ` Cyril Hrubis
2016-02-23 12:44         ` Jan Stancek
2016-02-22 13:35 ` [LTP] [PATCH 1/5] open_posix: add SAFE_PFUNC macro Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox