Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests Add RZ(), which is like RL() except that it checks aga...



details:   https://anonhg.NetBSD.org/src/rev/752e2a3e9f09
branches:  trunk
changeset: 757474:752e2a3e9f09
user:      pooka <pooka%NetBSD.org@localhost>
date:      Tue Aug 31 17:21:14 2010 +0000

description:
Add RZ(), which is like RL() except that it checks against 0 and
uses the return value as the error number instead of errno.

diffstat:

 tests/h_macros.h |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (21 lines):

diff -r 62ac1555212a -r 752e2a3e9f09 tests/h_macros.h
--- a/tests/h_macros.h  Tue Aug 31 15:17:20 2010 +0000
+++ b/tests/h_macros.h  Tue Aug 31 17:21:14 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: h_macros.h,v 1.5 2010/08/16 17:01:43 pooka Exp $ */
+/* $NetBSD: h_macros.h,v 1.6 2010/08/31 17:21:14 pooka Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -44,6 +44,11 @@
        ATF_CHECK_MSG((x) != (v), "%s: %s", #x, strerror(errno))
 
 #define RL(x) REQUIRE_LIBC(x, -1)
+#define RZ(x)                                                          \
+do {                                                                   \
+       int RZ_rv = x;                                                  \
+       ATF_REQUIRE_MSG(RZ_rv == 0, "%s: %s", #x, strerror(RZ_rv));     \
+} while (/*CONSTCOND*/0)
 
 static __inline void
 atf_tc_fail_errno(const char *fmt, ...)



Home | Main Index | Thread Index | Old Index