On Tue, Jun 25, 2024 at 05:54:08PM +0530, Dev Jain wrote:
Add arm target, individual Makefile targets, and instructions to build the tests, along with .gitignore files. All the Makefiles are similar to selftests/arm64, except abi: use TEST_CUSTOM_PROGS to override the make rule from lib.mk. Also, do not build ptrace_64 if we are running a 32-bit kernel.
Also the documentation which could probably go separately.
+- This is a series of compatibility tests, wherein the source files are
- built statically into a 32 bit ELF; they should pass on both 32 and 64
- bit kernels. They are not built or run but just skipped completely when
- env-variable ARCH is found to be different than 'arm64' or 'arm' and
- `uname -m` reports other than 'aarch64', 'armv7l' or 'armv8l'.
These are just plain old tests for arm, the fact that we can use them to test 32 bit mode on a 64 bit host is a nice bonus but the tests are just as useful with actual arm hardware.
+- If building the tests on a 64-bit kernel, please ensure that the kernel is
- built with CONFIG_COMPAT enabled.
Running, not building.
+- Holding true the above, ARM KSFT tests can be run within the KSelfTest
- framework using standard Linux top-level-makefile targets. Please set
- $(CROSS_COMPILE) to 'arm-linux-gnueabi-' or 'arm-linux-gnueabihf-'.
Or whatever your toolchain is set to! We should also consider the LLVM=1 case here for building with clang (which is even easier as it supports all architectures in a single binary).
$ make TARGETS=arm kselftest-clean
$ make $(CROSS_COMPILE) TARGETS=arm kselftest
or
$ make $(CROSS_COMPILE) -C tools/testing/selftests TARGETS=arm \
INSTALL_PATH=<your-installation-path> install
or, alternatively, only specific arm/ subtargets can be picked:
$ make $(CROSS_COMPILE) -C tools/testing/selftests TARGETS=arm \
ARM_SUBTARGETS="signal" INSTALL_PATH=<your-installation-path> \
install
I would expect the Makefile to have machinery which if we're building for arm64 would use CROSS_COMPILE_COMPAT here and force 32 bit builds.
+# Do not build 64-bit programs if running on a native 32-bit kernel +UNAME_M := $(shell uname -m) +ifneq (,$(filter $(UNAME_M),aarch64 arm64)) +TEST_CUSTOM_PROGS := $(OUTPUT)/ptrace_64
Where we're building shouldn't affect what gets run - it is very common especially in CI systems to build on one system and then run the tests on a completely separate machine.