This commit is contained in:
Greg Clayton 2021-10-21 14:21:36 -07:00
parent 93d0ade17c
commit 910838f07d
2 changed files with 12 additions and 2 deletions

View File

@ -750,6 +750,10 @@ class Base(unittest2.TestCase):
"""Return absolute path to an artifact in the test's build directory."""
return os.path.join(self.getBuildDir(), name)
def getSourcePath(self, name):
"""Return absolute path to a file in the test's source directory."""
return os.path.join(self.getSourceDir(), name)
@classmethod
def setUpCommands(cls):
commands = [

View File

@ -93,12 +93,18 @@ class TestCase(TestBase):
substrs=["undeclared identifier 'doesnt_exist'"])
# Doesn't successfully execute.
self.expect("expr int *i = nullptr; *i", error=True)
# Interpret an integer as an array with 3 elements is also a failure.
# Interpret an integer as an array with 3 elements is a failure for
# the "expr" command, but the expression evaluation will succeed and
# be counted as a success even though the "expr" options will for the
# command to fail. It is more important to track expression evaluation
# from all sources instead of just through the command, so this was
# changed. If we want to track command success and fails, we can do
# so using another metric.
self.expect("expr -Z 3 -- 1", error=True,
substrs=["expression cannot be used with --element-count"])
# We should have gotten 3 new failures and the previous success.
stats = self.get_stats()
self.verify_success_fail_count(stats, 'expressionEvaluation', 1, 3)
self.verify_success_fail_count(stats, 'expressionEvaluation', 2, 2)
self.expect("statistics enable")
# 'frame var' with enabled statistics will change stats.