加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
tests-Allow-expansion-of-mocked-stat-symbols.patch 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
Jiangjiacheng 提交于 2023-01-04 12:02 . Backport patches from upstream
From 9f6e5e5fe12e9cb4bb42918f597ba0268e57064b Mon Sep 17 00:00:00 2001
From: xuyinghao <xuyinghao2@huawei.com>
Date: Tue, 16 Aug 2022 19:08:45 +0800
Subject: [PATCH 08/13] tests: Allow expansion of mocked stat symbols
When libc uses a define to rewrite stat64 to stat our mocks do not work if they
are chained because the symbol that we are looking up is being stringified and
therefore preventing the stat64->stat expansion per C-preprocessor rules. One
stringification macro is just enough to make it work.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
tests/virmock.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/virmock.h b/tests/virmock.h
index 95feeb0d92..188f0cf55b 100644
--- a/tests/virmock.h
+++ b/tests/virmock.h
@@ -57,6 +57,7 @@
#define VIR_MOCK_GET_ARG20(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n), z(o, p), z(q, r), z(s, t)
#define VIR_MOCK_GET_ARG21(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n), z(o, p), z(q, r), z(s, t)
+#define VIR_MOCK_STRINGIFY_SYMBOL(name) #name
#define VIR_MOCK_ARGNAMES_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__)
#define VIR_MOCK_ARGNAMES(...) \
@@ -283,7 +284,7 @@
do { \
if (real_##name == NULL && \
!(real_##name = dlsym(RTLD_NEXT, \
- #name))) { \
+ VIR_MOCK_STRINGIFY_SYMBOL(name)))) { \
fprintf(stderr, "Missing symbol '" #name "'\n"); \
abort(); \
} \
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化