コード例 #1
0
    def post_to_autolog(self, results, name):
        from moztest.results import TestContext, TestResult, TestResultCollection
        from moztest.output.autolog import AutologOutput

        context = TestContext(
            testgroup='b2g xpcshell testsuite',
            operating_system='android',
            arch='emulator',
            harness='xpcshell',
            hostname=socket.gethostname(),
            tree='b2g',
            buildtype='opt',
        )

        collection = TestResultCollection('b2g emulator testsuite')

        for result in results:
            duration = result.get('time', 0)

            if 'skipped' in result:
                outcome = 'SKIPPED'
            elif 'todo' in result:
                outcome = 'KNOWN-FAIL'
            elif result['passed']:
                outcome = 'PASS'
            else:
                outcome = 'UNEXPECTED-FAIL'

            output = None
            if 'failure' in result:
                output = result['failure']['text']

            t = TestResult(name=result['name'],
                           test_class=name,
                           time_start=0,
                           context=context)
            t.finish(result=outcome, time_end=duration, output=output)

            collection.append(t)
            collection.time_taken += duration

        out = AutologOutput()
        out.post(out.make_testgroups(collection))
コード例 #2
0
  def post_to_autolog(self, results, name):
    from moztest.results import TestContext, TestResult, TestResultCollection
    from moztest.output.autolog import AutologOutput

    context = TestContext(
        testgroup='b2g xpcshell testsuite',
        operating_system='android',
        arch='emulator',
        harness='xpcshell',
        hostname=socket.gethostname(),
        tree='b2g',
        buildtype='opt',
        )

    collection = TestResultCollection('b2g emulator testsuite')

    for result in results:
      duration = result.get('time', 0)

      if 'skipped' in result:
        outcome = 'SKIPPED'
      elif 'todo' in result:
        outcome = 'KNOWN-FAIL'
      elif result['passed']:
        outcome = 'PASS'
      else:
        outcome = 'UNEXPECTED-FAIL'

      output = None
      if 'failure' in result:
        output = result['failure']['text']

      t = TestResult(name=result['name'], test_class=name,
                     time_start=0, context=context)
      t.finish(result=outcome, time_end=duration, output=output)

      collection.append(t)
      collection.time_taken += duration

    out = AutologOutput()
    out.post(out.make_testgroups(collection))
コード例 #3
0
    def post_to_autolog(self, results, name):
        from moztest.results import TestContext, TestResult, TestResultCollection
        from moztest.output.autolog import AutologOutput

        context = TestContext(
            testgroup="b2g xpcshell testsuite",
            operating_system="android",
            arch="emulator",
            harness="xpcshell",
            hostname=socket.gethostname(),
            tree="b2g",
            buildtype="opt",
        )

        collection = TestResultCollection("b2g emulator testsuite")

        for result in results:
            duration = result.get("time", 0)

            if "skipped" in result:
                outcome = "SKIPPED"
            elif "todo" in result:
                outcome = "KNOWN-FAIL"
            elif result["passed"]:
                outcome = "PASS"
            else:
                outcome = "UNEXPECTED-FAIL"

            output = None
            if "failure" in result:
                output = result["failure"]["text"]

            t = TestResult(name=result["name"], test_class=name, time_start=0, context=context)
            t.finish(result=outcome, time_end=duration, output=output)

            collection.append(t)
            collection.time_taken += duration

        out = AutologOutput()
        out.post(out.make_testgroups(collection))