poky/meta/lib/oeqa/selftest/cases/binutils.py
Nathan Rossi db1cc0b533 oeqa/selftest: Use extraresults on self instead of self.tc
In order to take advantage of multiprocess execution of tests the
extraresults must be passed through the TestResult. With changes to how
oeqa/core handles test cases the extraresults attribute of the testcase
is passed to the TestResult, with passing across process boundaries
handled automatically.

(From OE-Core rev: 6a1b0c2003a0b4a1983f9494440e6ea02dc25585)

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-07 21:56:43 +01:00

50 lines
1.7 KiB
Python

# SPDX-License-Identifier: MIT
import os
import sys
import re
import logging
from oeqa.core.decorator import OETestTag
from oeqa.selftest.case import OESelftestTestCase
from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars
def parse_values(content):
for i in content:
for v in ["PASS", "FAIL", "XPASS", "XFAIL", "UNRESOLVED", "UNSUPPORTED", "UNTESTED", "ERROR", "WARNING"]:
if i.startswith(v + ": "):
yield i[len(v) + 2:].strip(), v
break
@OETestTag("machine")
class BinutilsCrossSelfTest(OESelftestTestCase):
def test_binutils(self):
self.run_binutils("binutils")
def test_gas(self):
self.run_binutils("gas")
def test_ld(self):
self.run_binutils("ld")
def run_binutils(self, suite):
features = []
features.append('CHECK_TARGETS = "{0}"'.format(suite))
self.write_config("\n".join(features))
recipe = "binutils-cross-testsuite"
bb_vars = get_bb_vars(["B", "TARGET_SYS", "T"], recipe)
builddir, target_sys, tdir = bb_vars["B"], bb_vars["TARGET_SYS"], bb_vars["T"]
bitbake("{0} -c check".format(recipe))
ptestsuite = "binutils-{}".format(suite) if suite != "binutils" else suite
self.extraresults = {"ptestresult.sections" : {ptestsuite : {}}}
sumspath = os.path.join(builddir, suite, "{0}.sum".format(suite))
if not os.path.exists(sumspath):
sumspath = os.path.join(builddir, suite, "testsuite", "{0}.sum".format(suite))
with open(sumspath, "r") as f:
for test, result in parse_values(f):
self.extraresults["ptestresult.{}.{}".format(ptestsuite, test)] = {"status" : result}