tests: make log_tests_skipped() and friend accept format string

This commit is contained in:
Yu Watanabe
2023-10-31 14:46:38 +09:00
parent d19434fbf8
commit 678fbf7eef
2 changed files with 17 additions and 14 deletions
-12
View File
@@ -118,18 +118,6 @@ void test_setup_logging(int level) {
log_open();
}
int log_tests_skipped(const char *message) {
log_notice("%s: %s, skipping tests.",
program_invocation_short_name, message);
return EXIT_TEST_SKIP;
}
int log_tests_skipped_errno(int r, const char *message) {
log_notice_errno(r, "%s: %s, skipping tests: %m",
program_invocation_short_name, message);
return EXIT_TEST_SKIP;
}
int write_tmpfile(char *pattern, const char *contents) {
_cleanup_close_ int fd = -EBADF;
+17 -2
View File
@@ -28,8 +28,23 @@ int get_testdata_dir(const char *suffix, char **ret);
const char* get_catalog_dir(void);
bool slow_tests_enabled(void);
void test_setup_logging(int level);
int log_tests_skipped(const char *message);
int log_tests_skipped_errno(int r, const char *message);
#define log_tests_skipped(fmt, ...) \
({ \
log_notice("%s: " fmt ", skipping tests.", \
program_invocation_short_name, \
##__VA_ARGS__); \
EXIT_TEST_SKIP; \
})
#define log_tests_skipped_errno(error, fmt, ...) \
({ \
log_notice_errno(error, \
"%s: " fmt ", skipping tests: %m", \
program_invocation_short_name, \
##__VA_ARGS__); \
EXIT_TEST_SKIP; \
})
int write_tmpfile(char *pattern, const char *contents);