Targets for the portable stand-alone variant of the CheriBSD test suite#479
Targets for the portable stand-alone variant of the CheriBSD test suite#479paul-metzger wants to merge 9 commits into
Conversation
bb04b69 to
dc097fd
Compare
|
After a conversation with Hesham, we want to have the binaries in a subdirectory of /opt/. |
Probably under |
|
The target name is tentative -- please feel free to make suggestions. |
e5592d9 to
f7f5463
Compare
| # We are including cheriintrin.h for some of the definitions | ||
| # that are on CheriBSD in other header files. However, cheric.h | ||
| # and cheriintrin.h define cheri_is_subset() but a comment in | ||
| # cheric.h indicates that the intrinsic is still unstable. Therefore, |
There was a problem hiding this comment.
Is that a CheriBSD's cheric.h?
There was a problem hiding this comment.
Yes, the stand-alone variant of the CheriBSD test suite includes a copy of CheriBSD's cheric.h because some test cases use macros and functions defined in it.
I removed this comment and the -Wno-error=macro-redefined that followed it and added #undef cheri_is_subset before the redefinition of cheri_is_subset in the copy of cheric.h instead.
| # cheriintrin.h if necessary. | ||
| self.cross_warning_flags.append("-Wno-error=macro-redefined") | ||
|
|
||
| # Musl libc's endian.h causes these warnings |
There was a problem hiding this comment.
Probably worth bookkeepings those somewhere so that we can properly fix in musl later
There was a problem hiding this comment.
Would it be useful to create matching issues in the CHERI Alliance's musl repository?
There was a problem hiding this comment.
I'd say yes, and probably link it here as well https://github.com/CHERI-Alliance/linux/milestone/1
Probably also the cheric.h for Linux too?
There was a problem hiding this comment.
I created an issue in the CHERI Alliance Musl repository for one of these: CHERI-Alliance/musl#8
The other's were not CHERI-related and benign. I changed the use of -W flags in the test suite repository and removed the -Wno flags from the cheribuild target.
There was a problem hiding this comment.
Probably also the cheric.h for Linux too?
@heshamelmatary, cheric.h is deprecated. It may be better to not bundle cheric.h with CHERI Musl and just bundle a copy with the test cases instead, with the intention to remove it and adapt the test cases at a later point.
There was a problem hiding this comment.
For things we're not sure about, I might suggest creating a local macro in the cheritest_* namespace.
There was a problem hiding this comment.
@brooksdavis I’m not quite sure what you’re suggesting. Could you elaborate a little? For what would you like me to create a macro?
There was a problem hiding this comment.
For non-portable macros, the test suite should define it's own version of them until and unless they are added to cheriintrin.h
| "MACHINE_ARCH": machine_arch, | ||
| } | ||
|
|
||
| def install(self, **kwargs): |
There was a problem hiding this comment.
Is that needed? if it's just make install I guess the CrossCompileMakefileProjector CrossCompileAutotoolsProject parent would do that for you, without you having to define install
There was a problem hiding this comment.
This tells cheribuild that the makefile is not in the root directory of the repository but in <repo_root>/cheribsdtest. This makefile and the source code will move from <repo_root>/cheribsdtest to the repository's root directory in the future.
dbda961 to
6d013f7
Compare
|
|
||
| # Overwrite dependencies because libsys and libcompiler_rt don't exist in | ||
| # the CHERI/Morello Linux sysroot | ||
| self.make_args.set( |
There was a problem hiding this comment.
This seems rather awkward. I think you're bundling the makefiles so could you fix it in the source repo? Or alternatively it might make sense to write a CMake/meson based build system which should be quite simple for this small project.
There was a problem hiding this comment.
Done, I fixed this in the test suite repository instead, as suggested.
The bundled makefiles are just an interim solution that will be replaced by cmake. However, these tests would be very useful to @heshamelmatary and potentially others, including work on a CI setup for the CHERI Alliance Linux repositories, and so I created this PR before replacing the makefiles with cmake.
78ccd1a to
38c87e0
Compare
| # `default_branch` is set because the build scripts assume that | ||
| # a git tag is checked out. In more detail ./get-version returns an | ||
| # empty string if main is checked out. | ||
| repository = GitRepository("https://gitlab.freedesktop.org/libbsd/libbsd.git", default_branch="0.12.2") |
There was a problem hiding this comment.
What I've done in cases like this in the past is use temporary_url_override to point it at a fork with the patch applied to avoid needing the logic for patching inside the target.
There was a problem hiding this comment.
Done - I've created a patched fork of libbsd on the freedesktop GitLab instance with a view to upstreaming the patch to libbsd soon (see my comment above).
6c27825 to
382a91e
Compare
|
It's looking way better to me. I built and tested it locally for Morello and RVY and it's working just fine. @paul-metzger please let us know once you're ready to make the repo public, then can add it to Jenkins tests after we merge this PR |
| @@ -0,0 +1,136 @@ | |||
| # | |||
| # Copyright (c) 2025 Paul Metzger | |||
There was a problem hiding this comment.
| # Copyright (c) 2025 Paul Metzger | |
| # Copyright (c) 2026 Paul Metzger |
There was a problem hiding this comment.
Thanks, I've updated the copyright in all files.
| from ...utils import classproperty | ||
|
|
||
|
|
||
| class BuildCheriAPITests(CrossCompileMakefileProject): |
There was a problem hiding this comment.
Should we give this an explicit target name instead of the default?
E.g. cheri-portable-tests?
There was a problem hiding this comment.
I've named them cheri-portable-os-tests. I think Robert would like to have OS or the like in the name.
d3086e2 to
2a11df7
Compare
CheriBSDtest depends on libxo which in turn depends on libmd.
This is a dependency of the stand-alone CheriBSD test suite.
This is a dependency of the stand-alone CheriBSD test suite.
cc7b8fd to
ea9aed7
Compare
Added targets for the stand-alone test suite, including flags to avoid linking with libgcc_s, which isn't available on CHERI Alliance Linux.
The installation of libcheribsdtest_dynamic failed when cross-compiling on Ubuntu because the local objcopy was used instead of CHERI LLVM's objcopy. This commit fixes this by setting the OBJCOPY environment variable. The property objcopy was add to _ClangBasedTargetInfo to support this.
The targets for Morello Linux and CHERI Linux on Morello both used the 'morello-purecap' suffix. This commit fixes this by chaning the suffix for Morello Linux targets to 'legacy-morello-purecap', as suggested by Alexander Richardson. This commit also includes a similar fix for non-purecap Morello targets.
We are now using a patched fork of libbsd with a view to merging the patch upstream.
This cambridge-morello-7.0 branch has fixes for the Morello support and should be used until all of those fixes are merged.
This PR contains CHERI/Morello Linux targets for a portable stand-alone variant of the CheriBSD test suite. We'd like to be able to use it on CHERI/Morello Linux for testing and to help with cataloguing design differences between the CHERI-related parts of CheriBSD's and CHERI/Morello Linux's OS interfaces.
@heshamelmatary is interested in this PR for testing.
Setup for Morello Linux:
./cheribuild.py cheri-portable-os-tests --qemu/no-use-smbd -d./cheribuild.py run-minimal-morello-linux-morello-purecap --qemu/no-use-smbd -d/opt/cheri-portable-os-tests.This issue causes a compile time error and needs to be fixed by hand for Morello Muslc: Fix const dropping cast CHERI-Alliance/musl#3
The test suite needs to be built first in order for it to be included into the image built in the second step.
The workflow for RVY CHERI Linux is similar.
The repository with the adapted test cases is private currently, but the intention is to make it publicly available soon.