* [PATCH] oeqa/sdk: add out-of-tree kernel module building test
@ 2024-07-12 18:43 Ross Burton
2024-07-15 10:31 ` [OE-core] " Mikko Rapeli
0 siblings, 1 reply; 7+ messages in thread
From: Ross Burton @ 2024-07-12 18:43 UTC (permalink / raw)
To: openembedded-core
Validate that out-of-tree kernel module building using kernel-devsrc
works as expected.
This test uses cryptodev-linux as a idiomatic out of tree module. As the
latest release doesn't actually build with kernel 6.7+, use the same
commit that our recipe uses.
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
meta/lib/oeqa/sdk/cases/kmod.py | 41 +++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
create mode 100644 meta/lib/oeqa/sdk/cases/kmod.py
diff --git a/meta/lib/oeqa/sdk/cases/kmod.py b/meta/lib/oeqa/sdk/cases/kmod.py
new file mode 100644
index 00000000000..9e8fdbcd403
--- /dev/null
+++ b/meta/lib/oeqa/sdk/cases/kmod.py
@@ -0,0 +1,41 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+import os
+import subprocess
+import tempfile
+import unittest
+
+from oeqa.sdk.case import OESDKTestCase
+from oeqa.utils.subprocesstweak import errors_have_output
+errors_have_output()
+
+class KernelModuleTest(OESDKTestCase):
+ """
+ Test that out-of-tree kernel modules build.
+ """
+
+ def setUp(self):
+ if not self.tc.hasTargetPackage("kernel-devsrc"):
+ raise unittest.SkipTest("KernelModuleTest needs 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")
+
+
+ def test_cryptodev(self):
+ with tempfile.TemporaryDirectory(prefix="cryptodev", dir=self.tc.sdk_dir) as testdir:
+ git_url = "https://github.com/cryptodev-linux/cryptodev-linux"
+ # This is a knnown-good commit post-1.13 that builds with kernel 6.7+
+ git_sha = "bb8bc7cf60d2c0b097c8b3b0e807f805b577a53f"
+
+ sourcedir = os.path.join(testdir, "cryptodev-linux")
+ subprocess.check_output(["git", "clone", git_url, sourcedir], stderr=subprocess.STDOUT)
+ self.assertTrue(os.path.isdir(sourcedir))
+ subprocess.check_output(["git", "-C", sourcedir, "checkout", git_sha], stderr=subprocess.STDOUT)
+
+ self._run("make -C %s V=1 KERNEL_DIR=$OECORE_TARGET_SYSROOT/usr/src/kernel" % sourcedir)
+ self.check_elf(os.path.join(sourcedir, "cryptodev.ko"))
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [OE-core] [PATCH] oeqa/sdk: add out-of-tree kernel module building test
2024-07-12 18:43 [PATCH] oeqa/sdk: add out-of-tree kernel module building test Ross Burton
@ 2024-07-15 10:31 ` Mikko Rapeli
2024-07-15 11:18 ` Ross Burton
0 siblings, 1 reply; 7+ messages in thread
From: Mikko Rapeli @ 2024-07-15 10:31 UTC (permalink / raw)
To: ross.burton; +Cc: openembedded-core
Hi,
On Fri, Jul 12, 2024 at 07:43:58PM +0100, Ross Burton via lists.openembedded.org wrote:
> Validate that out-of-tree kernel module building using kernel-devsrc
> works as expected.
>
> This test uses cryptodev-linux as a idiomatic out of tree module. As the
> latest release doesn't actually build with kernel 6.7+, use the same
> commit that our recipe uses.
>
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
> meta/lib/oeqa/sdk/cases/kmod.py | 41 +++++++++++++++++++++++++++++++++
> 1 file changed, 41 insertions(+)
> create mode 100644 meta/lib/oeqa/sdk/cases/kmod.py
>
> diff --git a/meta/lib/oeqa/sdk/cases/kmod.py b/meta/lib/oeqa/sdk/cases/kmod.py
> new file mode 100644
> index 00000000000..9e8fdbcd403
> --- /dev/null
> +++ b/meta/lib/oeqa/sdk/cases/kmod.py
> @@ -0,0 +1,41 @@
> +#
> +# Copyright OpenEmbedded Contributors
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +
> +import os
> +import subprocess
> +import tempfile
> +import unittest
> +
> +from oeqa.sdk.case import OESDKTestCase
> +from oeqa.utils.subprocesstweak import errors_have_output
> +errors_have_output()
> +
> +class KernelModuleTest(OESDKTestCase):
> + """
> + Test that out-of-tree kernel modules build.
> + """
> +
> + def setUp(self):
> + if not self.tc.hasTargetPackage("kernel-devsrc"):
> + raise unittest.SkipTest("KernelModuleTest needs 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")
> +
> +
> + def test_cryptodev(self):
> + with tempfile.TemporaryDirectory(prefix="cryptodev", dir=self.tc.sdk_dir) as testdir:
> + git_url = "https://github.com/cryptodev-linux/cryptodev-linux"
> + # This is a knnown-good commit post-1.13 that builds with kernel 6.7+
> + git_sha = "bb8bc7cf60d2c0b097c8b3b0e807f805b577a53f"
> +
> + sourcedir = os.path.join(testdir, "cryptodev-linux")
> + subprocess.check_output(["git", "clone", git_url, sourcedir], stderr=subprocess.STDOUT)
Is there any way to cache this, e.g. yocto build download cache?
Adding Internet downloads to test steps is a bad design IMO which eventually
causes a lot of failures.
Cheers,
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OE-core] [PATCH] oeqa/sdk: add out-of-tree kernel module building test
2024-07-15 10:31 ` [OE-core] " Mikko Rapeli
@ 2024-07-15 11:18 ` Ross Burton
2024-07-15 11:30 ` Mikko Rapeli
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Ross Burton @ 2024-07-15 11:18 UTC (permalink / raw)
To: Mikko Rapeli; +Cc: openembedded-core@lists.openembedded.org
On 15 Jul 2024, at 11:31, Mikko Rapeli <mikko.rapeli@linaro.org> wrote:
>> + def test_cryptodev(self):
>> + with tempfile.TemporaryDirectory(prefix="cryptodev", dir=self.tc.sdk_dir) as testdir:
>> + git_url = "https://github.com/cryptodev-linux/cryptodev-linux"
>> + # This is a knnown-good commit post-1.13 that builds with kernel 6.7+
>> + git_sha = "bb8bc7cf60d2c0b097c8b3b0e807f805b577a53f"
>> +
>> + sourcedir = os.path.join(testdir, "cryptodev-linux")
>> + subprocess.check_output(["git", "clone", git_url, sourcedir], stderr=subprocess.STDOUT)
>
> Is there any way to cache this, e.g. yocto build download cache?
>
> Adding Internet downloads to test steps is a bad design IMO which eventually
> causes a lot of failures.
Yeah, I know. Calling back into the bitbake fetcher is an option but non-trivial to be honest. I hope that cryptodev will make a new release at some point as their last release doesn’t actually work with anything you’d consider a recent kernel.
Changing the download code in oeqa to just use the fetcher logic would make sense, I’ll put it on the list of things to do.
Ross
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OE-core] [PATCH] oeqa/sdk: add out-of-tree kernel module building test
2024-07-15 11:18 ` Ross Burton
@ 2024-07-15 11:30 ` Mikko Rapeli
[not found] ` <17E25F9219ACA60A.6120@lists.openembedded.org>
2024-07-15 13:13 ` Richard Purdie
2 siblings, 0 replies; 7+ messages in thread
From: Mikko Rapeli @ 2024-07-15 11:30 UTC (permalink / raw)
To: Ross Burton; +Cc: openembedded-core@lists.openembedded.org
On Mon, Jul 15, 2024 at 11:18:30AM +0000, Ross Burton wrote:
> On 15 Jul 2024, at 11:31, Mikko Rapeli <mikko.rapeli@linaro.org> wrote:
> >> + def test_cryptodev(self):
> >> + with tempfile.TemporaryDirectory(prefix="cryptodev", dir=self.tc.sdk_dir) as testdir:
> >> + git_url = "https://github.com/cryptodev-linux/cryptodev-linux"
> >> + # This is a knnown-good commit post-1.13 that builds with kernel 6.7+
> >> + git_sha = "bb8bc7cf60d2c0b097c8b3b0e807f805b577a53f"
> >> +
> >> + sourcedir = os.path.join(testdir, "cryptodev-linux")
> >> + subprocess.check_output(["git", "clone", git_url, sourcedir], stderr=subprocess.STDOUT)
> >
> > Is there any way to cache this, e.g. yocto build download cache?
> >
> > Adding Internet downloads to test steps is a bad design IMO which eventually
> > causes a lot of failures.
>
> Yeah, I know. Calling back into the bitbake fetcher is an option but non-trivial to be honest. I hope that cryptodev will make a new release at some point as their last release doesn’t actually work with anything you’d consider a recent kernel.
>
> Changing the download code in oeqa to just use the fetcher logic would make sense, I’ll put it on the list of things to do.
How about changing cryptodev-linux recipe to provice a package with the needed source code,
install that package to an image, and then express the dependency to package in
the oeqa test?
That way caches would be used and no need for networking when executing this test.
Cheers,
-Mikko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OE-core] [PATCH] oeqa/sdk: add out-of-tree kernel module building test
[not found] ` <17E25F9219ACA60A.6120@lists.openembedded.org>
@ 2024-07-15 11:35 ` Mikko Rapeli
2024-07-15 13:06 ` Ross Burton
0 siblings, 1 reply; 7+ messages in thread
From: Mikko Rapeli @ 2024-07-15 11:35 UTC (permalink / raw)
To: Ross Burton, openembedded-core@lists.openembedded.org
On Mon, Jul 15, 2024 at 02:30:52PM +0300, Mikko Rapeli via lists.openembedded.org wrote:
> On Mon, Jul 15, 2024 at 11:18:30AM +0000, Ross Burton wrote:
> > On 15 Jul 2024, at 11:31, Mikko Rapeli <mikko.rapeli@linaro.org> wrote:
> > >> + def test_cryptodev(self):
> > >> + with tempfile.TemporaryDirectory(prefix="cryptodev", dir=self.tc.sdk_dir) as testdir:
> > >> + git_url = "https://github.com/cryptodev-linux/cryptodev-linux"
> > >> + # This is a knnown-good commit post-1.13 that builds with kernel 6.7+
> > >> + git_sha = "bb8bc7cf60d2c0b097c8b3b0e807f805b577a53f"
> > >> +
> > >> + sourcedir = os.path.join(testdir, "cryptodev-linux")
> > >> + subprocess.check_output(["git", "clone", git_url, sourcedir], stderr=subprocess.STDOUT)
> > >
> > > Is there any way to cache this, e.g. yocto build download cache?
> > >
> > > Adding Internet downloads to test steps is a bad design IMO which eventually
> > > causes a lot of failures.
> >
> > Yeah, I know. Calling back into the bitbake fetcher is an option but non-trivial to be honest. I hope that cryptodev will make a new release at some point as their last release doesn’t actually work with anything you’d consider a recent kernel.
> >
> > Changing the download code in oeqa to just use the fetcher logic would make sense, I’ll put it on the list of things to do.
>
> How about changing cryptodev-linux recipe to provice a package with the needed source code,
> install that package to an image, and then express the dependency to package in
> the oeqa test?
And by image I mean the SDK under test.
Cheers,
-Mikko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OE-core] [PATCH] oeqa/sdk: add out-of-tree kernel module building test
2024-07-15 11:35 ` Mikko Rapeli
@ 2024-07-15 13:06 ` Ross Burton
0 siblings, 0 replies; 7+ messages in thread
From: Ross Burton @ 2024-07-15 13:06 UTC (permalink / raw)
To: Mikko Rapeli; +Cc: openembedded-core@lists.openembedded.org
> On 15 Jul 2024, at 12:35, Mikko Rapeli <mikko.rapeli@linaro.org> wrote:
>
> On Mon, Jul 15, 2024 at 02:30:52PM +0300, Mikko Rapeli via lists.openembedded.org wrote:
>> On Mon, Jul 15, 2024 at 11:18:30AM +0000, Ross Burton wrote:
>>> On 15 Jul 2024, at 11:31, Mikko Rapeli <mikko.rapeli@linaro.org> wrote:
>>>>> + def test_cryptodev(self):
>>>>> + with tempfile.TemporaryDirectory(prefix="cryptodev", dir=self.tc.sdk_dir) as testdir:
>>>>> + git_url = "https://github.com/cryptodev-linux/cryptodev-linux"
>>>>> + # This is a knnown-good commit post-1.13 that builds with kernel 6.7+
>>>>> + git_sha = "bb8bc7cf60d2c0b097c8b3b0e807f805b577a53f"
>>>>> +
>>>>> + sourcedir = os.path.join(testdir, "cryptodev-linux")
>>>>> + subprocess.check_output(["git", "clone", git_url, sourcedir], stderr=subprocess.STDOUT)
>>>>
>>>> Is there any way to cache this, e.g. yocto build download cache?
>>>>
>>>> Adding Internet downloads to test steps is a bad design IMO which eventually
>>>> causes a lot of failures.
>>>
>>> Yeah, I know. Calling back into the bitbake fetcher is an option but non-trivial to be honest. I hope that cryptodev will make a new release at some point as their last release doesn’t actually work with anything you’d consider a recent kernel.
>>>
>>> Changing the download code in oeqa to just use the fetcher logic would make sense, I’ll put it on the list of things to do.
>>
>> How about changing cryptodev-linux recipe to provice a package with the needed source code,
>> install that package to an image, and then express the dependency to package in
>> the oeqa test?
>
> And by image I mean the SDK under test.
That’s horrible, and would mean that we’d need to install special packages into the SDK to exercise this.
Ross
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OE-core] [PATCH] oeqa/sdk: add out-of-tree kernel module building test
2024-07-15 11:18 ` Ross Burton
2024-07-15 11:30 ` Mikko Rapeli
[not found] ` <17E25F9219ACA60A.6120@lists.openembedded.org>
@ 2024-07-15 13:13 ` Richard Purdie
2 siblings, 0 replies; 7+ messages in thread
From: Richard Purdie @ 2024-07-15 13:13 UTC (permalink / raw)
To: ross.burton, Mikko Rapeli; +Cc: openembedded-core@lists.openembedded.org
On Mon, 2024-07-15 at 11:18 +0000, Ross Burton via
lists.openembedded.org wrote:
> On 15 Jul 2024, at 11:31, Mikko Rapeli <mikko.rapeli@linaro.org>
> wrote:
> > > + def test_cryptodev(self):
> > > + with tempfile.TemporaryDirectory(prefix="cryptodev",
> > > dir=self.tc.sdk_dir) as testdir:
> > > + git_url =
> > > "https://github.com/cryptodev-linux/cryptodev-linux"
> > > + # This is a knnown-good commit post-1.13 that builds
> > > with kernel 6.7+
> > > + git_sha = "bb8bc7cf60d2c0b097c8b3b0e807f805b577a53f"
> > > +
> > > + sourcedir = os.path.join(testdir, "cryptodev-linux")
> > > + subprocess.check_output(["git", "clone", git_url,
> > > sourcedir], stderr=subprocess.STDOUT)
> >
> > Is there any way to cache this, e.g. yocto build download cache?
> >
> > Adding Internet downloads to test steps is a bad design IMO which
> > eventually
> > causes a lot of failures.
>
> Yeah, I know. Calling back into the bitbake fetcher is an option but
> non-trivial to be honest. I hope that cryptodev will make a new
> release at some point as their last release doesn’t actually work
> with anything you’d consider a recent kernel.
>
> Changing the download code in oeqa to just use the fetcher logic
> would make sense, I’ll put it on the list of things to do.
Where we use tarballs in oeqa, there is code that just directly fishes
them out of DL_DIR.
Locking becomes harder with git repos but it shouldn't be hard to use
the bitbake fetch API standalone from the metadata.
Cheers,
Richard
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-07-15 13:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-12 18:43 [PATCH] oeqa/sdk: add out-of-tree kernel module building test Ross Burton
2024-07-15 10:31 ` [OE-core] " Mikko Rapeli
2024-07-15 11:18 ` Ross Burton
2024-07-15 11:30 ` Mikko Rapeli
[not found] ` <17E25F9219ACA60A.6120@lists.openembedded.org>
2024-07-15 11:35 ` Mikko Rapeli
2024-07-15 13:06 ` Ross Burton
2024-07-15 13:13 ` Richard Purdie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox