forked from OSchip/llvm-project
Modify test_help_version() test case to be more precise in matching the version
number string as found in the resources/LLDB-info.plist file. llvm-svn: 122930
This commit is contained in:
parent
6f060afbbd
commit
849398910f
|
@ -18,12 +18,47 @@ class HelpCommandTestCase(TestBase):
|
|||
self.expect("help",
|
||||
startstr = 'The following is a list of built-in, permanent debugger commands')
|
||||
|
||||
def version_number_string(self):
|
||||
"""Helper function to find the version number string of lldb."""
|
||||
plist = os.path.join(os.getcwd(), os.pardir, os.pardir, "resources", "LLDB-info.plist")
|
||||
try:
|
||||
CFBundleVersionSegFound = False
|
||||
with open(plist, 'r') as f:
|
||||
for line in f:
|
||||
if CFBundleVersionSegFound:
|
||||
version_line = line.strip()
|
||||
import re
|
||||
m = re.match("<string>(.*)</string>", version_line)
|
||||
if m:
|
||||
version = m.group(1)
|
||||
return version
|
||||
else:
|
||||
# Unsuccessful, let's juts break out of the for loop.
|
||||
break
|
||||
|
||||
if line.find("<key>CFBundleVersion</key>") != -1:
|
||||
# Found our match. The next line contains our version
|
||||
# string, for example:
|
||||
#
|
||||
# <string>38</string>
|
||||
CFBundleVersionSegFound = True
|
||||
|
||||
except:
|
||||
# Just fallthrough...
|
||||
print "Unexpected error:", sys.exc_info()[0]
|
||||
pass
|
||||
|
||||
# Use None to signify that we are not able to grok the version number.
|
||||
return None
|
||||
|
||||
|
||||
def test_help_version(self):
|
||||
"""Test 'help version' and 'version' commands."""
|
||||
self.expect("help version",
|
||||
substrs = ['Show version of LLDB debugger.'])
|
||||
version_str = self.version_number_string()
|
||||
self.expect("version",
|
||||
patterns = ['LLDB-[0-9]+'])
|
||||
patterns = ['LLDB-' + (version_str if version_str else '[0-9]+')])
|
||||
|
||||
def test_help_should_not_hang_emacsshell(self):
|
||||
"""Command 'settings set term-width 0' should not hang the help command."""
|
||||
|
|
Loading…
Reference in New Issue