All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] open_posix: add SAFE_FUNC macro
@ 2017-12-04 15:10 Jan Stancek
  2017-12-04 15:10 ` [LTP] [PATCH 2/2] pthread_create-14-1: avoid threads sharing stack Jan Stancek
  2017-12-04 16:36 ` [LTP] [PATCH 1/2] open_posix: add SAFE_FUNC macro Cyril Hrubis
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Stancek @ 2017-12-04 15:10 UTC (permalink / raw)
  To: ltp

Similar macro to SAFE_PFUNC, but instead checks for ret value == -1,
and prints error from 'errno'.

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

diff --git a/testcases/open_posix_testsuite/include/safe_helpers.h b/testcases/open_posix_testsuite/include/safe_helpers.h
index 7f945a0280c2..4537fba12263 100644
--- a/testcases/open_posix_testsuite/include/safe_helpers.h
+++ b/testcases/open_posix_testsuite/include/safe_helpers.h
@@ -30,4 +30,15 @@ do {\
 	} \
 } while (0)
 
+#define SAFE_FUNC(op) \
+do {\
+	int ret = (op); \
+	if (ret == -1) { \
+		printf("Test %s unresolved: got %i (%s) on line %i\n  %s\n", \
+			__FILE__, ret, strerror(errno), __LINE__, #op); \
+		fflush(stdout); \
+		exit(PTS_UNRESOLVED); \
+	} \
+} while (0)
+
 #endif
-- 
1.8.3.1


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

end of thread, other threads:[~2017-12-06 13:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-04 15:10 [LTP] [PATCH 1/2] open_posix: add SAFE_FUNC macro Jan Stancek
2017-12-04 15:10 ` [LTP] [PATCH 2/2] pthread_create-14-1: avoid threads sharing stack Jan Stancek
2017-12-06 12:58   ` Cyril Hrubis
2017-12-06 13:08     ` Jan Stancek
2017-12-04 16:36 ` [LTP] [PATCH 1/2] open_posix: add SAFE_FUNC macro Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.