[LTP] [PATCH] lib/tst_kconfig: Fix unexpected error when checking Kconfig containing numbers

Pengfei Xu pengfei.xu@intel.com
Thu Nov 19 20:29:34 CET 2020


Fix unexpected error when checking Kconfig containing numbers after commit:
eeed458492cc7dc01ad3a5fff500b09d1fda4922:"lib/tst_kconfig: Validate variables",
unexpected error sample is as below:
"
CONFIG_X86_INTEL_UMIP=y
        ^
Unexpected character in variable name

CONFIG_X86_UMIP=y
        ^
Unexpected character in variable name

tst_kconfig.c:475: TBROK: Invalid kconfig variables!
"

Signed-off-by: Pengfei Xu <pengfei.xu@intel.com>
---
 lib/tst_kconfig.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/tst_kconfig.c b/lib/tst_kconfig.c
index 72830703c..8dc623952 100644
--- a/lib/tst_kconfig.c
+++ b/lib/tst_kconfig.c
@@ -262,6 +262,11 @@ static int validate_var(const struct tst_expr_tok *var)
 			continue;
 		}
 
+		if (c >= '0' && c <= '9') {
+			i++;
+			continue;
+		}
+
 		if (c == '=') {
 			i++;
 			break;
-- 
2.20.1



More information about the ltp mailing list