From patchwork Fri Aug 8 10:24:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Marko, Peter" X-Patchwork-Id: 68241 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96037C87FD3 for ; Fri, 8 Aug 2025 10:25:08 +0000 (UTC) Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net [185.136.64.227]) by mx.groups.io with SMTP id smtpd.web10.18804.1754648699474262141 for ; Fri, 08 Aug 2025 03:25:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm2 header.b=cM3qs0uq; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.227, mailfrom: fm-256628-2025080810245489be6d05cd0482c245-peuzs5@rts-flowmailer.siemens.com) Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 2025080810245489be6d05cd0482c245 for ; Fri, 08 Aug 2025 12:24:55 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=peter.marko@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=ced5+T2bqmp2+LTGj2sXLnySG/Rd/jjNHgRlUlBaAw0=; b=cM3qs0uqIi0fYooePqoSnkLC+x23Ktad2yzcKNj60t47INhe/v8f0Eic8wFZJ5y/n/RQ5v /gKHAx12O9dqkUgESpDYSyVEPYtiTq7DvM6qb0sNLl7mjMeOVC0R2U38WpcGFtCMDLt8fYhb CZKH2bHqFDrH3brtZxkdodFyqqq1wFe5o9tsVYH1q0J8hH2SJemIzgp9xZNWP4+woMf/0bDu QUk6PYCW4hTdYSsAbSlHW7NkRa2S0I7pFNq3XrMeFWTadIOPWmVpUH32pOmuu0+1VwpkWQeR qzkx++v3iG3DstzmRH08sDc0FeFuLVBlalv5d0yMcKJkRM/JYyUufTrw==; From: Peter Marko To: openembedded-core@lists.openembedded.org Cc: Peter Marko Subject: [OE-core][PATCH v2 1/3] oe/utils: extract method for parallel_make without d context Date: Fri, 8 Aug 2025 12:24:11 +0200 Message-Id: <20250808102413.10446-1-peter.marko@siemens.com> In-Reply-To: <20250808055059.8851-1-peter.marko@siemens.com> References: <20250808055059.8851-1-peter.marko@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-256628:519-21489:flowmailer List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 08 Aug 2025 10:25:08 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/221647 From: Peter Marko oeqa does not have general access to d variable context and needs to determine parallel make settings. Extract the code from parallel_make into reusable parallel_make_value. Also correct function description of return value from None to empty string. Signed-off-by: Peter Marko --- meta/lib/oe/utils.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index 779c5e593f..8aa15373f1 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py @@ -174,18 +174,14 @@ def any_distro_features(d, features, truevalue="1", falsevalue=""): """ return bb.utils.contains_any("DISTRO_FEATURES", features, truevalue, falsevalue, d) -def parallel_make(d, makeinst=False): +def parallel_make_value(pm): """ Return the integer value for the number of parallel threads to use when - building, scraped out of PARALLEL_MAKE. If no parallelization option is - found, returns None + building, scraped out of given string. If no parallelization option is + found, returns empty string - e.g. if PARALLEL_MAKE = "-j 10", this will return 10 as an integer. + e.g. if string is "-j 10", this will return 10 as an integer. """ - if makeinst: - pm = (d.getVar('PARALLEL_MAKEINST') or '').split() - else: - pm = (d.getVar('PARALLEL_MAKE') or '').split() # look for '-j' and throw other options (e.g. '-l') away while pm: opt = pm.pop(0) @@ -200,6 +196,20 @@ def parallel_make(d, makeinst=False): return '' +def parallel_make(d, makeinst=False): + """ + Return the integer value for the number of parallel threads to use when + building, scraped out of PARALLEL_MAKE. If no parallelization option is + found, returns empty string + + e.g. if PARALLEL_MAKE = "-j 10", this will return 10 as an integer. + """ + if makeinst: + pm = (d.getVar('PARALLEL_MAKEINST') or '').split() + else: + pm = (d.getVar('PARALLEL_MAKE') or '').split() + return parallel_make_value(pm) + def parallel_make_argument(d, fmt, limit=None, makeinst=False): """ Helper utility to construct a parallel make argument from the number of From patchwork Fri Aug 8 10:24:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Marko, Peter" X-Patchwork-Id: 68242 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E2B7C87FD3 for ; Fri, 8 Aug 2025 10:25:18 +0000 (UTC) Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net [185.136.64.227]) by mx.groups.io with SMTP id smtpd.web11.19026.1754648715380809690 for ; Fri, 08 Aug 2025 03:25:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm2 header.b=O2kftGfM; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.227, mailfrom: fm-256628-2025080810251303be47719e487d901b-8yqyhq@rts-flowmailer.siemens.com) Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 2025080810251303be47719e487d901b for ; Fri, 08 Aug 2025 12:25:13 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=peter.marko@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=jLjtK3zBj2WwCFmzSrCE3BfudIQC84vy0eyozRxZkE8=; b=O2kftGfM4NcAHaI7SyQsRQ4jLbPQNuzsd4bZupnMfRf3oWCVOgxldf8/qkyYQ2fNy0YsPD FGREzBJZ8uvGti8M2KGt9iug1x4ygVhmvudm+eIy8buG1/0ZNmExmxQhIUZ5vN9W5P3Aalhr zH1frN+04DJtMo15EYbFsc4Ad45u5ANac9IAxY63oh0pboE9Ch1KkFQbThBDzCkKMFYu7MyQ 0qHYRhcrK5fTsvlgJpD3rI8HStHJUVh2AI55zw4oxbdQLdHx1RtYGDICotF7Qox0r/nu5Cbw EzLRs7EqctzmqvsYXz26xvgYSA9bxWuh309Nk0t7hOBc07DLmUe7EvbA==; From: Peter Marko To: openembedded-core@lists.openembedded.org Cc: Peter Marko Subject: [OE-core][PATCH v2 2/3] oeqa: rename variable dirs to opts is cases with parallel make Date: Fri, 8 Aug 2025 12:24:12 +0200 Message-Id: <20250808102413.10446-2-peter.marko@siemens.com> In-Reply-To: <20250808102413.10446-1-peter.marko@siemens.com> References: <20250808055059.8851-1-peter.marko@siemens.com> <20250808102413.10446-1-peter.marko@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-256628:519-21489:flowmailer List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 08 Aug 2025 10:25:18 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/221648 From: Peter Marko This is a refactoring commit so that next commit which is fixing parallel make settings is readable. Rename makes sense as the variable will contain not only directories but also parallel make settings afterwards. Signed-off-by: Peter Marko --- meta/lib/oeqa/sdk/cases/autotools.py | 22 +++++++++++----------- meta/lib/oeqa/sdk/cases/cmake.py | 22 +++++++++++----------- meta/lib/oeqa/sdk/cases/makefile.py | 20 ++++++++++---------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/meta/lib/oeqa/sdk/cases/autotools.py b/meta/lib/oeqa/sdk/cases/autotools.py index ee6c522551..f641d66015 100644 --- a/meta/lib/oeqa/sdk/cases/autotools.py +++ b/meta/lib/oeqa/sdk/cases/autotools.py @@ -26,23 +26,23 @@ class AutotoolsTest(OESDKTestCase): with tempfile.TemporaryDirectory(prefix="cpio-", dir=self.tc.sdk_dir) as testdir: tarball = self.fetch(testdir, self.td["DL_DIR"], "https://ftp.gnu.org/gnu/cpio/cpio-2.15.tar.gz") - dirs = {} - dirs["source"] = os.path.join(testdir, "cpio-2.15") - dirs["build"] = os.path.join(testdir, "build") - dirs["install"] = os.path.join(testdir, "install") + opts = {} + opts["source"] = os.path.join(testdir, "cpio-2.15") + opts["build"] = os.path.join(testdir, "build") + opts["install"] = os.path.join(testdir, "install") subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) - self.assertTrue(os.path.isdir(dirs["source"])) - os.makedirs(dirs["build"]) + self.assertTrue(os.path.isdir(opts["source"])) + os.makedirs(opts["build"]) - self._run("cd {build} && {source}/configure CFLAGS='-std=gnu17 -Dbool=int -Dtrue=1 -Dfalse=0 -Wno-error=implicit-function-declaration' $CONFIGURE_FLAGS".format(**dirs)) + self._run("cd {build} && {source}/configure CFLAGS='-std=gnu17 -Dbool=int -Dtrue=1 -Dfalse=0 -Wno-error=implicit-function-declaration' $CONFIGURE_FLAGS".format(**opts)) # Check that configure detected the target correctly - with open(os.path.join(dirs["build"], "config.log")) as f: + with open(os.path.join(opts["build"], "config.log")) as f: host_sys = self.td["HOST_SYS"] self.assertIn(f"host_alias='{host_sys}'\n", f.readlines()) - self._run("cd {build} && make CFLAGS='-std=gnu17 -Dbool=int -Dtrue=1 -Dfalse=0 -Wno-error=implicit-function-declaration' -j".format(**dirs)) - self._run("cd {build} && make install DESTDIR={install}".format(**dirs)) + self._run("cd {build} && make CFLAGS='-std=gnu17 -Dbool=int -Dtrue=1 -Dfalse=0 -Wno-error=implicit-function-declaration' -j".format(**opts)) + self._run("cd {build} && make install DESTDIR={install}".format(**opts)) - self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "cpio")) + self.check_elf(os.path.join(opts["install"], "usr", "local", "bin", "cpio")) diff --git a/meta/lib/oeqa/sdk/cases/cmake.py b/meta/lib/oeqa/sdk/cases/cmake.py index 070682ef08..32b951c0f8 100644 --- a/meta/lib/oeqa/sdk/cases/cmake.py +++ b/meta/lib/oeqa/sdk/cases/cmake.py @@ -29,19 +29,19 @@ class CMakeTest(OESDKTestCase): with tempfile.TemporaryDirectory(prefix="assimp", dir=self.tc.sdk_dir) as testdir: tarball = self.fetch(testdir, self.td["DL_DIR"], "https://github.com/assimp/assimp/archive/v5.4.1.tar.gz") - dirs = {} - dirs["source"] = os.path.join(testdir, "assimp-5.4.1") - dirs["build"] = os.path.join(testdir, "build") - dirs["install"] = os.path.join(testdir, "install") + opts = {} + opts["source"] = os.path.join(testdir, "assimp-5.4.1") + opts["build"] = os.path.join(testdir, "build") + opts["install"] = os.path.join(testdir, "install") subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) - self.assertTrue(os.path.isdir(dirs["source"])) + self.assertTrue(os.path.isdir(opts["source"])) # Apply the zlib patch https://github.com/madler/zlib/commit/a566e156b3fa07b566ddbf6801b517a9dba04fa3 # this sed wont be needed once assimp moves its zlib copy to v1.3.1+ - self._run("sed -i '/# ifdef _FILE_OFFSET_BITS/I,+2 d' {source}/contrib/zlib/gzguts.h".format(**dirs)) - os.makedirs(dirs["build"]) + self._run("sed -i '/# ifdef _FILE_OFFSET_BITS/I,+2 d' {source}/contrib/zlib/gzguts.h".format(**opts)) + os.makedirs(opts["build"]) - self._run("cd {build} && cmake -DASSIMP_WARNINGS_AS_ERRORS=OFF -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DASSIMP_BUILD_ZLIB=ON {source}".format(**dirs)) - self._run("cmake --build {build} -- -j".format(**dirs)) - self._run("cmake --build {build} --target install -- DESTDIR={install}".format(**dirs)) - self.check_elf(os.path.join(dirs["install"], "usr", "local", "lib", "libassimp.so.5.4.1")) + self._run("cd {build} && cmake -DASSIMP_WARNINGS_AS_ERRORS=OFF -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DASSIMP_BUILD_ZLIB=ON {source}".format(**opts)) + self._run("cmake --build {build} -- -j".format(**opts)) + self._run("cmake --build {build} --target install -- DESTDIR={install}".format(**opts)) + self.check_elf(os.path.join(opts["install"], "usr", "local", "lib", "libassimp.so.5.4.1")) diff --git a/meta/lib/oeqa/sdk/cases/makefile.py b/meta/lib/oeqa/sdk/cases/makefile.py index e1e2484820..0dcf94c6d7 100644 --- a/meta/lib/oeqa/sdk/cases/makefile.py +++ b/meta/lib/oeqa/sdk/cases/makefile.py @@ -23,14 +23,14 @@ class MakefileTest(OESDKTestCase): with tempfile.TemporaryDirectory(prefix="lzip", dir=self.tc.sdk_dir) as testdir: tarball = self.fetch(testdir, self.td["DL_DIR"], "http://downloads.yoctoproject.org/mirror/sources/lzip-1.19.tar.gz") - dirs = {} - dirs["source"] = os.path.join(testdir, "lzip-1.19") - dirs["build"] = os.path.join(testdir, "build") - dirs["install"] = os.path.join(testdir, "install") + opts = {} + opts["source"] = os.path.join(testdir, "lzip-1.19") + opts["build"] = os.path.join(testdir, "build") + opts["install"] = os.path.join(testdir, "install") subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) - self.assertTrue(os.path.isdir(dirs["source"])) - os.makedirs(dirs["build"]) + self.assertTrue(os.path.isdir(opts["source"])) + os.makedirs(opts["build"]) cmd = """cd {build} && \ {source}/configure --srcdir {source} \ @@ -39,7 +39,7 @@ class MakefileTest(OESDKTestCase): CXXFLAGS="$CXXFLAGS" \ LDFLAGS="$LDFLAGS" \ """ - self._run(cmd.format(**dirs)) - self._run("cd {build} && make -j".format(**dirs)) - self._run("cd {build} && make install DESTDIR={install}".format(**dirs)) - self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "lzip")) + self._run(cmd.format(**opts)) + self._run("cd {build} && make -j".format(**opts)) + self._run("cd {build} && make install DESTDIR={install}".format(**opts)) + self.check_elf(os.path.join(opts["install"], "usr", "local", "bin", "lzip")) From patchwork Fri Aug 8 10:24:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Marko, Peter" X-Patchwork-Id: 68243 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F61AC87FD3 for ; Fri, 8 Aug 2025 10:25:28 +0000 (UTC) Received: from mta-65-225.siemens.flowmailer.net (mta-65-225.siemens.flowmailer.net [185.136.65.225]) by mx.groups.io with SMTP id smtpd.web11.19029.1754648727145680880 for ; Fri, 08 Aug 2025 03:25:27 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm2 header.b=ZkQ362S5; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.225, mailfrom: fm-256628-20250808102524854cc026261e047644-a3biog@rts-flowmailer.siemens.com) Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 20250808102524854cc026261e047644 for ; Fri, 08 Aug 2025 12:25:24 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=peter.marko@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=zhrhP1bvoSsxzrJ9GFYwLyIvxXtAnC/VmWjBFWY7KvA=; b=ZkQ362S5PjH5w3SXhOEj1CPeVTtOF/GSHo7k+rvFT5qoGHjVPG8YLqUBhaV0L5YgU1ozt3 f3UQWLZ2KMO3NPku3CgHA04PsjXi2S851mVauKhwHbiTZxMf32BNfDBm+1fWB7F1TQntmIoq Yz5ePBzWEIG7G7+EMc3RJCLs6vorqCjiOQLXWBs8fFoxr/tgMjl+OpbY67+OR74VrrUYZy4b LInUFgSJJTAdvoW+245TIs69JPhsTYHOZM2FdiIDYHVBdNdmCtbluZLxzDPmHBm8c9aIP7T/ w57sjkE5f2if7aNLJqEGHzfbmf+X6AbOMFnyOvm/gYvYFSig7FpwJ2pA==; From: Peter Marko To: openembedded-core@lists.openembedded.org Cc: Peter Marko Subject: [OE-core][PATCH v2 3/3] oeqa: fix parallel make settings Date: Fri, 8 Aug 2025 12:24:13 +0200 Message-Id: <20250808102413.10446-3-peter.marko@siemens.com> In-Reply-To: <20250808102413.10446-1-peter.marko@siemens.com> References: <20250808055059.8851-1-peter.marko@siemens.com> <20250808102413.10446-1-peter.marko@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-256628:519-21489:flowmailer List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 08 Aug 2025 10:25:28 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/221649 From: Peter Marko These testcases are running with make or cmake "-j" without number, which means that the build will spawn unlimited number of compiler processes which may lead to oomkills and general build machine cpu overload. Signed-off-by: Peter Marko --- meta/lib/oeqa/runtime/cases/stap.py | 6 +++++- meta/lib/oeqa/sdk/cases/autotools.py | 6 +++++- meta/lib/oeqa/sdk/cases/cmake.py | 6 +++++- meta/lib/oeqa/sdk/cases/kmod.py | 6 +++++- meta/lib/oeqa/sdk/cases/makefile.py | 6 +++++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/meta/lib/oeqa/runtime/cases/stap.py b/meta/lib/oeqa/runtime/cases/stap.py index 6b55e7de50..d83cb0b2b8 100644 --- a/meta/lib/oeqa/runtime/cases/stap.py +++ b/meta/lib/oeqa/runtime/cases/stap.py @@ -16,8 +16,12 @@ class StapTest(OERuntimeTestCase): @OEHasPackage(['gcc-symlinks']) @OEHasPackage(['kernel-devsrc']) def test_stap(self): + from oe.utils import parallel_make_value + pmv = parallel_make_value((self.td.get('PARALLEL_MAKE') or '').split()) + parallel_make = "-j %d" % (pmv) if pmv else "" + try: - cmd = 'make -j -C /usr/src/kernel scripts prepare' + cmd = 'make %s -C /usr/src/kernel scripts prepare' % (parallel_make) status, output = self.target.run(cmd, 900) self.assertEqual(status, 0, msg='\n'.join([cmd, output])) diff --git a/meta/lib/oeqa/sdk/cases/autotools.py b/meta/lib/oeqa/sdk/cases/autotools.py index f641d66015..3f51854e3d 100644 --- a/meta/lib/oeqa/sdk/cases/autotools.py +++ b/meta/lib/oeqa/sdk/cases/autotools.py @@ -23,6 +23,9 @@ class AutotoolsTest(OESDKTestCase): raise unittest.SkipTest("AutotoolsTest class: SDK doesn't contain a supported C library") def test_cpio(self): + from oe.utils import parallel_make_value + pmv = parallel_make_value((self.td.get('PARALLEL_MAKE') or '').split()) + with tempfile.TemporaryDirectory(prefix="cpio-", dir=self.tc.sdk_dir) as testdir: tarball = self.fetch(testdir, self.td["DL_DIR"], "https://ftp.gnu.org/gnu/cpio/cpio-2.15.tar.gz") @@ -30,6 +33,7 @@ class AutotoolsTest(OESDKTestCase): opts["source"] = os.path.join(testdir, "cpio-2.15") opts["build"] = os.path.join(testdir, "build") opts["install"] = os.path.join(testdir, "install") + opts["parallel_make"] = "-j %d" % (pmv) if pmv else "" subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) self.assertTrue(os.path.isdir(opts["source"])) @@ -42,7 +46,7 @@ class AutotoolsTest(OESDKTestCase): host_sys = self.td["HOST_SYS"] self.assertIn(f"host_alias='{host_sys}'\n", f.readlines()) - self._run("cd {build} && make CFLAGS='-std=gnu17 -Dbool=int -Dtrue=1 -Dfalse=0 -Wno-error=implicit-function-declaration' -j".format(**opts)) + self._run("cd {build} && make CFLAGS='-std=gnu17 -Dbool=int -Dtrue=1 -Dfalse=0 -Wno-error=implicit-function-declaration' {parallel_make}".format(**opts)) self._run("cd {build} && make install DESTDIR={install}".format(**opts)) self.check_elf(os.path.join(opts["install"], "usr", "local", "bin", "cpio")) diff --git a/meta/lib/oeqa/sdk/cases/cmake.py b/meta/lib/oeqa/sdk/cases/cmake.py index 32b951c0f8..81fd327ca3 100644 --- a/meta/lib/oeqa/sdk/cases/cmake.py +++ b/meta/lib/oeqa/sdk/cases/cmake.py @@ -26,6 +26,9 @@ class CMakeTest(OESDKTestCase): self.ensure_host_package("cmake") def test_assimp(self): + from oe.utils import parallel_make_value + pmv = parallel_make_value((self.td.get('PARALLEL_MAKE') or '').split()) + with tempfile.TemporaryDirectory(prefix="assimp", dir=self.tc.sdk_dir) as testdir: tarball = self.fetch(testdir, self.td["DL_DIR"], "https://github.com/assimp/assimp/archive/v5.4.1.tar.gz") @@ -33,6 +36,7 @@ class CMakeTest(OESDKTestCase): opts["source"] = os.path.join(testdir, "assimp-5.4.1") opts["build"] = os.path.join(testdir, "build") opts["install"] = os.path.join(testdir, "install") + opts["parallel_make"] = "-j %d" % (pmv) if pmv else "" subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) self.assertTrue(os.path.isdir(opts["source"])) @@ -42,6 +46,6 @@ class CMakeTest(OESDKTestCase): os.makedirs(opts["build"]) self._run("cd {build} && cmake -DASSIMP_WARNINGS_AS_ERRORS=OFF -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DASSIMP_BUILD_ZLIB=ON {source}".format(**opts)) - self._run("cmake --build {build} -- -j".format(**opts)) + self._run("cmake --build {build} -- {parallel_make}".format(**opts)) self._run("cmake --build {build} --target install -- DESTDIR={install}".format(**opts)) self.check_elf(os.path.join(opts["install"], "usr", "local", "lib", "libassimp.so.5.4.1")) diff --git a/meta/lib/oeqa/sdk/cases/kmod.py b/meta/lib/oeqa/sdk/cases/kmod.py index 0aa6f702e4..0c4d8ddb54 100644 --- a/meta/lib/oeqa/sdk/cases/kmod.py +++ b/meta/lib/oeqa/sdk/cases/kmod.py @@ -21,9 +21,13 @@ class KernelModuleTest(OESDKTestCase): if isinstance(self.tc, OESDKExtTestContext): self.skipTest(f"{self.id()} does not support eSDK (https://bugzilla.yoctoproject.org/show_bug.cgi?id=15850)") + from oe.utils import parallel_make_value + pmv = parallel_make_value((self.td.get('PARALLEL_MAKE') or '').split()) + parallel_make = "-j %d" % (pmv) if pmv else "" + self.ensure_target_package("kernel-devsrc") # These targets need to be built before kernel modules can be built. - self._run("make -j -C $OECORE_TARGET_SYSROOT/usr/src/kernel prepare scripts") + self._run("make %s -C $OECORE_TARGET_SYSROOT/usr/src/kernel prepare scripts" % (parallel_make)) with tempfile.TemporaryDirectory(prefix="cryptodev", dir=self.tc.sdk_dir) as testdir: git_url = "https://github.com/cryptodev-linux/cryptodev-linux" diff --git a/meta/lib/oeqa/sdk/cases/makefile.py b/meta/lib/oeqa/sdk/cases/makefile.py index 0dcf94c6d7..fc041ca8d8 100644 --- a/meta/lib/oeqa/sdk/cases/makefile.py +++ b/meta/lib/oeqa/sdk/cases/makefile.py @@ -20,6 +20,9 @@ class MakefileTest(OESDKTestCase): raise unittest.SkipTest("MakefileTest class: SDK doesn't contain a supported C library") def test_lzip(self): + from oe.utils import parallel_make_value + pmv = parallel_make_value((self.td.get('PARALLEL_MAKE') or '').split()) + with tempfile.TemporaryDirectory(prefix="lzip", dir=self.tc.sdk_dir) as testdir: tarball = self.fetch(testdir, self.td["DL_DIR"], "http://downloads.yoctoproject.org/mirror/sources/lzip-1.19.tar.gz") @@ -27,6 +30,7 @@ class MakefileTest(OESDKTestCase): opts["source"] = os.path.join(testdir, "lzip-1.19") opts["build"] = os.path.join(testdir, "build") opts["install"] = os.path.join(testdir, "install") + opts["parallel_make"] = "-j %d" % (pmv) if pmv else "" subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) self.assertTrue(os.path.isdir(opts["source"])) @@ -40,6 +44,6 @@ class MakefileTest(OESDKTestCase): LDFLAGS="$LDFLAGS" \ """ self._run(cmd.format(**opts)) - self._run("cd {build} && make -j".format(**opts)) + self._run("cd {build} && make {parallel_make}".format(**opts)) self._run("cd {build} && make install DESTDIR={install}".format(**opts)) self.check_elf(os.path.join(opts["install"], "usr", "local", "bin", "lzip"))