diff options
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/binutils.py | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/binutils.py b/meta/lib/oeqa/selftest/cases/binutils.py new file mode 100644 index 0000000000..4edee09390 --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/binutils.py | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | # SPDX-License-Identifier: MIT | ||
| 2 | import os | ||
| 3 | import sys | ||
| 4 | import re | ||
| 5 | import logging | ||
| 6 | from oeqa.core.decorator import OETestTag | ||
| 7 | from oeqa.selftest.case import OESelftestTestCase | ||
| 8 | from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars | ||
| 9 | |||
| 10 | def parse_values(content): | ||
| 11 | for i in content: | ||
| 12 | for v in ["PASS", "FAIL", "XPASS", "XFAIL", "UNRESOLVED", "UNSUPPORTED", "UNTESTED", "ERROR", "WARNING"]: | ||
| 13 | if i.startswith(v + ": "): | ||
| 14 | yield i[len(v) + 2:].strip(), v | ||
| 15 | break | ||
| 16 | |||
| 17 | @OETestTag("machine") | ||
| 18 | class BinutilsCrossSelfTest(OESelftestTestCase): | ||
| 19 | @classmethod | ||
| 20 | def setUpClass(cls): | ||
| 21 | super().setUpClass() | ||
| 22 | if not hasattr(cls.tc, "extraresults"): | ||
| 23 | cls.tc.extraresults = {} | ||
| 24 | |||
| 25 | if "ptestresult.sections" not in cls.tc.extraresults: | ||
| 26 | cls.tc.extraresults["ptestresult.sections"] = {} | ||
| 27 | |||
| 28 | def test_binutils(self): | ||
| 29 | self.run_binutils("binutils") | ||
| 30 | |||
| 31 | def test_gas(self): | ||
| 32 | self.run_binutils("gas") | ||
| 33 | |||
| 34 | def test_ld(self): | ||
| 35 | self.run_binutils("ld") | ||
| 36 | |||
| 37 | def run_binutils(self, suite): | ||
| 38 | features = [] | ||
| 39 | features.append('CHECK_TARGETS = "{0}"'.format(suite)) | ||
| 40 | self.write_config("\n".join(features)) | ||
| 41 | |||
| 42 | recipe = "binutils-cross-testsuite" | ||
| 43 | bb_vars = get_bb_vars(["B", "TARGET_SYS", "T"], recipe) | ||
| 44 | builddir, target_sys, tdir = bb_vars["B"], bb_vars["TARGET_SYS"], bb_vars["T"] | ||
| 45 | |||
| 46 | bitbake("{0} -c check".format(recipe)) | ||
| 47 | |||
| 48 | ptestsuite = "binutils-{}".format(suite) if suite != "binutils" else suite | ||
| 49 | self.tc.extraresults["ptestresult.sections"][ptestsuite] = {} | ||
| 50 | |||
| 51 | sumspath = os.path.join(builddir, suite, "{0}.sum".format(suite)) | ||
| 52 | if not os.path.exists(sumspath): | ||
| 53 | sumspath = os.path.join(builddir, suite, "testsuite", "{0}.sum".format(suite)) | ||
| 54 | |||
| 55 | failed = 0 | ||
| 56 | with open(sumspath, "r") as f: | ||
| 57 | for test, result in parse_values(f): | ||
| 58 | self.tc.extraresults["ptestresult.{}.{}".format(ptestsuite, test)] = {"status" : result} | ||
| 59 | if result == "FAIL": | ||
| 60 | self.logger.info("failed: '{}'".format(test)) | ||
| 61 | failed += 1 | ||
| 62 | |||
| 63 | self.assertEqual(failed, 0) | ||
| 64 | |||
