-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build.py: build/install kselftests #339
Conversation
hmm, I just realized that we don't build the kselftest fragment on staging, so this build will not be tested. |
Right, I've just merged the other PR to add kselftest fragments on staging. So this should become active in the next staging run. |
OK got some builds, here's one: I haven't checked whether it is as expected, @khilman can you please take a look? |
The kselftest-install step is failing due to
Which is now addressed by #345 Note that this doesn't cause the whole build to fail, just the kselftests to not be installed. |
@gctucker this one should be ready now, no? |
It would be a lot better to keep the kselftest steps in separate functions, the Then I'm not sure of the impact of converting the output path from relative to absolute, there might be some unwanted side effects. |
From a functional point of view, it seems to be doing the right thing. Here's a sample build: which includes a kselftest tarball: Taking a quick look, this seems fine:
and there doesn't seem to be any side-effects of this PR on other "regular" builds. It would be nice to at least try to run a test job with the contents of this archive to completely verify it was built correctly, maybe with a manually modified kernelci rootfs to skip the actual LAVA integration part. Then with a bit of code clean-up this should be ready to go. We should probably build a very small set of kernels with kselftest until we can actually run tests, just enough to facilitate things a bit. |
# Ideally this should just be a 'make kselftest-install', but | ||
# due to bugs with O= in kselftest Makefile, this has to be | ||
# 'make -C tools/testing/selftests install' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance these bugs can be fixed? Is there any email thread about this topic to follow what is going?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were some similar discussions, but nothing on this specifially. I'll start an email thread on the kselftest list.
However, even if this gets fixed upstream, it's unlikely this would be backported, so I think we should stick with the workaround in this patch for awhile, especially if we expect to run kselftest on the stable kernels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I think this was fixed in v5.7 (see merge 397a97946798890b9bdaa6122fcfad7147690670), but perhaps I'm not understanding the specific bug as it related to running under kernelci's builder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@khilman Can you please add a link to the discussion in the kselftest mailing list archives?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are several related issues around this:
- https://lore.kernel.org/lkml/158351957799.3363.15269768530697526765.stgit@devnote2/
- https://lore.kernel.org/linux-kselftest/MWHPR13MB0895B92C9B4807D94E1E6B04FDE30@MWHPR13MB0895.namprd13.prod.outlook.com/
- https://lore.kernel.org/bpf/cover.1583358715.git.skhan@linuxfoundation.org/
As well as some interesting tools to help sanity check:
But again, even though most (maybe all?) of these issues are fixed upstream, it's unlikely these all be backported to stable, so the workaround in this series is still necessary if we want to build kselftest on stable.
Let's focus on the k8s stuff merged first and then work on resolving this one. I think it's 90% good, might just need rebasing and a couple of minor tweaks. |
966dc30
to
3e22353
Compare
3e22353
to
36b6b5e
Compare
Removed a stray debug print. |
@@ -787,6 +807,17 @@ def install_kernel(kdir, tree_name, tree_url, git_branch, git_commit=None, | |||
shell_cmd("tar -C{path} -cJf {tarball} .".format( | |||
path=mod_path, tarball=modules_tarball_path)) | |||
|
|||
# 'make gen_tar' creates this tarball path | |||
kselftest_tarball = 'kselftest-packages/kselftest.tar.gz' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit says ".xz", code expects ".gz", but depends on the default behavior of "gen_tar" without a FORMAT= specified. Perhaps explicitly declare "FORMAT=.xz" (or =.gz) (and update the filename and commit message appropriately)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I'll make it more explicit and clean up the changelog. Thanks for the review.
FWIW, I started with .xz for size reasons, but we're recycling a test-plan from another test project (Linaro LKFT) and their test wrappers etc. have a bunch of hard-coded assumptions for .gz, so I switched to that (but forgot to update commit message.)
36b6b5e
to
d42a6b1
Compare
Add conditional step to build_kernel that builds the in-kernel selftests. Build is conditioned on "kselftest" being in defconfig_extras. The build step will also create a kselftest tarball using the 'make gen_tar' target in tools/testing/selftests. If kselftests are build, install_kernel will copy the compressed tarball into the install dir, and published in the publish_step, and added to bmeta.json (key: kselftests) NOTE: make gen_tar explicitly uses FORMAT=.gz to generate a gzip'd tarball because the LKFT test-plan we use for kselftest has hard-coded assumptions about the Signed-off-by: Kevin Hilman <khilman@baylibre.com>
d42a6b1
to
989da10
Compare
Updated PR: dropped patch which updated rootfs image since this is now updated in master branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I think this is OK to get merged and rolled out in production. A couple of things that should be kept in mind though:
-
Adding test binaries to a kernel build is not a great precedent, as it blurs the definition of what a kernel build is for KernelCI. Of course, kselftest is a bit special since it's tied to the kernel source. Still, adding other things in the future like documentation or any other artifacts that can be built within a kernel tree is probably going to cause us some problems. So we should try to deal with that by having a separate place for "kernel extras" that aren't actually the kernel, but built from the kernel tree.
-
Building everything in the
build_kernel
function is not great, that's not new but it's not going in the right direction withkselftest
being added there too. As a result, we can't build a kernel with kselftest config enabled without also building the kselftest tarball. That will need some slight redesign all the way to thekci_build
command line interface, so it's probably best to tackle that once the settings file support is merged and when all the data-related operations go viakernelci.data
(i.e.publish_kernel
,push_kernel
etc...).
@@ -467,7 +467,8 @@ def _run_make(kdir, arch, target=None, jopt=None, silent=True, cc='gcc', | |||
args.append('CC={}'.format(cc)) | |||
|
|||
if output: | |||
args.append('O={}'.format(os.path.relpath(output, kdir))) | |||
# due to kselftest Makefile issues, O= cannot be a relative path | |||
args.append('O={}'.format(os.path.abspath(output))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK tested manually with arbitrary output paths.
Tested OK on staging, combined with #445: https://staging.kernelci.org/test/plan/id/5f45aff802c5b617e7b1458c/ |
Add conditional step to build_kernel that builds the in-kernel
selftests. Build is conditioned on "kselftest" being in
defconfig_extras.
If kselftests are build, install_kernel will create a
kselftests.tar.xz archive that will be published in the publish_step,
and added to bmeta.json (key: kselftests)
Signed-off-by: Kevin Hilman khilman@baylibre.com