1"""
2Test that apropos env doesn't crash trying to touch the process plugin command
3"""
4
5
6
7import lldb
8from lldbsuite.test.lldbtest import *
9import lldbsuite.test.lldbutil as lldbutil
10
11
12class AproposWithProcessTestCase(TestBase):
13    NO_DEBUG_INFO_TESTCASE = True
14
15    def setUp(self):
16        # Call super's setUp().
17        TestBase.setUp(self)
18        # Find the line number to break inside main().
19        self.line = line_number('main.cpp', '// break here')
20
21    def test_apropos_with_process(self):
22        """Test that apropos env doesn't crash trying to touch the process plugin command."""
23        self.build()
24        exe = self.getBuildArtifact("a.out")
25        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
26
27        # Break in main() after the variables are assigned values.
28        lldbutil.run_break_set_by_file_and_line(
29            self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
30
31        self.runCmd("run", RUN_SUCCEEDED)
32
33        # The stop reason of the thread should be breakpoint.
34        self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
35                    substrs=['stopped', 'stop reason = breakpoint'])
36
37        # The breakpoint should have a hit count of 1.
38        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
39
40        self.runCmd('apropos env')
41