Skip to contentSkip to conversation

kunit: kunit_config: Fix parsing of CONFIG options with space

PATCH In review Rikard Falkeborn 4 participants 4 messages Jun 7, 2020 – Jul 1, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kunit: kunit_config: Fix parsing of CONFIG options with space

Commit 8b59cd81dc5e ("kbuild: ensure full rebuild when the compiler is updated") introduced a new CONFIG option CONFIG_CC_VERSION_TEXT. On my system, this is set to "gcc (GCC) 10.1.0" which breaks KUnit config parsing which did not like the spaces in the string.

Fix this by updating the regex to allow strings containing spaces.

Fixes 8b59cd81dc5e ("kbuild: ensure full rebuild when the compiler is updated")

---
Maybe it would have been sufficient to just use
CONFIG_PATTERN = r'^CONFIG_(\w+)=(.*)$' instead?

 tools/testing/kunit/kunit_config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/kunit/kunit_config.py +1 -1
index e75063d603b5..02ffc3a3e5dc 100644
@@ -10,7 +10,7 @@ import collections
 import re
 
 CONFIG_IS_NOT_SET_PATTERN = r'^# CONFIG_(\w+) is not set$'
-CONFIG_PATTERN = r'^CONFIG_(\w+)=(\S+)$'
+CONFIG_PATTERN = r'^CONFIG_(\w+)=(\S+|".*")$'
 
 KconfigEntryBase = collections.namedtuple('KconfigEntry', ['name', 'value'])
 
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Rikard Falkeborn

Commit 8b59cd81dc5e ("kbuild: ensure full rebuild when the compiler is updated") introduced a new CONFIG option CONFIG_CC_VERSION_TEXT. On my system, this is set to "gcc (GCC) 10.1.0" which breaks KUnit config parsing which did not like the spaces in the string.

Fix this by updating the regex to allow strings containing spaces.

Fixes 8b59cd81dc5e ("kbuild: ensure full rebuild when the compiler is updated")

Thanks for the patch! I had been meaning to send out a fix for this for a while, but never got around to it. :-)

Tested-by on v1 1/1
#2 lore raw
In reply to Rikard Falkeborn
Quoted 10 lines · Rikard Falkeborn

Commit 8b59cd81dc5e ("kbuild: ensure full rebuild when the compiler is updated") introduced a new CONFIG option CONFIG_CC_VERSION_TEXT. On my system, this is set to "gcc (GCC) 10.1.0" which breaks KUnit config parsing which did not like the spaces in the string.

Fix this by updating the regex to allow strings containing spaces.

Fixes 8b59cd81dc5e ("kbuild: ensure full rebuild when the compiler is updated")

I've been using this patch quite a bit, and haven't hit any problems.

+Shuah: Any chance we get this into the kunit branch sooner rather than later? The KUnit tooling is quite broken without it.

Quoted 4 lines

---
Maybe it would have been sufficient to just use
CONFIG_PATTERN = r'^CONFIG_(\w+)=(.*)$' instead?

FWIW, I tried this myself, and it seemed to work, but I think I like requiring the quotes more.

Cheers,
-- David

maintainer
#3 lore raw
Quoted 13 lines · David Gow
Quoted 10 lines · Rikard Falkeborn

Commit 8b59cd81dc5e ("kbuild: ensure full rebuild when the compiler is updated") introduced a new CONFIG option CONFIG_CC_VERSION_TEXT. On my system, this is set to "gcc (GCC) 10.1.0" which breaks KUnit config parsing which did not like the spaces in the string.

Fix this by updating the regex to allow strings containing spaces.

Fixes 8b59cd81dc5e ("kbuild: ensure full rebuild when the compiler is updated")
Quoted 7 lines

I've been using this patch quite a bit, and haven't hit any problems.

+Shuah: Any chance we get this into the kunit branch sooner rather than later? The KUnit tooling is quite broken without it.

Applied to linux-kselftest kunit

https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/log/?h=kunit

thanks,
-- Shuah