示例#1
0
    def TestPDFiumTest(self, script_name):
        # Build the command line in 'cmd'.
        # It's going to be roughly
        #  python valgrind_test.py ...
        # but we'll use the --indirect_pdfium_test flag to valgrind_test.py
        # to avoid valgrinding python.

        # Start by building the valgrind_test.py commandline.
        tool = valgrind_test.CreateTool(self._options.valgrind_tool)
        cmd = self._DefaultCommand(tool)
        cmd.append("--trace_children")
        cmd.append("--indirect_pdfium_test")
        cmd.append("--ignore_exit_code")
        # Now build script_cmd, the run_corpus_tests commandline.
        script = os.path.join(self._source_dir, "testing", "tools",
                              script_name)
        script_cmd = ["python", script]
        if self._options.build_dir:
            script_cmd.extend(["--build-dir", self._options.build_dir])
        # TODO(zhaoqin): it only runs in single process mode now,
        # need figure out why it does not work with test_one_file_parallel
        # in run_corpus_tests.py.
        if script_name == "run_corpus_tests.py":
            script_cmd.extend(["-j", "1"])
        # Now run script_cmd with the wrapper in cmd
        cmd.append("--")
        cmd.extend(script_cmd)

        ret = tool.Run(cmd, "layout", min_runtime_in_seconds=0)
        return ret
    def SimpleTest(self, module, name, valgrind_test_args=None, cmd_args=None):
        tool = valgrind_test.CreateTool(self._options.valgrind_tool)
        cmd = self._DefaultCommand(tool, name, valgrind_test_args)
        self._AppendGtestFilter(tool, name, cmd)
        if cmd_args:
            cmd.extend(cmd_args)

        self.SetupLdPath(True)
        return tool.Run(cmd, module)
示例#3
0
 def TestLayoutChunk(self, chunk_num, chunk_size):
   # Run tests [chunk_num*chunk_size .. (chunk_num+1)*chunk_size) from the
   # list of tests.  Wrap around to beginning of list at end.
   # If chunk_size is zero, run all tests in the list once.
   # If a text file is given as argument, it is used as the list of tests.
   #
   # Build the ginormous commandline in 'cmd'.
   # It's going to be roughly
   #  python valgrind_test.py ... python run_webkit_tests.py ...
   # but we'll use the --indirect flag to valgrind_test.py
   # to avoid valgrinding python.
   # Start by building the valgrind_test.py commandline.
   tool = valgrind_test.CreateTool(self._options.valgrind_tool)
   cmd = self._DefaultCommand(tool)
   cmd.append("--trace_children")
   cmd.append("--indirect_webkit_layout")
   cmd.append("--ignore_exit_code")
   # Now build script_cmd, the run_webkits_tests.py commandline
   # Store each chunk in its own directory so that we can find the data later
   chunk_dir = os.path.join("layout", "chunk_%05d" % chunk_num)
   test_shell = os.path.join(self._options.build_dir, "test_shell")
   out_dir = os.path.join(path_utils.ScriptDir(), "latest")
   out_dir = os.path.join(out_dir, chunk_dir)
   if os.path.exists(out_dir):
     old_files = glob.glob(os.path.join(out_dir, "*.txt"))
     for f in old_files:
       os.remove(f)
   else:
     os.makedirs(out_dir)
   script = os.path.join(self._source_dir, "webkit", "tools", "layout_tests",
                         "run_webkit_tests.py")
   script_cmd = ["python", script, "-v",
                 "--run-singly",  # run a separate DumpRenderTree for each test
                 "--experimental-fully-parallel",
                 "--time-out-ms=200000",
                 "--noshow-results",
                 "--nocheck-sys-deps"]
   # Pass build mode to run_webkit_tests.py.  We aren't passed it directly,
   # so parse it out of build_dir.  run_webkit_tests.py can only handle
   # the two values "Release" and "Debug".
   # TODO(Hercules): unify how all our scripts pass around build mode
   # (--mode / --target / --build_dir / --debug)
   if self._options.build_dir.endswith("Debug"):
     script_cmd.append("--debug");
   if (chunk_size > 0):
     script_cmd.append("--run-chunk=%d:%d" % (chunk_num, chunk_size))
   if len(self._args):
     # if the arg is a txt file, then treat it as a list of tests
     if os.path.isfile(self._args[0]) and self._args[0][-4:] == ".txt":
       script_cmd.append("--test-list=%s" % self._args[0])
     else:
       script_cmd.extend(self._args)
   self._AppendGtestFilter(tool, "layout", script_cmd)
   # Now run script_cmd with the wrapper in cmd
   cmd.extend(["--"])
   cmd.extend(script_cmd)
   return tool.Run(cmd, "layout")
示例#4
0
  def SimpleTest(self, module, name, valgrind_test_args=None, cmd_args=None):
    tool = valgrind_test.CreateTool(self._options.valgrind_tool)
    cmd = self._DefaultCommand(tool, module, name, valgrind_test_args)
    self._ReadGtestFilterFile(tool, name, cmd)
    if cmd_args:
      cmd.extend(["--"])
      cmd.extend(cmd_args)

    # Sets LD_LIBRARY_PATH to the build folder so external libraries can be
    # loaded.
    if (os.getenv("LD_LIBRARY_PATH")):
      os.putenv("LD_LIBRARY_PATH", "%s:%s" % (os.getenv("LD_LIBRARY_PATH"),
                                              self._options.build_dir))
    else:
      os.putenv("LD_LIBRARY_PATH", self._options.build_dir)
    return tool.Run(cmd, module)
    def TestLayoutChunk(self, chunk_num, chunk_size):
        # Run tests [chunk_num*chunk_size .. (chunk_num+1)*chunk_size) from the
        # list of tests.  Wrap around to beginning of list at end.
        # If chunk_size is zero, run all tests in the list once.
        # If a text file is given as argument, it is used as the list of tests.
        #
        # Build the ginormous commandline in 'cmd'.
        # It's going to be roughly
        #  python valgrind_test.py ... python run_webkit_tests.py ...
        # but we'll use the --indirect flag to valgrind_test.py
        # to avoid valgrinding python.
        # Start by building the valgrind_test.py commandline.
        tool = valgrind_test.CreateTool(self._options.valgrind_tool)
        cmd = self._DefaultCommand(tool)
        cmd.append("--trace_children")
        cmd.append("--indirect_webkit_layout")
        cmd.append("--ignore_exit_code")
        # Now build script_cmd, the run_webkits_tests.py commandline
        # Store each chunk in its own directory so that we can find the data later
        chunk_dir = os.path.join("layout", "chunk_%05d" % chunk_num)
        out_dir = os.path.join(path_utils.ScriptDir(), "latest")
        out_dir = os.path.join(out_dir, chunk_dir)
        if os.path.exists(out_dir):
            old_files = glob.glob(os.path.join(out_dir, "*.txt"))
            for f in old_files:
                os.remove(f)
        else:
            os.makedirs(out_dir)
        script = os.path.join(self._source_dir, "webkit", "tools",
                              "layout_tests", "run_webkit_tests.py")
        # http://crbug.com/260627: After the switch to content_shell from DRT, each
        # test now brings up 3 processes.  Under Valgrind, they become memory bound
        # and can eventually OOM if we don't reduce the total count.
        # It'd be nice if content_shell automatically throttled the startup of new
        # tests if we're low on memory.
        jobs = max(1, int(multiprocessing.cpu_count() * 0.3))
        script_cmd = [
            "python",
            script,
            "-v",
            # run a separate DumpRenderTree for each test
            "--batch-size=1",
            "--fully-parallel",
            "--child-processes=%d" % jobs,
            "--time-out-ms=800000",
            "--no-retry-failures",  # retrying takes too much time
            # http://crbug.com/176908: Don't launch a browser when done.
            "--no-show-results",
            "--nocheck-sys-deps"
        ]
        # Pass build mode to run_webkit_tests.py.  We aren't passed it directly,
        # so parse it out of build_dir.  run_webkit_tests.py can only handle
        # the two values "Release" and "Debug".
        # TODO(Hercules): unify how all our scripts pass around build mode
        # (--mode / --target / --build-dir / --debug)
        if self._options.build_dir:
            build_root, mode = os.path.split(self._options.build_dir)
            script_cmd.extend(
                ["--build-directory", build_root, "--target", mode])
        if (chunk_size > 0):
            script_cmd.append("--run-chunk=%d:%d" % (chunk_num, chunk_size))
        if len(self._args):
            # if the arg is a txt file, then treat it as a list of tests
            if os.path.isfile(self._args[0]) and self._args[0][-4:] == ".txt":
                script_cmd.append("--test-list=%s" % self._args[0])
            else:
                script_cmd.extend(self._args)
        self._AppendGtestFilter(tool, "layout", script_cmd)
        # Now run script_cmd with the wrapper in cmd
        cmd.extend(["--"])
        cmd.extend(script_cmd)

        # Layout tests often times fail quickly, but the buildbot remains green.
        # Detect this situation when running with the default chunk size.
        if chunk_size == self.LAYOUT_TESTS_DEFAULT_CHUNK_SIZE:
            min_runtime_in_seconds = 120
        else:
            min_runtime_in_seconds = 0
        ret = tool.Run(cmd,
                       "layout",
                       min_runtime_in_seconds=min_runtime_in_seconds)
        return ret
 def RunCmdLine(self):
     tool = valgrind_test.CreateTool(self._options.valgrind_tool)
     cmd = self._DefaultCommand(tool, None, self._args)
     self.SetupLdPath(False)
     return tool.Run(cmd, None)