<commit_before>"""
Test number of threads.
"""

from __future__ import print_function


import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil


class ExitDuringStepTestCase(TestBase):

    mydir = TestBase.compute_mydir(__file__)

    @skipIfFreeBSD  # llvm.org/pr21411: test is hanging
    def test(self):
        """Test thread exit during step handling."""
        self.build(dictionary=self.getBuildFlags())
        self.exit_during_step_base(
            "thread step-inst -m all-threads",
            'stop reason = instruction step')

    @skipIfFreeBSD  # llvm.org/pr21411: test is hanging
    def test_step_over(self):
        """Test thread exit during step-over handling."""
        self.build(dictionary=self.getBuildFlags())
        self.exit_during_step_base(
            "thread step-over -m all-threads",
            'stop reason = step over')

    @skipIfFreeBSD  # llvm.org/pr21411: test is hanging
    def test_step_in(self):
        """Test thread exit during step-in handling."""
        self.build(dictionary=self.getBuildFlags())
        self.exit_during_step_base(
            "thread step-in -m all-threads",
            'stop reason = step in')

    def setUp(self):
        # Call super's setUp().
        TestBase.setUp(self)
        # Find the line numbers to break and continue.
        self.breakpoint = line_number('main.cpp', '// Set breakpoint here')
        self.continuepoint = line_number('main.cpp', '// Continue from here')

    def exit_during_step_base(self, step_cmd, step_stop_reason):
        """Test thread exit during step handling."""
        exe = os.path.join(os.getcwd(), "a.out")
        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)

        # This should create a breakpoint in the main thread.
        self.bp_num = lldbutil.run_break_set_by_file_and_line(
            self, "main.cpp", self.breakpoint, num_expected_locations=1)

        # The breakpoint list should show 1 location.
        self.expect(
            "breakpoint list -f",
            "Breakpoint location shown correctly",
            substrs=[
                "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
                self.breakpoint])<commit_msg>xfailed TestExitDuringStep pending a fix.<commit_after>"""
Test number of threads.
"""

from __future__ import print_function


import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil


class ExitDuringStepTestCase(TestBase):

    mydir = TestBase.compute_mydir(__file__)

    @skipIfFreeBSD  # llvm.org/pr21411: test is hanging
    @expectedFailureAll(compiler="clang", bugnumber="rdar://problem/30100284")
    def test(self):
        """Test thread exit during step handling."""
        self.build(dictionary=self.getBuildFlags())
        self.exit_during_step_base(
            "thread step-inst -m all-threads",
            'stop reason = instruction step')

    @skipIfFreeBSD  # llvm.org/pr21411: test is hanging
    @expectedFailureAll(compiler="clang", bugnumber="rdar://problem/30100284")
    def test_step_over(self):
        """Test thread exit during step-over handling."""
        self.build(dictionary=self.getBuildFlags())
        self.exit_during_step_base(
            "thread step-over -m all-threads",
            'stop reason = step over')

    @skipIfFreeBSD  # llvm.org/pr21411: test is hanging
    @expectedFailureAll(compiler="clang", bugnumber="rdar://problem/30100284")
    def test_step_in(self):
        """Test thread exit during step-in handling."""
        self.build(dictionary=self.getBuildFlags())
        self.exit_during_step_base(
            "thread step-in -m all-threads",
            'stop reason = step in')

    def setUp(self):
        # Call super's setUp().
        TestBase.setUp(self)
        # Find the line numbers to break and continue.
        self.breakpoint = line_number('main.cpp', '// Set breakpoint here')
        self.continuepoint = line_number('main.cpp', '// Continue from here')

    def exit_during_step_base(self, step_cmd, step_stop_reason):
        """Test thread exit during step handling."""
        exe = os.path.join(os.getcwd(), "a.out")
        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)

        # This should create a breakpoint in the main thread.
        self.bp_num = lldbutil.run_break_set_by_file_and_line(
            self, "main.cpp", self.breakpoint, num_expected_locations=1)

        # The breakpoint list should show 1 location.
        self.expect(
            "breakpoint list -f",
            "Breakpoint location shown correctly",
            substrs=[
                "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
                self.breakpoint])
{'fraction_non_alphanumeric': 0.10854788877445933, 'fraction_numerical': 0.013182286302780639, 'mean_word_length': 2.6984006092916983, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '145027', 'n_tokens_mistral': 1528, 'n_tokens_neox': 1432, 'n_words': 367}