コード例 #1
0
  def SimpleTest(self, module, name, heapcheck_test_args=None, cmd_args=None):
    '''Builds the command line and runs the specified test.

    Args:
      module: The module name (corresponds to the dir in src/ where the test
              data resides).
      name: The executable name.
      heapcheck_test_args: Additional command line args for heap checker.
      cmd_args: Additional command line args for the test.
    '''
    cmd = self._DefaultCommand(module, name, heapcheck_test_args)
    supp = self.Suppressions()
    self._ReadGtestFilterFile(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 heapcheck_test.RunTool(cmd, supp, module)
コード例 #2
0
    def TestLayoutChunk(self, chunk_num, chunk_size):
        '''Runs tests [chunk_num*chunk_size .. (chunk_num+1)*chunk_size).

    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 heapcheck_test.py ... python run_webkit_tests.py ...
        # but we'll use the --indirect flag to heapcheck_test.py
        # to avoid heapchecking python.
        # Start by building the heapcheck_test.py commandline.
        cmd = self._DefaultCommand("webkit")

        # 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, "--run-singly", "-v", "--noshow-results",
            "--time-out-ms=200000", "--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._ReadGtestFilterFile("layout", script_cmd)

        # Now run script_cmd with the wrapper in cmd
        cmd.extend(["--"])
        cmd.extend(script_cmd)
        supp = self.Suppressions()
        return heapcheck_test.RunTool(cmd, supp, "layout")
コード例 #3
0
ファイル: chrome_tests.py プロジェクト: bbmjja8123/chromium-1
    def TestLayoutChunk(self, chunk_num, chunk_size):
        '''Runs tests [chunk_num*chunk_size .. (chunk_num+1)*chunk_size).

    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 heapcheck_test.py ... python run_webkit_tests.py ...
        # but we'll use the --indirect flag to heapcheck_test.py
        # to avoid heapchecking python.
        # Start by building the heapcheck_test.py commandline.
        cmd = self._DefaultCommand("webkit")

        # 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")
        # While Heapcheck is not memory bound like Valgrind for running layout tests
        # in parallel, it is still CPU bound. Many machines have hyper-threading
        # turned on, so the real number of cores is actually half.
        jobs = max(1, int(multiprocessing.cpu_count() * 0.5))
        script_cmd = [
            "python",
            script,
            "-v",
            "--run-singly",  # run a separate DumpRenderTree for each test
            "--fully-parallel",
            "--child-processes=%d" % jobs,
            "--time-out-ms=200000",
            "--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.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._ReadGtestFilterFile("layout", script_cmd)

        # Now run script_cmd with the wrapper in cmd
        cmd.extend(["--"])
        cmd.extend(script_cmd)
        supp = self.Suppressions()
        return heapcheck_test.RunTool(cmd, supp, "layout")