xref: /openbmc/linux/tools/testing/selftests/timens/log.h (revision 8dd06ef34b6e2f41b29fbf5fc1663780f2524285)
1  /* SPDX-License-Identifier: GPL-2.0 */
2  
3  #ifndef __SELFTEST_TIMENS_LOG_H__
4  #define __SELFTEST_TIMENS_LOG_H__
5  
6  #define pr_msg(fmt, lvl, ...)						\
7  	ksft_print_msg("[%s] (%s:%d)\t" fmt "\n",			\
8  			lvl, __FILE__, __LINE__, ##__VA_ARGS__)
9  
10  #define pr_p(func, fmt, ...)	func(fmt ": %m", ##__VA_ARGS__)
11  
12  #define pr_err(fmt, ...)						\
13  	({								\
14  		ksft_test_result_error(fmt "\n", ##__VA_ARGS__);		\
15  		-1;							\
16  	})
17  
18  #define pr_fail(fmt, ...)					\
19  	({							\
20  		ksft_test_result_fail(fmt, ##__VA_ARGS__);	\
21  		-1;						\
22  	})
23  
24  #define pr_perror(fmt, ...)	pr_p(pr_err, fmt, ##__VA_ARGS__)
25  
26  #endif
27