1 Star 0 Fork 94

Mingtai/systemd_1

forked from src-openEuler/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-CVE-2022-4415-test-Slightly-rework-DEFINE_TEST_MAIN-macros.patch 2.00 KB
一键复制 编辑 原始数据 按行查看 历史
胡宇彪 提交于 2022-12-28 09:50 . fix CVE-2022-4415
From a40b728e1172cc07a09e12dd56089ab37c8c5924 Mon Sep 17 00:00:00 2001
From: Jan Janssen <medhefgo@web.de>
Date: Tue, 23 Nov 2021 13:40:27 +0100
Subject: [PATCH] test: Slightly rework DEFINE_TEST_MAIN macros
- A lot of tests want a different log level
- Provides saved_argc/saved_argv to tests
- Separate intro/outro is more flexible
Conflict:Delete content in test-macro.c.
Reference:https://github.com/systemd/systemd/commit/a40b728e1172cc07a09e12dd56089ab37c8c5924
---
src/shared/tests.h | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/shared/tests.h b/src/shared/tests.h
index f333ebd842..872b9b2d6c 100644
--- a/src/shared/tests.h
+++ b/src/shared/tests.h
@@ -6,6 +6,7 @@
#include "sd-daemon.h"
#include "macro.h"
+#include "util.h"
static inline bool manager_errno_skip_test(int r) {
return IN_SET(abs(r),
@@ -77,16 +78,14 @@ static inline void run_test_table(void) {
}
}
-#define DEFINE_TEST_MAIN \
- int main(int argc, char *argv[]) { \
- test_setup_logging(LOG_INFO); \
- run_test_table(); \
- return EXIT_SUCCESS; \
+#define DEFINE_CUSTOM_TEST_MAIN(log_level, intro, outro) \
+ int main(int argc, char *argv[]) { \
+ test_setup_logging(log_level); \
+ save_argc_argv(argc, argv); \
+ intro; \
+ run_test_table(); \
+ outro; \
+ return EXIT_SUCCESS; \
}
-#define DEFINE_CUSTOM_TEST_MAIN(impl) \
- int main(int argc, char *argv[]) { \
- test_setup_logging(LOG_INFO); \
- run_test_table(); \
- return impl(); \
- }
+#define DEFINE_TEST_MAIN(log_level) DEFINE_CUSTOM_TEST_MAIN(log_level, , )
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yangmingtaip/systemd_1.git
git@gitee.com:yangmingtaip/systemd_1.git
yangmingtaip
systemd_1
systemd_1
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385