ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Cc: Jan Kara <jack@suse.cz>, Matthew Bobrowski <repnop@google.com>
Subject: [LTP] [PATCH 1/3] tst_test_macros: Add TST_EXP_FD_ERRNO
Date: Tue,  6 Sep 2022 11:26:13 +0200	[thread overview]
Message-ID: <20220906092615.15116-2-pvorel@suse.cz> (raw)
In-Reply-To: <20220906092615.15116-1-pvorel@suse.cz>

Combine TST_EXP_FD() and TST_EXP_FAIL().

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 include/tst_test_macros.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h
index 2e7b7871c..a2dfaac13 100644
--- a/include/tst_test_macros.h
+++ b/include/tst_test_macros.h
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2015-2020 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) Linux Test Project, 2021-2022
  */
 
 #ifndef TST_TEST_MACROS_H__
@@ -93,6 +94,15 @@ extern void *TST_RET_PTR;
 				#SCALL, ##__VA_ARGS__);                        \
 	} while (0)
 
+#define TST_EXP_FD_ERRNO(SCALL, ERRNO, ...)                                    \
+	do {                                                                   \
+		if (ERRNO)                                                     \
+			TST_EXP_FAIL(SCALL, ERRNO, ##__VA_ARGS__);             \
+		else                                                           \
+			TST_EXP_FD(SCALL, ##__VA_ARGS__);                      \
+		                                                               \
+	} while (0)
+
 #define TST_EXP_PID_SILENT(SCALL, ...)	TST_EXP_POSITIVE_(SCALL, #SCALL, ##__VA_ARGS__)
 
 #define TST_EXP_PID(SCALL, ...)                                                \
-- 
2.37.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-09-06  9:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06  9:26 [LTP] [PATCH 0/3] fanotify{14,20}: cleanup Petr Vorel
2022-09-06  9:26 ` Petr Vorel [this message]
2022-09-06  9:26 ` [LTP] [PATCH 2/3] fanotify20: Simplify code Petr Vorel
2022-09-06  9:55   ` Amir Goldstein
2022-09-06 15:54     ` Petr Vorel
2022-09-06 16:14       ` Petr Vorel
2022-09-07  7:05   ` Matthew Bobrowski via ltp
2022-09-07 10:49     ` Petr Vorel
2022-09-06  9:26 ` [LTP] [PATCH 3/3] fanotify14: Use TST_EXP_FD_ERRNO() Petr Vorel
2022-09-06 10:13   ` Amir Goldstein
2022-09-06 15:56     ` Petr Vorel
2022-09-07  7:17   ` Matthew Bobrowski via ltp
2022-09-07  7:24 ` [LTP] [PATCH 0/3] fanotify{14,20}: cleanup Matthew Bobrowski via ltp
2022-09-07 11:05   ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220906092615.15116-2-pvorel@suse.cz \
    --to=pvorel@suse.cz \
    --cc=jack@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=repnop@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).