<commit_before>"""
Test calling std::String member functions.
"""

import unittest2
import lldb
import lldbutil
from lldbtest import *

class ExprCommandCallFunctionTestCase(TestBase):

    mydir = os.path.join("expression_command", "call-function")

    def setUp(self):
        # Call super's setUp().
        TestBase.setUp(self)
        # Find the line number to break for main.c.
        self.line = line_number('main.cpp',
                                '// Please test these expressions while stopped at this line:')

    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
    @dsym_test
    def test_with_dsym(self):
        """Test calling std::String member function."""
        self.buildDsym()
        self.call_function()

    @dwarf_test
    @expectedFailureGcc # llvm.org/pr14437, fails with GCC 4.6.3 and 4.7.2
    @expectedFailureIcc # llvm.org/pr14437, fails with ICC 13.1
    def test_with_dwarf(self):
        """Test calling std::String member function."""
        self.buildDwarf()
        self.call_function()

    def call_function(self):
        """Test calling std::String member function."""
        self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)

        # Some versions of GCC encode two locations for the 'return' statement in main.cpp
        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=True)

        self.runCmd("run", RUN_SUCCEEDED)

        self.expect("print str",
            substrs = ['Hello world'])

        # Should be fixed with r142717.
        #
        # rdar://problem/9471744 test failure: ./dotest.py -C clang -v -w -t -p CallStdString
        # runCmd: print str.c_str()
        # runCmd failed!
        # error: Couldn't convert the expression to DWARF
        self.expect("print str.c_str()",
            substrs = ['Hello world'])
<commit_msg>Annotate test that fails on the FreeBSD buildbot<commit_after>"""
Test calling std::String member functions.
"""

import unittest2
import lldb
import lldbutil
from lldbtest import *

class ExprCommandCallFunctionTestCase(TestBase):

    mydir = os.path.join("expression_command", "call-function")

    def setUp(self):
        # Call super's setUp().
        TestBase.setUp(self)
        # Find the line number to break for main.c.
        self.line = line_number('main.cpp',
                                '// Please test these expressions while stopped at this line:')

    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
    @dsym_test
    def test_with_dsym(self):
        """Test calling std::String member function."""
        self.buildDsym()
        self.call_function()

    @dwarf_test
    @expectedFailureFreeBSD('llvm.org/pr17807') # Fails on FreeBSD buildbot
    @expectedFailureGcc # llvm.org/pr14437, fails with GCC 4.6.3 and 4.7.2
    @expectedFailureIcc # llvm.org/pr14437, fails with ICC 13.1
    def test_with_dwarf(self):
        """Test calling std::String member function."""
        self.buildDwarf()
        self.call_function()

    def call_function(self):
        """Test calling std::String member function."""
        self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)

        # Some versions of GCC encode two locations for the 'return' statement in main.cpp
        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=True)

        self.runCmd("run", RUN_SUCCEEDED)

        self.expect("print str",
            substrs = ['Hello world'])

        # Should be fixed with r142717.
        #
        # rdar://problem/9471744 test failure: ./dotest.py -C clang -v -w -t -p CallStdString
        # runCmd: print str.c_str()
        # runCmd failed!
        # error: Couldn't convert the expression to DWARF
        self.expect("print str.c_str()",
            substrs = ['Hello world'])

{'fraction_non_alphanumeric': 0.11268330331875483, 'fraction_numerical': 0.019295086184718292, 'mean_word_length': 2.702857142857143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3436383', 'n_tokens_mistral': 1256, 'n_tokens_neox': 1177, 'n_words': 314}