Пример #1
0
    def setUp(self):
        lldbtest.TestBase.setUp(self)
        self.main_source = "main.swift"
        self.main_source_spec = lldb.SBFileSpec(self.main_source)

        self.line_method = lldbtest.line_number(self.main_source,
                                                '// method line')
        self.line_method2 = lldbtest.line_number(self.main_source,
                                                 '// method2 line')
    def setUp(self):
        lldbtest.TestBase.setUp(self)
        self.main_source = "main.swift"
        self.main_source_spec = lldb.SBFileSpec(self.main_source)

        self.line_breakpoint = lldbtest.line_number(self.main_source,
                                                    '// get address line')
        self.line_current_access = lldbtest.line_number(
            self.main_source, '// current access line')
        self.line_previous_access = lldbtest.line_number(
            self.main_source, '// previous access line')
Пример #3
0
    def setUp(self):
        # Call super's setUp().
        super(DarwinLogEventBasedTestBase, self).setUp()

        # Until other systems support this, exit
        # early if we're not macOS version 10.12
        # or greater.
        version = platform.mac_ver()[0].split('.')
        if ((int(version[0]) == 10) and (int(version[1]) < 12) or
                (int(version[0]) < 10)):
            self.skipTest("DarwinLog tests currently require macOS 10.12+")
            return

        # Source filename.
        self.source = 'main.c'

        # Output filename.
        self.exe_name = 'a.out'
        self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}

        # Locate breakpoint.
        self.line = lldbtest.line_number(self.source, '// break here')

        # Enable debugserver logging of the darwin log collection
        # mechanism.
        self.runCmd("settings set target.process.extra-startup-command "
                    "QSetLogging:bitmask=LOG_DARWIN_LOG;")
Пример #4
0
    def setUp(self):
        # Call super's setUp().
        super(DarwinLogEventBasedTestBase, self).setUp()

        # Until other systems support this, exit
        # early if we're not macOS version 10.12
        # or greater.
        version = platform.mac_ver()[0].split('.')
        if ((int(version[0]) == 10) and (int(version[1]) < 12)
                or (int(version[0]) < 10)):
            self.skipTest("DarwinLog tests currently require macOS 10.12+")
            return

        # Source filename.
        self.source = 'main.c'

        # Output filename.
        self.exe_name = 'a.out'
        self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}

        # Locate breakpoint.
        self.line = lldbtest.line_number(self.source, '// break here')

        # Enable debugserver logging of the darwin log collection
        # mechanism.
        self.runCmd("settings set target.process.extra-startup-command "
                    "QSetLogging:bitmask=LOG_DARWIN_LOG;")
Пример #5
0
    def do_test(self):
        exe_name = "a.out"
        exe = os.path.join(os.getcwd(), exe_name)

        # Create the target
        target = self.dbg.CreateTarget(exe)
        self.assertTrue(target, lldbtest.VALID_TARGET)

        self.runCmd("run")

        stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason()
        if stop_reason == lldb.eStopReasonExec:
            # On OS X 10.10 and older, we need to re-exec to enable interceptors.
            self.runCmd("continue")

        # the stop reason of the thread should be a TSan report.
        self.expect("thread list", "A data race should be detected",
            substrs = ['stopped', 'stop reason = Data race detected'])

        self.assertEqual(self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(), lldb.eStopReasonInstrumentation)

        self.expect("thread info -s", "The extended stop info should contain the TSan provided fields",
            substrs = ["instrumentation_class", "description", "mops"])

        output_lines = self.res.GetOutput().split('\n')
        json_line = '\n'.join(output_lines[2:])
        data = json.loads(json_line)
        self.assertEqual(data["instrumentation_class"], "ThreadSanitizer")
        self.assertEqual(data["issue_type"], "data-race")
        self.assertEqual(len(data["mops"]), 2)
        self.assertTrue(data["location_filename"].endswith("/main.swift"))
        self.assertEqual(data["location_line"], lldbtest.line_number('main.swift', '// global variable'))
Пример #6
0
 def hit_correct_line(self, thread, pattern, fail_if_wrong=True):
     # print "Check if we got to: ", pattern
     target_line = lldbtest.line_number(self.main_source, pattern)
     self.assertTrue(target_line != 0,
                     "Could not find source pattern " + pattern)
     cur_line = thread.frames[0].GetLineEntry().GetLine()
     hit_line = cur_line == target_line
     if fail_if_wrong:
         self.assertTrue(
             hit_line, "Stepped to line %d instead of expected %d "
             "with pattern '%s'." % (cur_line, target_line, pattern))
     return hit_line
    def setUp(self):
        # Call super's setUp().
        super(TestDarwinLogFilterRegexActivity, self).setUp()

        # Source filename.
        self.source = 'main.c'

        # Output filename.
        self.exe_name = 'a.out'
        self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}

        # Locate breakpoint.
        self.line = lldbtest.line_number(self.source, '// break here')
    def setUp(self):
        # Call super's setUp().
        super(TestDarwinLogFilterRegexSubsystem, self).setUp()

        # Source filename.
        self.source = 'main.c'

        # Output filename.
        self.exe_name = self.getBuildArtifact("a.out")
        self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}

        # Locate breakpoint.
        self.line = lldbtest.line_number(self.source, '// break here')
    def setUp(self):
        # Call super's setUp().
        super(TestDarwinLogFilterRegexActivityChain, self).setUp()

        # Source filename.
        self.source = 'main.c'

        # Output filename.
        self.exe_name = 'a.out'
        self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}

        # Locate breakpoint.
        self.line = lldbtest.line_number(self.source, '// break here')
    def setUp(self):
        # Call super's setUp().
        super(TestDarwinLogMessageFormat, self).setUp()

        # Source filename.
        self.source = 'main.c'

        # Output filename.
        self.exe_name = self.getBuildArtifact("a.out")
        self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}

        # Locate breakpoint.
        self.line = lldbtest.line_number(self.source, '// break here')
Пример #11
0
 def hit_correct_line(self, thread, pattern, fail_if_wrong=True):
     # print "Check if we got to: ", pattern
     target_line = lldbtest.line_number(self.main_source, pattern)
     self.assertTrue(
         target_line != 0,
         "Could not find source pattern " + pattern)
     cur_line = thread.frames[0].GetLineEntry().GetLine()
     hit_line = cur_line == target_line
     if fail_if_wrong:
         self.assertTrue(
             hit_line,
             "Stepped to line %d instead of expected %d "
             "with pattern '%s'." % (cur_line, target_line, pattern))
     return hit_line
Пример #12
0
    def setUp(self):
        # Call super's setUp().
        super(DarwinNSLogOutputTestCase, self).setUp()
        self.child = None
        self.child_prompt = '(lldb) '
        self.strict_sources = False

        # Source filename.
        self.source = 'main.m'

        # Output filename.
        self.exe_name = 'a.out'
        self.d = {'OBJC_SOURCES': self.source, 'EXE': self.exe_name}

        # Locate breakpoint.
        self.line = lldbtest.line_number(self.source, '// break here')
    def setUp(self):
        # Call super's setUp().
        super(TestDarwinLogSourceDebug, self).setUp()

        # Source filename.
        self.source = 'main.c'

        # Output filename.
        self.exe_name = self.getBuildArtifact("a.out")
        self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}

        # Locate breakpoint.
        self.line = lldbtest.line_number(self.source, '// break here')

        # Indicate we want strict-sources behavior.
        self.strict_sources = True
Пример #14
0
    def setUp(self):
        # Call super's setUp().
        super(TestDarwinLogSourceInfo, self).setUp()

        # Source filename.
        self.source = 'main.c'

        # Output filename.
        self.exe_name = 'a.out'
        self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}

        # Locate breakpoint.
        self.line = lldbtest.line_number(self.source, '// break here')

        # Indicate we want strict-sources behavior.
        self.strict_sources = True
Пример #15
0
    def setUp(self):
        # Call super's setUp().
        super(DarwinNSLogOutputTestCase, self).setUp()
        self.child = None
        self.child_prompt = '(lldb) '
        self.strict_sources = False

        # Source filename.
        self.source = 'main.m'

        # Output filename.
        self.exe_name = self.getBuildArtifact("a.out")
        self.d = {'OBJC_SOURCES': self.source, 'EXE': self.exe_name}

        # Locate breakpoint.
        self.line = lldbtest.line_number(self.source, '// break here')
Пример #16
0
    def setUp(self):
        # Call super's setUp().
        super(TestDarwinLogFilterMatchMessage, self).setUp()

        # Source filename.
        self.source = 'main.c'

        # Output filename.
        self.exe_name = 'a.out'
        self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}

        # Locate breakpoint.
        self.line = lldbtest.line_number(self.source, '// break here')

        self.strict_sources = True

        # Turn on process monitor logging while we work out issues.
        self.enable_process_monitor_logging = True
    def setUp(self):
        # Call super's setUp().
        super(TestDarwinLogFilterMatchMessage, self).setUp()

        # Source filename.
        self.source = 'main.c'

        # Output filename.
        self.exe_name = self.getBuildArtifact("a.out")
        self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}

        # Locate breakpoint.
        self.line = lldbtest.line_number(self.source, '// break here')

        self.strict_sources = True

        # Turn on process monitor logging while we work out issues.
        self.enable_process_monitor_logging = True
 def setUp(self):
     lldbtest.TestBase.setUp(self)
     self.main_source = "main.swift"
     self.main_source_spec = lldb.SBFileSpec(self.main_source)
     self.line_breakpoint = lldbtest.line_number(self.main_source,
                                                 '// breakpoint')
Пример #19
0
 def setUp(self):
     lldbtest.TestBase.setUp(self)
     self.main_source = "main.swift"
     self.main_source_spec = lldb.SBFileSpec(self.main_source)
     self.line_breakpoint = lldbtest.line_number(
         self.main_source, '// breakpoint')