From: Hoa Nguyen Date: Wed, 29 Jul 2020 21:55:31 +0000 (-0700) Subject: tests: fix name collisions in verifier.py X-Git-Tag: v20.1.0.0~360 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9a250990cccaca49609ffab96ac1fd80ffa7445a;p=gem5.git 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 Change-Id: I0ab7b52619f2fa9495e9a6ff8d469c022eea98bc Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31994 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- diff --git a/tests/gem5/verifier.py b/tests/gem5/verifier.py index 815b9bbaf..ba4bd4ff5 100644 --- a/tests/gem5/verifier.py +++ b/tests/gem5/verifier.py @@ -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):