Ejemplo n.º 1
0
 def TestUnit(self):
     # http://crbug.com/51716
     # Disabling all unit tests
     # Problems reappeared after r119922
     if common.IsMac() and (self._options.valgrind_tool == "memcheck"):
         logging.warning("unit_tests are disabled for memcheck on MacOS.")
         return 0
     return self.SimpleTest("chrome", "unit_tests")
  def Run(self, args, module, min_runtime_in_seconds=0):
    MODULES_TO_SANITY_CHECK = ["base"]

    # TODO(timurrrr): this is a temporary workaround for http://crbug.com/47844
    if self.ToolName() == "tsan" and common.IsMac():
      MODULES_TO_SANITY_CHECK = []

    check_sanity = module in MODULES_TO_SANITY_CHECK
    return self.Main(args, check_sanity, min_runtime_in_seconds)
  def ToolSpecificFlags(self):
    ret = ["--gen-suppressions=all", "--demangle=no"]
    ret += ["--leak-check=%s" % self._options.leak_check]

    if self._options.show_all_leaks:
      ret += ["--show-reachable=yes"]
    else:
      ret += ["--show-possibly-lost=no"]

    if self._options.track_origins:
      ret += ["--track-origins=yes"]

    # TODO(glider): this is a temporary workaround for http://crbug.com/51716
    # Let's see whether it helps.
    if common.IsMac():
      ret += ["--smc-check=all"]

    return ret
 def CreateAnalyzer(self):
   use_gdb = common.IsMac()
   return tsan_analyze.TsanAnalyzer(use_gdb)
 def CreateAnalyzer(self):
   use_gdb = common.IsMac()
   return memcheck_analyze.MemcheckAnalyzer(self._source_dir,
                                           self._options.show_all_leaks,
                                           use_gdb=use_gdb)
 def Setup(self, args):
   if not BaseTool.Setup(self, args):
     return False
   if common.IsMac():
     self.PrepareForTestMac()
   return True
 def __init__(self):
   super(Asan, self).__init__()
   self._timeout = 1200
   if common.IsMac():
     self._env["DYLD_NO_PIE"] = "1"
 def CreateAnalyzer(self):
   use_gdb = common.IsMac()
   self.analyzer = ThreadSanitizerRV1Analyzer(self._source_dir, use_gdb)
   return self.analyzer
Ejemplo n.º 9
0
    def _DefaultCommand(self, tool, exe=None, valgrind_test_args=None):
        '''Generates the default command array that most tests will use.'''
        if exe and common.IsWindows():
            exe += '.exe'

        cmd = list(self._command_preamble)

        # Find all suppressions matching the following pattern:
        # tools/valgrind/TOOL/suppressions[_PLATFORM].txt
        # and list them with --suppressions= prefix.
        script_dir = path_utils.ScriptDir()
        tool_name = tool.ToolName()
        suppression_file = os.path.join(script_dir, tool_name,
                                        "suppressions.txt")
        if os.path.exists(suppression_file):
            cmd.append("--suppressions=%s" % suppression_file)
        # Platform-specific suppression
        for platform in common.PlatformNames():
            platform_suppression_file = \
                os.path.join(script_dir, tool_name, 'suppressions_%s.txt' % platform)
            if os.path.exists(platform_suppression_file):
                cmd.append("--suppressions=%s" % platform_suppression_file)

        if tool_name == "drmemory":
            if self._options.drmemory_ops:
                # prepending " " to avoid Dr. Memory's option confusing optparse
                cmd += ["--drmemory_ops", " " + self._options.drmemory_ops]

        if self._options.valgrind_tool_flags:
            cmd += self._options.valgrind_tool_flags.split(" ")
        if self._options.keep_logs:
            cmd += ["--keep_logs"]
        if valgrind_test_args != None:
            for arg in valgrind_test_args:
                cmd.append(arg)
        if exe:
            self._EnsureBuildDirFound()
            exe_path = os.path.join(self._options.build_dir, exe)
            if not os.path.exists(exe_path):
                raise ExecutableNotFound("Couldn't find '%s'" % exe_path)

            # Make sure we don't try to test ASan-built binaries
            # with other dynamic instrumentation-based tools.
            # TODO(timurrrr): also check TSan and MSan?
            # `nm` might not be available, so use try-except.
            try:
                # Do not perform this check on OS X, as 'nm' on 10.6 can't handle
                # binaries built with Clang 3.5+.
                if not common.IsMac():
                    nm_output = subprocess.check_output(["nm", exe_path])
                    if nm_output.find("__asan_init") != -1:
                        raise BadBinary(
                            "You're trying to run an executable instrumented "
                            "with AddressSanitizer under %s. Please provide "
                            "an uninstrumented executable." % tool_name)
            except OSError:
                pass

            cmd.append(exe_path)
            # Valgrind runs tests slowly, so slow tests hurt more; show elapased time
            # so we can find the slowpokes.
            cmd.append("--gtest_print_time")
            # Built-in test launcher for gtest-based executables runs tests using
            # multiple process by default. Force the single-process mode back.
            cmd.append("--single-process-tests")
        if self._options.gtest_repeat:
            cmd.append("--gtest_repeat=%s" % self._options.gtest_repeat)
        if self._options.gtest_shuffle:
            cmd.append("--gtest_shuffle")
        if self._options.gtest_break_on_failure:
            cmd.append("--gtest_break_on_failure")
        if self._options.test_launcher_bot_mode:
            cmd.append("--test-launcher-bot-mode")
        if self._options.test_launcher_total_shards is not None:
            cmd.append("--test-launcher-total-shards=%d" %
                       self._options.test_launcher_total_shards)
        if self._options.test_launcher_shard_index is not None:
            cmd.append("--test-launcher-shard-index=%d" %
                       self._options.test_launcher_shard_index)
        return cmd
Ejemplo n.º 10
0
 def CreateAnalyzer(self):
   use_gdb = common.IsMac()
   return tsan_analyze.TsanAnalyzer(self._source_dir, use_gdb)