tests: Fix verifier '_iterable_regex' func for None regex

In the case where no regex was specified (i,e., `regex == None`), the
`_iterable_regex` function returned `None`. For the testlib to work this
function must return an iterable.

Without this patch it is not possible to compare two files without a
specifying a regex.

Change-Id: Ibc8a2f783c3b786dbdca6a4284850b594024f2f9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/64851
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
Bobby R. Bruce
2022-10-19 12:48:25 -07:00
committed by Jarvis JIA
parent dd4f3d1fa4
commit 6840c5e7ea

View File

@@ -276,6 +276,8 @@ _re_type = type(re.compile(""))
def _iterable_regex(regex):
if not regex:
return () # If no regex we return an empty tuple.
if isinstance(regex, _re_type) or isinstance(regex, str):
regex = (regex,)
return regex