[LTP] [PATCH] lib/tst_kconfig.c: supplement config path

Yang Xu xuyang2018.jy@fujitsu.com
Tue Nov 9 04:17:38 CET 2021


We should add /lib/modules/$(uname -r)/build/.config for parsing.
So we can avoid parsing not-found-error when using our own compiled kernel.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 lib/tst_kconfig.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/tst_kconfig.c b/lib/tst_kconfig.c
index 5af67b0a5..d433b8cf6 100644
--- a/lib/tst_kconfig.c
+++ b/lib/tst_kconfig.c
@@ -32,6 +32,12 @@ static const char *kconfig_path(char *path_buf, size_t path_buf_len)
 
 	uname(&un);
 
+	/* Common install module path */
+	snprintf(path_buf, path_buf_len, "/lib/modules/%s/build/.config", un.release);
+
+	if (!access(path_buf, F_OK))
+		return path_buf;
+
 	/* Debian and derivatives */
 	snprintf(path_buf, path_buf_len, "/boot/config-%s", un.release);
 
-- 
2.23.0



More information about the ltp mailing list