tests: fix name collisions in verifier.py

In verifier.py, testlib.test_util is imported and renamed to 'test',
while several functions in the file have a subfunction named 'test()',
which causes test.fail() to fail as 'test' points to the
subfunction instead of the module.

This commit addresses the above issue by keeping the imported module
as test_util instead of renaming it to test.

Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Change-Id: I0ab7b52619f2fa9495e9a6ff8d469c022eea98bc
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31994
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Hoa Nguyen
2020-07-29 14:55:31 -07:00
parent df1324b999
commit 9a250990cc

View File

@@ -29,7 +29,7 @@ Built in test cases that verify particular details about a gem5 run.
'''
import re
from testlib import test_util as test
from testlib import test_util
from testlib.configuration import constants
from testlib.helper import joinpath, diff_out_file
@@ -44,7 +44,7 @@ class Verifier(object):
def instantiate_test(self, name_pfx):
name = '-'.join([name_pfx, self.__class__.__name__])
return test.TestFunction(self._test,
return test_util.TestFunction(self._test,
name=name, fixtures=self.fixtures)
class MatchGoldStandard(Verifier):
@@ -80,7 +80,7 @@ class MatchGoldStandard(Verifier):
ignore_regexes=self.ignore_regex,
logger=params.log)
if diff is not None:
test.fail('Stdout did not match:\n%s\nSee %s for full results'
test_util.fail('Stdout did not match:\n%s\nSee %s for full results'
% (diff, tempdir))
def _generic_instance_warning(self, kwargs):
@@ -184,7 +184,7 @@ class MatchRegex(Verifier):
if parse_file(joinpath(tempdir,
constants.gem5_simulation_stderr)):
return # Success
test.fail('Could not match regex.')
test_util.fail('Could not match regex.')
_re_type = type(re.compile(''))
def _iterable_regex(regex):