Exemple #1
0
 def ListTests(self, context):
     shell = os.path.abspath(os.path.join(context.shell_dir, self.shell()))
     if utils.IsWindows():
         shell += ".exe"
     output = commands.Execute(context.command_prefix + [shell, "--list"] +
                               context.extra_flags)
     if output.exit_code != 0:
         print output.stdout
         print output.stderr
         return []
     tests = []
     for test_desc in output.stdout.strip().split():
         if test_desc.find('<') < 0:
             # Native Client output can contain a few non-test arguments
             # before the tests. Skip these.
             continue
         raw_test, dependency = test_desc.split('<')
         if dependency != '':
             dependency = raw_test.split('/')[0] + '/' + dependency
         else:
             dependency = None
         test = testcase.TestCase(self, raw_test, dependency=dependency)
         tests.append(test)
     tests.sort()
     return tests
Exemple #2
0
 def _Run(self, runnable, count, no_patch=False):
     suffix = ' - without patch' if no_patch else ''
     shell_dir = self.shell_dir_no_patch if no_patch else self.shell_dir
     title = ">>> %%s (#%d)%s:" % ((count + 1), suffix)
     try:
         output = commands.Execute(
             runnable.GetCommand(shell_dir, self.extra_flags),
             timeout=runnable.timeout,
         )
     except OSError as e:  # pragma: no cover
         print title % "OSError"
         print e
         return ""
     self._PrintStdout(title, output)
     if output.stderr:  # pragma: no cover
         # Print stderr for debugging.
         print title % "Stderr"
         print output.stderr
     if output.timed_out:
         print ">>> Test timed out after %ss." % runnable.timeout
     if '--prof' in self.extra_flags:
         os_prefix = {"linux": "linux", "macos": "mac"}.get(utils.GuessOS())
         if os_prefix:
             tick_tools = os.path.join(TOOLS_BASE,
                                       "%s-tick-processor" % os_prefix)
             subprocess.check_call(tick_tools + " --only-summary",
                                   shell=True)
         else:  # pragma: no cover
             print "Profiler option currently supported on Linux and Mac OS."
     return output.stdout
Exemple #3
0
 def ListTests(self, context):
     shell = os.path.abspath(os.path.join(context.shell_dir, self.shell()))
     if utils.IsWindows():
         shell += ".exe"
     output = commands.Execute(context.command_prefix + [
         shell, "--allow-natives-syntax", "-e",
         "try { var natives = %ListNatives();"
         "  for (var n in natives) { print(natives[n]); }"
         "} catch(e) {}"
     ] + context.extra_flags)
     if output.exit_code != 0:
         print output.stdout
         print output.stderr
         assert False, "Failed to get natives list."
     tests = []
     for line in output.stdout.strip().split():
         try:
             (name, argc) = line.split(",")
             flags = [
                 "--allow-natives-syntax", "-e",
                 "var NAME = '%s', ARGC = %s;" % (name, argc)
             ]
             test = testcase.TestCase(self, name, flags)
             tests.append(test)
         except:
             # Work-around: If parsing didn't work, it might have been due to output
             # caused by other d8 flags.
             pass
     return tests
Exemple #4
0
 def Run(self, runnable, count):
     output = commands.Execute(runnable.GetCommand(self.shell_dir),
                               timeout=runnable.timeout)
     print ">>> Stdout (#%d):" % (count + 1)
     print output.stdout
     if output.stderr:  # pragma: no cover
         # Print stderr for debugging.
         print ">>> Stderr (#%d):" % (count + 1)
         print output.stderr
     if output.timed_out:
         print ">>> Test timed out after %ss." % runnable.timeout
     return output.stdout
Exemple #5
0
 def Runner():
   """Output generator that reruns several times."""
   for i in xrange(0, max(1, runnable.run_count)):
     # TODO(machenbach): Make timeout configurable in the suite definition.
     # Allow timeout per arch like with run_count per arch.
     output = commands.Execute(runnable.GetCommand(shell_dir), timeout=60)
     print ">>> Stdout (#%d):" % (i + 1)
     print output.stdout
     if output.stderr:  # pragma: no cover
       # Print stderr for debugging.
       print ">>> Stderr (#%d):" % (i + 1)
       print output.stderr
     yield output.stdout
Exemple #6
0
 def ListTests(self, context):
     shell = os.path.abspath(os.path.join(context.shell_dir, self.shell()))
     if utils.IsWindows():
         shell += ".exe"
     output = commands.Execute(context.command_prefix + [shell, "--list"] +
                               context.extra_flags)
     if output.exit_code != 0:
         print output.stdout
         print output.stderr
         return []
     tests = []
     for test_desc in output.stdout.strip().split():
         test = testcase.TestCase(self, test_desc)
         tests.append(test)
     tests.sort()
     return tests
Exemple #7
0
 def Runner():
     """Output generator that reruns several times."""
     for i in xrange(0, max(1, runnable.run_count)):
         # TODO(machenbach): Allow timeout per arch like with run_count per
         # arch.
         output = commands.Execute(runnable.GetCommand(shell_dir),
                                   timeout=runnable.timeout)
         print ">>> Stdout (#%d):" % (i + 1)
         print output.stdout
         if output.stderr:  # pragma: no cover
             # Print stderr for debugging.
             print ">>> Stderr (#%d):" % (i + 1)
             print output.stderr
         if output.timed_out:
             print ">>> Test timed out after %ss." % runnable.timeout
         yield output.stdout
Exemple #8
0
 def Run(self, runnable, count):
     try:
         output = commands.Execute(
             runnable.GetCommand(self.shell_dir, self.extra_flags),
             timeout=runnable.timeout,
         )
     except OSError as e:
         print ">>> OSError (#%d):" % (count + 1)
         print e
         return ""
     print ">>> Stdout (#%d):" % (count + 1)
     print output.stdout
     if output.stderr:  # pragma: no cover
         # Print stderr for debugging.
         print ">>> Stderr (#%d):" % (count + 1)
         print output.stderr
     if output.timed_out:
         print ">>> Test timed out after %ss." % runnable.timeout
     return output.stdout
Exemple #9
0
    def _Run(self, runnable, count, secondary=False):
        suffix = ' - secondary' if secondary else ''
        shell_dir = self.shell_dir_secondary if secondary else self.shell_dir
        title = ">>> %%s (#%d)%s:" % ((count + 1), suffix)
        if runnable.process_size:
            command = ["/usr/bin/time", "--format=MaxMemory: %MKB"]
        else:
            command = []

        command += self.command_prefix + runnable.GetCommand(
            shell_dir, self.extra_flags)
        try:
            output = commands.Execute(
                command,
                timeout=runnable.timeout,
            )
        except OSError as e:  # pragma: no cover
            print title % "OSError"
            print e
            return ""

        print title % "Stdout"
        print output.stdout
        if output.stderr:  # pragma: no cover
            # Print stderr for debugging.
            print title % "Stderr"
            print output.stderr
        if output.timed_out:
            print ">>> Test timed out after %ss." % runnable.timeout
        if '--prof' in self.extra_flags:
            os_prefix = {"linux": "linux", "macos": "mac"}.get(utils.GuessOS())
            if os_prefix:
                tick_tools = os.path.join(TOOLS_BASE,
                                          "%s-tick-processor" % os_prefix)
                subprocess.check_call(tick_tools + " --only-summary",
                                      shell=True)
            else:  # pragma: no cover
                print "Profiler option currently supported on Linux and Mac OS."

        # time outputs to stderr
        if runnable.process_size:
            return output.stdout + output.stderr
        return output.stdout
Exemple #10
0
 def ListTests(self, context):
     shell = join(context.shell_dir, self.shell())
     if utils.IsWindows():
         shell += '.exe'
     output = commands.Execute([shell, '--list'])
     if output.exit_code != 0:
         print output.stdout
         print output.stderr
         return []
     tests = []
     for test_desc in output.stdout.strip().split():
         raw_test, dependency = test_desc.split('<')
         if dependency != '':
             dependency = raw_test.split('/')[0] + '/' + dependency
         else:
             dependency = None
         test = testcase.TestCase(self, raw_test, dependency=dependency)
         tests.append(test)
     tests.sort()
     return tests
Exemple #11
0
 def _Run(self, runnable, count, no_patch=False):
     suffix = ' - without patch' if no_patch else ''
     shell_dir = self.shell_dir_no_patch if no_patch else self.shell_dir
     title = ">>> %%s (#%d)%s:" % ((count + 1), suffix)
     try:
         output = commands.Execute(
             runnable.GetCommand(shell_dir, self.extra_flags),
             timeout=runnable.timeout,
         )
     except OSError as e:  # pragma: no cover
         print title % "OSError"
         print e
         return ""
     print title % "Stdout"
     print output.stdout
     if output.stderr:  # pragma: no cover
         # Print stderr for debugging.
         print title % "Stderr"
         print output.stderr
     if output.timed_out:
         print ">>> Test timed out after %ss." % runnable.timeout
     return output.stdout