diff options
author | Nathan Rossi <nathan@nathanrossi.com> | 2019-09-11 14:13:07 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-09-16 23:02:43 +0100 |
commit | 6c7d657aaeb223c3136e916da34468af468397b7 (patch) | |
tree | 8d9657740e0b70d18f845052f5bbb65ad96f51f5 /meta | |
parent | e08f657220fa119793949e26b2837026956d4238 (diff) | |
download | poky-6c7d657aaeb223c3136e916da34468af468397b7.tar.gz |
oeqa/selftest: Rework toolchain tests to use OEPTestResultTestCase
Use OEPTestResultTestCase to collect results and add logfile collection
and compression.
(From OE-Core rev: b75aced558013a459f29617b53cf477cb9b387ac)
Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/binutils.py | 11 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/gcc.py | 9 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/glibc.py | 7 |
3 files changed, 15 insertions, 12 deletions
diff --git a/meta/lib/oeqa/selftest/cases/binutils.py b/meta/lib/oeqa/selftest/cases/binutils.py index 9bc752040f..821f52f5a8 100644 --- a/meta/lib/oeqa/selftest/cases/binutils.py +++ b/meta/lib/oeqa/selftest/cases/binutils.py | |||
@@ -4,6 +4,7 @@ import sys | |||
4 | import re | 4 | import re |
5 | import logging | 5 | import logging |
6 | from oeqa.core.decorator import OETestTag | 6 | from oeqa.core.decorator import OETestTag |
7 | from oeqa.core.case import OEPTestResultTestCase | ||
7 | from oeqa.selftest.case import OESelftestTestCase | 8 | from oeqa.selftest.case import OESelftestTestCase |
8 | from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars | 9 | from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars |
9 | 10 | ||
@@ -15,7 +16,7 @@ def parse_values(content): | |||
15 | break | 16 | break |
16 | 17 | ||
17 | @OETestTag("toolchain-user", "toolchain-system") | 18 | @OETestTag("toolchain-user", "toolchain-system") |
18 | class BinutilsCrossSelfTest(OESelftestTestCase): | 19 | class BinutilsCrossSelfTest(OESelftestTestCase, OEPTestResultTestCase): |
19 | def test_binutils(self): | 20 | def test_binutils(self): |
20 | self.run_binutils("binutils") | 21 | self.run_binutils("binutils") |
21 | 22 | ||
@@ -36,14 +37,14 @@ class BinutilsCrossSelfTest(OESelftestTestCase): | |||
36 | 37 | ||
37 | bitbake("{0} -c check".format(recipe)) | 38 | bitbake("{0} -c check".format(recipe)) |
38 | 39 | ||
39 | ptestsuite = "binutils-{}".format(suite) if suite != "binutils" else suite | ||
40 | self.extraresults = {"ptestresult.sections" : {ptestsuite : {}}} | ||
41 | |||
42 | sumspath = os.path.join(builddir, suite, "{0}.sum".format(suite)) | 40 | sumspath = os.path.join(builddir, suite, "{0}.sum".format(suite)) |
43 | if not os.path.exists(sumspath): | 41 | if not os.path.exists(sumspath): |
44 | sumspath = os.path.join(builddir, suite, "testsuite", "{0}.sum".format(suite)) | 42 | sumspath = os.path.join(builddir, suite, "testsuite", "{0}.sum".format(suite)) |
43 | logpath = os.path.splitext(sumspath)[0] + ".log" | ||
45 | 44 | ||
45 | ptestsuite = "binutils-{}".format(suite) if suite != "binutils" else suite | ||
46 | self.ptest_section(ptestsuite, logfile = logpath) | ||
46 | with open(sumspath, "r") as f: | 47 | with open(sumspath, "r") as f: |
47 | for test, result in parse_values(f): | 48 | for test, result in parse_values(f): |
48 | self.extraresults["ptestresult.{}.{}".format(ptestsuite, test)] = {"status" : result} | 49 | self.ptest_result(ptestsuite, test, result) |
49 | 50 | ||
diff --git a/meta/lib/oeqa/selftest/cases/gcc.py b/meta/lib/oeqa/selftest/cases/gcc.py index 2c25b5904c..5a917b9c44 100644 --- a/meta/lib/oeqa/selftest/cases/gcc.py +++ b/meta/lib/oeqa/selftest/cases/gcc.py | |||
@@ -1,6 +1,7 @@ | |||
1 | # SPDX-License-Identifier: MIT | 1 | # SPDX-License-Identifier: MIT |
2 | import os | 2 | import os |
3 | from oeqa.core.decorator import OETestTag | 3 | from oeqa.core.decorator import OETestTag |
4 | from oeqa.core.case import OEPTestResultTestCase | ||
4 | from oeqa.selftest.case import OESelftestTestCase | 5 | from oeqa.selftest.case import OESelftestTestCase |
5 | from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars, runqemu, Command | 6 | from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars, runqemu, Command |
6 | 7 | ||
@@ -11,7 +12,7 @@ def parse_values(content): | |||
11 | yield i[len(v) + 2:].strip(), v | 12 | yield i[len(v) + 2:].strip(), v |
12 | break | 13 | break |
13 | 14 | ||
14 | class GccSelfTestBase(OESelftestTestCase): | 15 | class GccSelfTestBase(OESelftestTestCase, OEPTestResultTestCase): |
15 | def check_skip(self, suite): | 16 | def check_skip(self, suite): |
16 | targets = get_bb_var("RUNTIMETARGET", "gcc-runtime").split() | 17 | targets = get_bb_var("RUNTIMETARGET", "gcc-runtime").split() |
17 | if suite not in targets: | 18 | if suite not in targets: |
@@ -41,20 +42,20 @@ class GccSelfTestBase(OESelftestTestCase): | |||
41 | bb_vars = get_bb_vars(["B", "TARGET_SYS"], recipe) | 42 | bb_vars = get_bb_vars(["B", "TARGET_SYS"], recipe) |
42 | builddir, target_sys = bb_vars["B"], bb_vars["TARGET_SYS"] | 43 | builddir, target_sys = bb_vars["B"], bb_vars["TARGET_SYS"] |
43 | 44 | ||
44 | self.extraresults = {"ptestresult.sections" : {}} | ||
45 | for suite in suites: | 45 | for suite in suites: |
46 | sumspath = os.path.join(builddir, "gcc", "testsuite", suite, "{0}.sum".format(suite)) | 46 | sumspath = os.path.join(builddir, "gcc", "testsuite", suite, "{0}.sum".format(suite)) |
47 | if not os.path.exists(sumspath): # check in target dirs | 47 | if not os.path.exists(sumspath): # check in target dirs |
48 | sumspath = os.path.join(builddir, target_sys, suite, "testsuite", "{0}.sum".format(suite)) | 48 | sumspath = os.path.join(builddir, target_sys, suite, "testsuite", "{0}.sum".format(suite)) |
49 | if not os.path.exists(sumspath): # handle libstdc++-v3 -> libstdc++ | 49 | if not os.path.exists(sumspath): # handle libstdc++-v3 -> libstdc++ |
50 | sumspath = os.path.join(builddir, target_sys, suite, "testsuite", "{0}.sum".format(suite.split("-")[0])) | 50 | sumspath = os.path.join(builddir, target_sys, suite, "testsuite", "{0}.sum".format(suite.split("-")[0])) |
51 | logpath = os.path.splitext(sumspath)[0] + ".log" | ||
51 | 52 | ||
52 | ptestsuite = "gcc-{}".format(suite) if suite != "gcc" else suite | 53 | ptestsuite = "gcc-{}".format(suite) if suite != "gcc" else suite |
53 | ptestsuite = ptestsuite + "-user" if ssh is None else ptestsuite | 54 | ptestsuite = ptestsuite + "-user" if ssh is None else ptestsuite |
54 | self.extraresults["ptestresult.sections"][ptestsuite] = {} | 55 | self.ptest_section(ptestsuite, logfile = logpath) |
55 | with open(sumspath, "r") as f: | 56 | with open(sumspath, "r") as f: |
56 | for test, result in parse_values(f): | 57 | for test, result in parse_values(f): |
57 | self.extraresults["ptestresult.{}.{}".format(ptestsuite, test)] = {"status" : result} | 58 | self.ptest_result(ptestsuite, test, result) |
58 | 59 | ||
59 | def run_check_emulated(self, *args, **kwargs): | 60 | def run_check_emulated(self, *args, **kwargs): |
60 | # build core-image-minimal with required packages | 61 | # build core-image-minimal with required packages |
diff --git a/meta/lib/oeqa/selftest/cases/glibc.py b/meta/lib/oeqa/selftest/cases/glibc.py index 2e42485dd6..c687f6ef93 100644 --- a/meta/lib/oeqa/selftest/cases/glibc.py +++ b/meta/lib/oeqa/selftest/cases/glibc.py | |||
@@ -2,6 +2,7 @@ | |||
2 | import os | 2 | import os |
3 | import contextlib | 3 | import contextlib |
4 | from oeqa.core.decorator import OETestTag | 4 | from oeqa.core.decorator import OETestTag |
5 | from oeqa.core.case import OEPTestResultTestCase | ||
5 | from oeqa.selftest.case import OESelftestTestCase | 6 | from oeqa.selftest.case import OESelftestTestCase |
6 | from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars, runqemu, Command | 7 | from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars, runqemu, Command |
7 | from oeqa.utils.nfs import unfs_server | 8 | from oeqa.utils.nfs import unfs_server |
@@ -13,7 +14,7 @@ def parse_values(content): | |||
13 | yield i[len(v) + 2:].strip(), v | 14 | yield i[len(v) + 2:].strip(), v |
14 | break | 15 | break |
15 | 16 | ||
16 | class GlibcSelfTestBase(OESelftestTestCase): | 17 | class GlibcSelfTestBase(OESelftestTestCase, OEPTestResultTestCase): |
17 | def run_check(self, ssh = None): | 18 | def run_check(self, ssh = None): |
18 | # configure ssh target | 19 | # configure ssh target |
19 | features = [] | 20 | features = [] |
@@ -31,10 +32,10 @@ class GlibcSelfTestBase(OESelftestTestCase): | |||
31 | builddir = get_bb_var("B", "glibc-testsuite") | 32 | builddir = get_bb_var("B", "glibc-testsuite") |
32 | 33 | ||
33 | ptestsuite = "glibc-user" if ssh is None else "glibc" | 34 | ptestsuite = "glibc-user" if ssh is None else "glibc" |
34 | self.extraresults = {"ptestresult.sections" : {ptestsuite : {}}} | 35 | self.ptest_section(ptestsuite) |
35 | with open(os.path.join(builddir, "tests.sum"), "r") as f: | 36 | with open(os.path.join(builddir, "tests.sum"), "r") as f: |
36 | for test, result in parse_values(f): | 37 | for test, result in parse_values(f): |
37 | self.extraresults["ptestresult.{}.{}".format(ptestsuite, test)] = {"status" : result} | 38 | self.ptest_result(ptestsuite, test, result) |
38 | 39 | ||
39 | def run_check_emulated(self): | 40 | def run_check_emulated(self): |
40 | with contextlib.ExitStack() as s: | 41 | with contextlib.ExitStack() as s: |