diff options
author | Nathan Rossi <nathan@nathanrossi.com> | 2019-09-07 12:55:06 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-09-07 21:56:43 +0100 |
commit | db1cc0b53390bff5bd255a92a1644eccd30d7f18 (patch) | |
tree | bfbf35bdef08fb1be27084f952d8ee057630f5e7 /meta/lib/oeqa | |
parent | 074388daf5ceb0b413caa76f348bf6f4b19fc131 (diff) | |
download | poky-db1cc0b53390bff5bd255a92a1644eccd30d7f18.tar.gz |
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>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/binutils.py | 13 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/gcc.py | 14 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/glibc.py | 13 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/reproducible.py | 13 |
4 files changed, 12 insertions, 41 deletions
diff --git a/meta/lib/oeqa/selftest/cases/binutils.py b/meta/lib/oeqa/selftest/cases/binutils.py index 7f887959e4..759cd9b8ff 100644 --- a/meta/lib/oeqa/selftest/cases/binutils.py +++ b/meta/lib/oeqa/selftest/cases/binutils.py | |||
@@ -16,15 +16,6 @@ def parse_values(content): | |||
16 | 16 | ||
17 | @OETestTag("machine") | 17 | @OETestTag("machine") |
18 | class BinutilsCrossSelfTest(OESelftestTestCase): | 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): | 19 | def test_binutils(self): |
29 | self.run_binutils("binutils") | 20 | self.run_binutils("binutils") |
30 | 21 | ||
@@ -46,7 +37,7 @@ class BinutilsCrossSelfTest(OESelftestTestCase): | |||
46 | bitbake("{0} -c check".format(recipe)) | 37 | bitbake("{0} -c check".format(recipe)) |
47 | 38 | ||
48 | ptestsuite = "binutils-{}".format(suite) if suite != "binutils" else suite | 39 | ptestsuite = "binutils-{}".format(suite) if suite != "binutils" else suite |
49 | self.tc.extraresults["ptestresult.sections"][ptestsuite] = {} | 40 | self.extraresults = {"ptestresult.sections" : {ptestsuite : {}}} |
50 | 41 | ||
51 | sumspath = os.path.join(builddir, suite, "{0}.sum".format(suite)) | 42 | sumspath = os.path.join(builddir, suite, "{0}.sum".format(suite)) |
52 | if not os.path.exists(sumspath): | 43 | if not os.path.exists(sumspath): |
@@ -54,5 +45,5 @@ class BinutilsCrossSelfTest(OESelftestTestCase): | |||
54 | 45 | ||
55 | with open(sumspath, "r") as f: | 46 | with open(sumspath, "r") as f: |
56 | for test, result in parse_values(f): | 47 | for test, result in parse_values(f): |
57 | self.tc.extraresults["ptestresult.{}.{}".format(ptestsuite, test)] = {"status" : result} | 48 | self.extraresults["ptestresult.{}.{}".format(ptestsuite, test)] = {"status" : result} |
58 | 49 | ||
diff --git a/meta/lib/oeqa/selftest/cases/gcc.py b/meta/lib/oeqa/selftest/cases/gcc.py index f4fed40ea5..24ee66a2ae 100644 --- a/meta/lib/oeqa/selftest/cases/gcc.py +++ b/meta/lib/oeqa/selftest/cases/gcc.py | |||
@@ -13,15 +13,6 @@ def parse_values(content): | |||
13 | 13 | ||
14 | @OETestTag("machine") | 14 | @OETestTag("machine") |
15 | class GccSelfTest(OESelftestTestCase): | 15 | class GccSelfTest(OESelftestTestCase): |
16 | @classmethod | ||
17 | def setUpClass(cls): | ||
18 | super().setUpClass() | ||
19 | if not hasattr(cls.tc, "extraresults"): | ||
20 | cls.tc.extraresults = {} | ||
21 | |||
22 | if "ptestresult.sections" not in cls.tc.extraresults: | ||
23 | cls.tc.extraresults["ptestresult.sections"] = {} | ||
24 | |||
25 | def gcc_runtime_check_skip(self, suite): | 16 | def gcc_runtime_check_skip(self, suite): |
26 | targets = get_bb_var("RUNTIMETARGET", "gcc-runtime").split() | 17 | targets = get_bb_var("RUNTIMETARGET", "gcc-runtime").split() |
27 | if suite not in targets: | 18 | if suite not in targets: |
@@ -71,6 +62,7 @@ class GccSelfTest(OESelftestTestCase): | |||
71 | bb_vars = get_bb_vars(["B", "TARGET_SYS"], recipe) | 62 | bb_vars = get_bb_vars(["B", "TARGET_SYS"], recipe) |
72 | builddir, target_sys = bb_vars["B"], bb_vars["TARGET_SYS"] | 63 | builddir, target_sys = bb_vars["B"], bb_vars["TARGET_SYS"] |
73 | 64 | ||
65 | self.extraresults = {"ptestresult.sections" : {}} | ||
74 | for suite in suites: | 66 | for suite in suites: |
75 | sumspath = os.path.join(builddir, "gcc", "testsuite", suite, "{0}.sum".format(suite)) | 67 | sumspath = os.path.join(builddir, "gcc", "testsuite", suite, "{0}.sum".format(suite)) |
76 | if not os.path.exists(sumspath): # check in target dirs | 68 | if not os.path.exists(sumspath): # check in target dirs |
@@ -80,10 +72,10 @@ class GccSelfTest(OESelftestTestCase): | |||
80 | 72 | ||
81 | ptestsuite = "gcc-{}".format(suite) if suite != "gcc" else suite | 73 | ptestsuite = "gcc-{}".format(suite) if suite != "gcc" else suite |
82 | ptestsuite = ptestsuite + "-user" if ssh is None else ptestsuite | 74 | ptestsuite = ptestsuite + "-user" if ssh is None else ptestsuite |
83 | self.tc.extraresults["ptestresult.sections"][ptestsuite] = {} | 75 | self.extraresults["ptestresult.sections"][ptestsuite] = {} |
84 | with open(sumspath, "r") as f: | 76 | with open(sumspath, "r") as f: |
85 | for test, result in parse_values(f): | 77 | for test, result in parse_values(f): |
86 | self.tc.extraresults["ptestresult.{}.{}".format(ptestsuite, test)] = {"status" : result} | 78 | self.extraresults["ptestresult.{}.{}".format(ptestsuite, test)] = {"status" : result} |
87 | 79 | ||
88 | class GccSelfTestSystemEmulated(GccSelfTest): | 80 | class GccSelfTestSystemEmulated(GccSelfTest): |
89 | default_installed_packages = ["libgcc", "libstdc++", "libatomic", "libgomp"] | 81 | default_installed_packages = ["libgcc", "libstdc++", "libatomic", "libgomp"] |
diff --git a/meta/lib/oeqa/selftest/cases/glibc.py b/meta/lib/oeqa/selftest/cases/glibc.py index 4d0c13131b..e13de87014 100644 --- a/meta/lib/oeqa/selftest/cases/glibc.py +++ b/meta/lib/oeqa/selftest/cases/glibc.py | |||
@@ -15,15 +15,6 @@ def parse_values(content): | |||
15 | 15 | ||
16 | @OETestTag("machine") | 16 | @OETestTag("machine") |
17 | class GlibcSelfTest(OESelftestTestCase): | 17 | class GlibcSelfTest(OESelftestTestCase): |
18 | @classmethod | ||
19 | def setUpClass(cls): | ||
20 | super().setUpClass() | ||
21 | if not hasattr(cls.tc, "extraresults"): | ||
22 | cls.tc.extraresults = {} | ||
23 | |||
24 | if "ptestresult.sections" not in cls.tc.extraresults: | ||
25 | cls.tc.extraresults["ptestresult.sections"] = {} | ||
26 | |||
27 | def test_glibc(self): | 18 | def test_glibc(self): |
28 | self.glibc_run_check() | 19 | self.glibc_run_check() |
29 | 20 | ||
@@ -44,10 +35,10 @@ class GlibcSelfTest(OESelftestTestCase): | |||
44 | builddir = get_bb_var("B", "glibc-testsuite") | 35 | builddir = get_bb_var("B", "glibc-testsuite") |
45 | 36 | ||
46 | ptestsuite = "glibc-user" if ssh is None else "glibc" | 37 | ptestsuite = "glibc-user" if ssh is None else "glibc" |
47 | self.tc.extraresults["ptestresult.sections"][ptestsuite] = {} | 38 | self.extraresults = {"ptestresult.sections" : {ptestsuite : {}}} |
48 | with open(os.path.join(builddir, "tests.sum"), "r") as f: | 39 | with open(os.path.join(builddir, "tests.sum"), "r") as f: |
49 | for test, result in parse_values(f): | 40 | for test, result in parse_values(f): |
50 | self.tc.extraresults["ptestresult.{}.{}".format(ptestsuite, test)] = {"status" : result} | 41 | self.extraresults["ptestresult.{}.{}".format(ptestsuite, test)] = {"status" : result} |
51 | 42 | ||
52 | class GlibcSelfTestSystemEmulated(GlibcSelfTest): | 43 | class GlibcSelfTestSystemEmulated(GlibcSelfTest): |
53 | default_installed_packages = [ | 44 | default_installed_packages = [ |
diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py b/meta/lib/oeqa/selftest/cases/reproducible.py index ffb405af20..eee09d3fb2 100644 --- a/meta/lib/oeqa/selftest/cases/reproducible.py +++ b/meta/lib/oeqa/selftest/cases/reproducible.py | |||
@@ -82,15 +82,12 @@ class ReproducibleTests(OESelftestTestCase): | |||
82 | for v in needed_vars: | 82 | for v in needed_vars: |
83 | setattr(self, v.lower(), bb_vars[v]) | 83 | setattr(self, v.lower(), bb_vars[v]) |
84 | 84 | ||
85 | if not hasattr(self.tc, "extraresults"): | 85 | self.extrasresults = {} |
86 | self.tc.extraresults = {} | 86 | self.extrasresults.setdefault('reproducible.rawlogs', {})['log'] = '' |
87 | self.extras = self.tc.extraresults | 87 | self.extrasresults.setdefault('reproducible', {}).setdefault('files', {}) |
88 | |||
89 | self.extras.setdefault('reproducible.rawlogs', {})['log'] = '' | ||
90 | self.extras.setdefault('reproducible', {}).setdefault('files', {}) | ||
91 | 88 | ||
92 | def append_to_log(self, msg): | 89 | def append_to_log(self, msg): |
93 | self.extras['reproducible.rawlogs']['log'] += msg | 90 | self.extrasresults['reproducible.rawlogs']['log'] += msg |
94 | 91 | ||
95 | def compare_packages(self, reference_dir, test_dir, diffutils_sysroot): | 92 | def compare_packages(self, reference_dir, test_dir, diffutils_sysroot): |
96 | result = PackageCompareResults() | 93 | result = PackageCompareResults() |
@@ -117,7 +114,7 @@ class ReproducibleTests(OESelftestTestCase): | |||
117 | return result | 114 | return result |
118 | 115 | ||
119 | def write_package_list(self, package_class, name, packages): | 116 | def write_package_list(self, package_class, name, packages): |
120 | self.extras['reproducible']['files'].setdefault(package_class, {})[name] = [ | 117 | self.extrasresults['reproducible']['files'].setdefault(package_class, {})[name] = [ |
121 | {'reference': p.reference, 'test': p.test} for p in packages] | 118 | {'reference': p.reference, 'test': p.test} for p in packages] |
122 | 119 | ||
123 | def test_reproducible_builds(self): | 120 | def test_reproducible_builds(self): |