diff options
| author | Johnny Chen <johnny.chen@apple.com> | 2011-01-06 00:03:01 +0000 |
|---|---|---|
| committer | Johnny Chen <johnny.chen@apple.com> | 2011-01-06 00:03:01 +0000 |
| commit | 849398910f221e732abc034d37aa243bc1920778 (patch) | |
| tree | 34b179713e1807c78f3e4d3ef394c0dc88097d76 /lldb/test/help/TestHelp.py | |
| parent | 6f060afbbdfcf92c50fb87af8067fb005a6a6517 (diff) | |
| download | bcm5719-llvm-849398910f221e732abc034d37aa243bc1920778.tar.gz bcm5719-llvm-849398910f221e732abc034d37aa243bc1920778.zip | |
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
Diffstat (limited to 'lldb/test/help/TestHelp.py')
| -rw-r--r-- | lldb/test/help/TestHelp.py | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/lldb/test/help/TestHelp.py b/lldb/test/help/TestHelp.py index a6db2f6e59f..201941dccaf 100644 --- a/lldb/test/help/TestHelp.py +++ b/lldb/test/help/TestHelp.py @@ -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.""" |

