mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-21 22:09:23 +01:00
test-runner: fix matching with --verbose
The new regex match update was actually matching way more than it should have due to how python's 'match' API works. 'match' will return successfully if zero or more characters match from the beginning of the string. In this case we actually need the entire regex to match otherwise we start matching all prefixes, for example: "--verbose iwd" will match iwd, iwd-dhcp, iwd-acd, iwd-genl and iwd-tls. Instead use re.fullmatch which requires the entire string to match the regex.
This commit is contained in:
parent
f4279ebf53
commit
8f42507641
@ -8,7 +8,7 @@ import dbus
|
|||||||
|
|
||||||
from gi.repository import GLib
|
from gi.repository import GLib
|
||||||
from weakref import WeakValueDictionary
|
from weakref import WeakValueDictionary
|
||||||
from re import match
|
from re import fullmatch
|
||||||
|
|
||||||
from runner import RunnerCoreArgParse
|
from runner import RunnerCoreArgParse
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ class Process(subprocess.Popen):
|
|||||||
# Handle any regex matches
|
# Handle any regex matches
|
||||||
for item in Process.testargs.verbose:
|
for item in Process.testargs.verbose:
|
||||||
try:
|
try:
|
||||||
if match(item, process):
|
if fullmatch(item, process):
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("%s is not a valid regex" % item)
|
print("%s is not a valid regex" % item)
|
||||||
|
Loading…
Reference in New Issue
Block a user