From: Martin Doucha <mdoucha@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/2] Add TST_EXP_FAIL_ARR_SILENT() helper macros
Date: Tue, 12 May 2026 18:27:16 +0200 [thread overview]
Message-ID: <20260512162735.80055-1-mdoucha@suse.cz> (raw)
Add silent version of TST_EXP_FAIL() macros with the possibility
to check multiple expected errno values.
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
include/tst_test_macros.h | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h
index 2cfbdb586..b1e74278d 100644
--- a/include/tst_test_macros.h
+++ b/include/tst_test_macros.h
@@ -675,6 +675,36 @@ const char *tst_errno_names(char *buf, const int *exp_errs, int exp_errs_cnt);
&tst_exp_err__, 1, ##__VA_ARGS__); \
} while (0)
+/**
+ * TST_EXP_FAIL_ARR_SILENT() - Test syscall to fail with expected errnos, silent variant.
+ *
+ * @SCALL: Tested syscall.
+ * @EXP_ERRS: Array of expected errnos.
+ * @EXP_ERRS_CNT: Lenght of EXP_ERRS.
+ * @...: A printf-like parameters.
+ *
+ * Unlike TST_EXP_FAIL_ARR() does not print :c:enum:`TPASS <tst_res_flags>` on
+ * success, only prints :c:enum:`TFAIL <tst_res_flags>` on failure.
+ */
+#define TST_EXP_FAIL_ARR_SILENT(SCALL, EXP_ERRS, EXP_ERRS_CNT, ...) \
+ TST_EXP_FAIL_SILENT_(TST_RET == 0, SCALL, #SCALL, \
+ EXP_ERRS, EXP_ERRS_CNT, ##__VA_ARGS__)
+
+/**
+ * TST_EXP_FAIL2_ARR_SILENT() - Test syscall to fail with expected errnos, silent variant.
+ *
+ * @SCALL: Tested syscall.
+ * @EXP_ERRS: Array of expected errnos.
+ * @EXP_ERRS_CNT: Lenght of EXP_ERRS.
+ * @...: A printf-like parameters.
+ *
+ * Unlike TST_EXP_FAIL2_ARR() does not print :c:enum:`TPASS <tst_res_flags>` on
+ * success, only prints :c:enum:`TFAIL <tst_res_flags>` on failure.
+ */
+#define TST_EXP_FAIL2_ARR_SILENT(SCALL, EXP_ERRS, EXP_ERRS_CNT, ...) \
+ TST_EXP_FAIL_SILENT_(TST_RET >= 0, SCALL, #SCALL, \
+ EXP_ERRS, EXP_ERRS_CNT, ##__VA_ARGS__)
+
/**
* TST_EXP_EXPR() - Check for expected expression.
*
--
2.53.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next reply other threads:[~2026-05-12 16:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 16:27 Martin Doucha [this message]
2026-05-12 16:27 ` [LTP] [PATCH 2/2] af_alg08: Allow recv() to return EINVAL Martin Doucha
2026-05-12 16:40 ` Cyril Hrubis
2026-05-12 18:00 ` Petr Vorel
2026-05-12 16:40 ` [LTP] [PATCH 1/2] Add TST_EXP_FAIL_ARR_SILENT() helper macros Cyril Hrubis
2026-05-12 17:58 ` Petr Vorel
2026-05-12 17:16 ` [LTP] " linuxtestproject.agent
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=20260512162735.80055-1-mdoucha@suse.cz \
--to=mdoucha@suse.cz \
--cc=ltp@lists.linux.it \
/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 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.