[OE-core] [PATCH 6/7] oeqa/selftest/cases/gcc.py: Split into classes for parallelism

Nathan Rossi nathan at nathanrossi.com
Sat Sep 7 12:55:06 UTC 2019


Split the gcc selftest cases into multiple classes one for each test.
This is done in order to make it easy to execute multiple gcc tests in
parallel when using oe-selftest with the '-j' arg.

Additionally tag the user tests with "toolchain-user" and the system
emulation (qemu system) tests with "toolchain-system".

Signed-off-by: Nathan Rossi <nathan at nathanrossi.com>
---
 meta/lib/oeqa/selftest/cases/gcc.py | 99 ++++++++++++++++++++++++++-----------
 1 file changed, 70 insertions(+), 29 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/gcc.py b/meta/lib/oeqa/selftest/cases/gcc.py
index d0f0ca06e7..6eafa41720 100644
--- a/meta/lib/oeqa/selftest/cases/gcc.py
+++ b/meta/lib/oeqa/selftest/cases/gcc.py
@@ -11,34 +11,13 @@ def parse_values(content):
                 yield i[len(v) + 2:].strip(), v
                 break
 
- at OETestTag("machine")
-class GccSelfTest(OESelftestTestCase):
-    def gcc_runtime_check_skip(self, suite):
+class GccSelfTestBase(OESelftestTestCase):
+    def check_skip(self, suite):
         targets = get_bb_var("RUNTIMETARGET", "gcc-runtime").split()
         if suite not in targets:
             self.skipTest("Target does not use {0}".format(suite))
 
-    def test_cross_gcc(self):
-        self.gcc_run_check("gcc", "g++")
-
-    def test_libatomic(self):
-        self.gcc_run_check("libatomic")
-
-    def test_libgomp(self):
-        self.gcc_run_check("libgomp")
-
-    def test_libstdcxx(self):
-        self.gcc_run_check("libstdc++-v3")
-
-    def test_libssp(self):
-        self.gcc_runtime_check_skip("libssp")
-        self.gcc_run_check("libssp")
-
-    def test_libitm(self):
-        self.gcc_runtime_check_skip("libitm")
-        self.gcc_run_check("libitm")
-
-    def gcc_run_check(self, *suites, ssh = None):
+    def run_check(self, *suites, ssh = None):
         targets = set()
         for s in suites:
             if s in ["gcc", "g++"]:
@@ -77,11 +56,9 @@ class GccSelfTest(OESelftestTestCase):
                 for test, result in parse_values(f):
                     self.extraresults["ptestresult.{}.{}".format(ptestsuite, test)] = {"status" : result}
 
-class GccSelfTestSystemEmulated(GccSelfTest):
-    default_installed_packages = ["libgcc", "libstdc++", "libatomic", "libgomp"]
-
-    def gcc_run_check(self, *args, **kwargs):
+    def run_check_emulated(self, *args, **kwargs):
         # build core-image-minimal with required packages
+        default_installed_packages = ["libgcc", "libstdc++", "libatomic", "libgomp"]
         features = []
         features.append('IMAGE_FEATURES += "ssh-server-openssh"')
         features.append('CORE_IMAGE_EXTRA_INSTALL += "{0}"'.format(" ".join(self.default_installed_packages)))
@@ -94,5 +71,69 @@ class GccSelfTestSystemEmulated(GccSelfTest):
             status, _ = qemu.run("uname")
             self.assertEqual(status, 0)
 
-            return super().gcc_run_check(*args, **kwargs, ssh = qemu.ip)
+            return self.run_check(*args, **kwargs, ssh = qemu.ip)
+
+ at OETestTag("machine", "toolchain-user")
+class GccCrossSelfTest(GccSelfTestBase):
+    def test_cross_gcc(self):
+        self.run_check("gcc", "g++")
+
+ at OETestTag("machine", "toolchain-user")
+class GccLibAtomicSelfTest(GccSelfTestBase):
+    def test_libatomic(self):
+        self.run_check("libatomic")
+
+ at OETestTag("machine", "toolchain-user")
+class GccLibGompSelfTest(GccSelfTestBase):
+    def test_libgomp(self):
+        self.run_check("libgomp")
+
+ at OETestTag("machine", "toolchain-user")
+class GccLibStdCxxSelfTest(GccSelfTestBase):
+    def test_libstdcxx(self):
+        self.run_check("libstdc++-v3")
+
+ at OETestTag("machine", "toolchain-user")
+class GccLibSspSelfTest(GccSelfTestBase):
+    def test_libssp(self):
+        self.check_skip("libssp")
+        self.run_check("libssp")
+
+ at OETestTag("machine", "toolchain-user")
+class GccLibItmSelfTest(GccSelfTestBase):
+    def test_libitm(self):
+        self.check_skip("libitm")
+        self.run_check("libitm")
+
+ at OETestTag("machine", "toolchain-system")
+class GccCrossSelfTestSystemEmulated(GccSelfTestBase):
+    def test_cross_gcc(self):
+        self.run_check_emulated("gcc", "g++")
+
+ at OETestTag("machine", "toolchain-system")
+class GccLibAtomicSelfTestSystemEmulated(GccSelfTestBase):
+    def test_libatomic(self):
+        self.run_check_emulated("libatomic")
+
+ at OETestTag("machine", "toolchain-system")
+class GccLibGompSelfTestSystemEmulated(GccSelfTestBase):
+    def test_libgomp(self):
+        self.run_check_emulated("libgomp")
+
+ at OETestTag("machine", "toolchain-system")
+class GccLibStdCxxSelfTestSystemEmulated(GccSelfTestBase):
+    def test_libstdcxx(self):
+        self.run_check_emulated("libstdc++-v3")
+
+ at OETestTag("machine", "toolchain-system")
+class GccLibSspSelfTestSystemEmulated(GccSelfTestBase):
+    def test_libssp(self):
+        self.check_skip("libssp")
+        self.run_check_emulated("libssp")
+
+ at OETestTag("machine", "toolchain-system")
+class GccLibItmSelfTestSystemEmulated(GccSelfTestBase):
+    def test_libitm(self):
+        self.check_skip("libitm")
+        self.run_check_emulated("libitm")
 
---
2.23.0.rc1


More information about the Openembedded-core mailing list