From 64e11fec079480179aa9473ae5e1e8ad78ef9ac3 Mon Sep 17 00:00:00 2001 From: Li Wang Date: Wed, 18 Dec 2024 11:47:23 +0800 Subject: [PATCH] lib: check kconfig file existence in tst_has_slow_kconfig In the GitHub CI environment, or certain images used during testing, the kconfig files might not be present. Without checking for the existence of the kconfig path, the test attempts to read a non-existent file, leading to errors or test failures. tst_kconfig.c:207: TBROK: Cannot parse kernel .config Signed-off-by: Li Wang --- lib/tst_kconfig.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/tst_kconfig.c b/lib/tst_kconfig.c index d96a8f5439e..e83de3dcd37 100644 --- a/lib/tst_kconfig.c +++ b/lib/tst_kconfig.c @@ -655,6 +655,10 @@ static struct tst_kconfig_var slow_kconfigs[] = { int tst_has_slow_kconfig(void) { unsigned int i; + char path_buf[1024]; + + if (!kconfig_path(path_buf, sizeof(path_buf))) + return 0; tst_kconfig_read(slow_kconfigs, ARRAY_SIZE(slow_kconfigs));