[LTP] [PATCH 1/3] tst_test_macros: Add TST_EXP_FD_ERRNO
Petr Vorel
pvorel@suse.cz
Tue Sep 6 11:26:13 CEST 2022
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
More information about the ltp
mailing list