Ejemplo n.º 1
0
    def start_workunit(self, workunit):
        """Implementation of Reporter callback."""
        # We use these properties of the workunit to decide how to render information about it.
        is_bootstrap = workunit.has_label(WorkUnit.BOOTSTRAP)
        is_tool = workunit.has_label(WorkUnit.TOOL)
        is_multitool = workunit.has_label(WorkUnit.MULTITOOL)
        is_test = workunit.has_label(WorkUnit.TEST)

        # Get useful properties from the workunit.
        workunit_dict = workunit.to_dict()
        if workunit_dict['cmd']:
            workunit_dict['cmd'] = linkify(
                self._buildroot, workunit_dict['cmd'].replace('$', '\\\\$'))

        # Create the template arguments.
        args = {
            'indent':
            len(workunit.ancestors()) * 10,
            'html_path_base':
            self._html_path_base,
            'workunit':
            workunit_dict,
            'header_text':
            workunit.name,
            'initially_open':
            is_test or not (is_bootstrap or is_tool or is_multitool),
            'is_tool':
            is_tool,
            'is_multitool':
            is_multitool
        }
        args.update({
            'collapsible':
            lambda x: self._renderer.render_callable('collapsible', x, args)
        })

        # Render the workunit's div.
        s = self._renderer.render_name('workunit_start', args)

        if is_tool:
            # This workunit is a tool invocation, so render the appropriate content.
            # We use the same args, slightly modified.
            del args['initially_open']
            if is_test:
                # Have test framework stdout open by default, but not that of other tools.
                # This is an arbitrary choice, but one that turns out to be useful to users in practice.
                args['stdout_initially_open'] = True
            s += self._renderer.render_name('tool_invocation_start', args)

        # ... and we're done.
        self._emit(s)
Ejemplo n.º 2
0
    def start_workunit(self, workunit):
        """Implementation of Reporter callback."""
        # We use these properties of the workunit to decide how to render information about it.
        is_tool = workunit.has_label(WorkUnit.TOOL)
        is_multitool = workunit.has_label(WorkUnit.MULTITOOL)
        is_test = workunit.has_label(WorkUnit.TEST)

        # Get useful properties from the workunit.
        workunit_dict = workunit.to_dict()
        if workunit_dict["cmd"]:
            workunit_dict["cmd"] = linkify(self._buildroot, workunit_dict["cmd"].replace("$", "\\\\$"))

        # Create the template arguments.
        args = {
            "indent": len(workunit.ancestors()) * 10,
            "html_path_base": self._html_path_base,
            "workunit": workunit_dict,
            "header_text": workunit.name,
            "initially_open": is_test or not (is_tool or is_multitool),
            "is_tool": is_tool,
            "is_multitool": is_multitool,
        }
        args.update({"collapsible": lambda x: self._renderer.render_callable("collapsible", x, args)})

        # Render the workunit's div.
        s = self._renderer.render_name("workunit_start", args)

        if is_tool:
            # This workunit is a tool invocation, so render the appropriate content.
            # We use the same args, slightly modified.
            del args["initially_open"]
            if is_test:
                # Have test framework stdout open by default, but not that of other tools.
                # This is an arbitrary choice, but one that turns out to be useful to users in practice.
                args["stdout_initially_open"] = True
            s += self._renderer.render_name("tool_invocation_start", args)

        # ... and we're done.
        self._emit(s)
Ejemplo n.º 3
0
  def start_workunit(self, workunit):
    """Implementation of Reporter callback."""
    # We use these properties of the workunit to decide how to render information about it.
    is_bootstrap = workunit.has_label(WorkUnit.BOOTSTRAP)
    is_tool = workunit.has_label(WorkUnit.TOOL)
    is_multitool = workunit.has_label(WorkUnit.MULTITOOL)
    is_test = workunit.has_label(WorkUnit.TEST)

    # Get useful properties from the workunit.
    workunit_dict = workunit.to_dict()
    if workunit_dict['cmd']:
      workunit_dict['cmd'] = linkify(self._buildroot, workunit_dict['cmd'].replace('$', '\\\\$'))

    # Create the template arguments.
    args = { 'indent': len(workunit.ancestors()) * 10,
             'html_path_base': self._html_path_base,
             'workunit': workunit_dict,
             'header_text': workunit.name,
             'initially_open': is_test or not (is_bootstrap or is_tool or is_multitool),
             'is_tool': is_tool,
             'is_multitool': is_multitool }
    args.update({ 'collapsible': lambda x: self._renderer.render_callable('collapsible', x, args) })

    # Render the workunit's div.
    s = self._renderer.render_name('workunit_start', args)

    if is_tool:
      # This workunit is a tool invocation, so render the appropriate content.
      # We use the same args, slightly modified.
      del args['initially_open']
      if is_test:
        # Have test framework stdout open by default, but not that of other tools.
        # This is an arbitrary choice, but one that turns out to be useful to users in practice.
        args['stdout_initially_open'] = True
      s += self._renderer.render_name('tool_invocation_start', args)

    # ... and we're done.
    self._emit(s)
Ejemplo n.º 4
0
 def _htmlify_text(self, s):
     """Make text HTML-friendly."""
     colored = self._handle_ansi_color_codes(cgi.escape(str(s)))
     return linkify(self._buildroot, colored).replace('\n', '</br>')
Ejemplo n.º 5
0
 def _htmlify_text(self, s):
   """Make text HTML-friendly."""
   colored = self._handle_ansi_color_codes(cgi.escape(str(s)))
   return linkify(self._buildroot, colored).replace('\n', '</br>')
Ejemplo n.º 6
0
 def _do_test_linkify(self, expected_link, url):
   s = 'foo %s bar' % url
   expected = 'foo <a target="_blank" href="%s">%s</a> bar' % (expected_link, url)
   linkified = linkify(self._buildroot, s)
   self.assertEqual(expected, linkified)
Ejemplo n.º 7
0
 def _do_test_linkify(self, expected_link, url):
     s = 'foo %s bar' % url
     expected = 'foo <a target="_blank" href="%s">%s</a> bar' % (
         expected_link, url)
     linkified = linkify(self._buildroot, s)
     self.assertEqual(expected, linkified)