[LTP] [PATCH v2 1/3] tst_test_macros: Add TST_EXP_FD_OR_FAIL() macro
Petr Vorel
pvorel@suse.cz
Tue Sep 13 08:21:01 CEST 2022
It calls TST_EXP_FD() or 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..231c04951 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_OR_FAIL(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
More information about the ltp
mailing list