#
54410245 |
|
08-Nov-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: mips: add support for PIC MIPS requires some extra instructions to set up the $gp register for the with a pointer to the global data area. This isn't needed for non-PIC builds, but this patch enables the code unconditionally to prevent bitrot. Also enable PIC in one of the test configurations for ongoing validation. Link: https://lore.kernel.org/r/20231108-nolibc-pic-v2-1-4fb0d6284757@weissschuh.net Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
|
#
d7233e2b |
|
14-Sep-2077 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: introduce QEMU_ARCH_USER While ppc64le shares the same executable with regular ppc64 the user variant needs has a dedicated executable. Introduce a new QEMU_ARCH_USER Makefile variable to accommodate that. Fixes: 17362f3d0bd3 ("selftests/nolibc: use qemu-system-ppc64 for ppc64le") Link: https://lore.kernel.org/r/20770915-nolibc-run-user-v1-1-3caec61726dc@weissschuh.net Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
|
#
b4b9fb91 |
|
20-Oct-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: add configuration for mipso32be Allow testing MIPS O32 big endian. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu>
|
#
3ab1e9db |
|
20-Oct-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: extraconfig support Allow some postprocessing of defconfig files. Suggested-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu>
|
#
bb503f5f |
|
20-Oct-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: explicitly specify ABI for MIPS More ABIs exist, for better clarity specify it explicitly everywhere. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu>
|
#
c4c20a7d |
|
20-Oct-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: use XARCH for MIPS MIPS has many different configurations prepare the support of additional ones by moving the build of MIPS to the generic XARCH infrastructure. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu>
|
#
69620b3a |
|
31-Oct-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: support out-of-tree builds Out of tree builds are much more convenient when building for multiple architectures or configurations in parallel. Only absolute O= parameters are supported as Makefile.include will always resolve relative paths in relation to $(srctree) instead of the current directory. Add a call to "make outputmakefile" to verify that the sourcetree is clean. This is based on Zhangjins out-of-tree patch. It extends that work for get_init_cpio support and also drops relative O= specifications explicitly. Link: https://lore.kernel.org/lkml/06d96bd81fe812a9718098a383678ad3beba98b1.1691215074.git.falcon@tinylab.org/ Co-developed-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/r/20231031-nolibc-out-of-tree-v1-3-47c92f73590a@weissschuh.net
|
#
7263c9d9 |
|
31-Oct-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: anchor paths in $(srcdir) if possible It is easier to recognize paths from their well-known location in the source tree than having to resolve the relative path in ones head. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/r/20231031-nolibc-out-of-tree-v1-2-47c92f73590a@weissschuh.net
|
#
bdeeeaba |
|
31-Oct-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: use EFI -bios for LoongArch qemu qemu for LoongArch does not work properly with direct kernel boot. The kernel will panic during initialization and hang without any output. When booting in EFI mode everything work correctly. While users most likely don't have the LoongArch EFI binary installed at least an explicit error about 'file not found' is better than a hanging test without output that can never succeed. Link: https://lore.kernel.org/loongarch/1738d60a-df3a-4102-b1da-d16a29b6e06a@t-8ch.de/ Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/r/20231031-nolibc-out-of-tree-v1-1-47c92f73590a@weissschuh.net
|
#
89b212d4 |
|
13-Nov-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: don't hang on config input When the kernel code has changed the build may ask for configuration input and hang. Prevent this and instead use the default settings. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
|
#
b8c60e8f |
|
11-Oct-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: add tests for multi-object linkage While uncommon, nolibc executables can be linked together from multiple compilation units. Add some tests to make sure everything works in that case. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/lkml/20231012-nolibc-linkage-test-v1-1-315e682768b4@weissschuh.net/ Acked-by: Willy Tarreau <w@1wt.eu>
|
#
17362f3d |
|
08-Oct-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: use qemu-system-ppc64 for ppc64le qemu-system-ppc64 can handle both big and little endian kernels. While some setups, like Debian, provide a symlink to execute qemu-system-ppc64 as qemu-system-ppc64le, others, like ArchLinux, do not. So always use qemu-system-ppc64 directly. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/lkml/20231008-nolibc-qemu-ppc64-v1-1-29e2326e0420@weissschuh.net/ Acked-by: Willy Tarreau <w@1wt.eu>
|
#
95315486 |
|
17-Sep-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: allow building i386 with multiarch compiler When building with a multiarch-capable compiler, like those provided by common distributions the -m32 argument is required to build 32bit code. Wrap it in cc-option in case the compiler is not multiarch-capable. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/r/20230917-nolibc-syscall-nr-v2-1-03863d509b9a@weissschuh.net
|
#
45839d09 |
|
17-Sep-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: don't embed initramfs into kernel image When the initramfs is embedded into the kernel each rebuild of it will trigger a full kernel relink and all the expensive postprocessing steps. Currently nolibc-test and therefore the initramfs are always rebuild, even without source changes, leading to lots of slow kernel relinks. Instead of linking the initramfs into the kernel assemble it manually and pass it explicitly to qemu. This avoids all of the kernel relinks. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> Link: https://lore.kernel.org/r/20230917-nolibc-initramfs-v2-1-f0f293a8b198@weissschuh.net
|
#
265fbb4b |
|
30-Aug-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: use -nostdinc for nolibc-test Avoid any accidental reliance on system includes. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
418c8468 |
|
11-Aug-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: libc-test: use HOSTCC instead of CC libc-test is mainly added to compare the behavior of nolibc to the system libc, it is meaningless and error-prone with cross compiling. Let's use HOSTCC instead of CC to avoid wrongly use cross compiler when CROSS_COMPILE is passed or customized. Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Fixes: cfb672f94f6e ("selftests/nolibc: add run-libc-test target") Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
ce1bb82b |
|
05-Aug-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: allow report with existing test log After the tests finish, it is valuable to report and summarize with existing test log. This avoid rerun or run the tests again when not necessary. Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
faeb4e09 |
|
05-Aug-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: add test support for ppc64 Kernel uses ARCH=powerpc for both 32-bit and 64-bit PowerPC, here adds a ppc64 variant for big endian 64-bit PowerPC, users can pass XARCH=ppc64 to test it. The powernv machine of qemu-system-ppc64 is used with powernv_be_defconfig. As the document [1] shows: PowerNV (as Non-Virtualized) is the “bare metal” platform using the OPAL firmware. It runs Linux on IBM and OpenPOWER systems and it can be used as an hypervisor OS, running KVM guests, or simply as a host OS. Notes, - differs from little endian 64-bit PowerPC, vmlinux is used instead of zImage, because big endian zImage [2] only boot on qemu with x-vof=on (added from qemu v7.0) and a fixup patch [3] for qemu v7.0.51: - since the VSX support may be disabled in kernel side, to avoid "illegal instruction" errors due to missing VSX kernel support, let's simply let compiler not generate vector/scalar (VSX) instructions via the '-mno-vsx' option. - as 'man gcc' shows, '-mmultiple' is used to generate code that uses the load multiple word instructions and the store multiple word instructions. Those instructions do not work when the processor is in little-endian mode (except PPC740/PPC750), so, we only enable it for big endian powerpc. - for big endian ppc64, as the help message from arch/powerpc/Kconfig shows, the V2 ABI is standard for 64-bit little-endian, but for big-endian it is less well tested by kernel and toolchain, so, use elfv1 as-is, no need to explicitly ask toolchain to use elfv2 here. [1]: https://qemu.readthedocs.io/en/latest/system/ppc/powernv.html [2]: https://github.com/linuxppc/issues/issues/402 [3]: https://lore.kernel.org/qemu-devel/20220504065536.3534488-1-aik@ozlabs.ru/ Suggested-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/lkml/20230722121019.GD17311@1wt.eu/ Link: https://lore.kernel.org/lkml/20230719043353.GC5331@1wt.eu/ Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
8a5040cb |
|
05-Aug-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: add test support for ppc64le Kernel uses ARCH=powerpc for both 32-bit and 64-bit PowerPC, here adds a ppc64le variant for little endian 64-bit PowerPC, users can pass XARCH=ppc64le to test it. The powernv machine of qemu-system-ppc64le is used for there is just a working powernv_defconfig. As the document [1] shows: PowerNV (as Non-Virtualized) is the “bare metal” platform using the OPAL firmware. It runs Linux on IBM and OpenPOWER systems and it can be used as an hypervisor OS, running KVM guests, or simply as a host OS. Notes, - since the VSX support may be disabled in kernel side, to avoid "illegal instruction" errors due to missing VSX kernel support, let's simply let compiler not generate vector/scalar (VSX) instructions via the '-mno-vsx' option. - little endian ppc64 prefers elfv2 to elfv1 if the toolchain (e.g. gcc 13.1.0) supports it, let's align with kernel, otherwise, our elfv1 binary will not run on kernel with elfv2 ABI. [1]: https://qemu.readthedocs.io/en/latest/system/ppc/powernv.html Suggested-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/lkml/20230722120747.GC17311@1wt.eu/ Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
587e9845 |
|
05-Aug-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: add test support for ppc Kernel uses ARCH=powerpc for both 32-bit and 64-bit PowerPC, here adds a ppc variant for 32-bit PowerPC and uses it as the default variant of powerpc architecture. Users can pass XARCH=ppc (or ARCH=powerpc) to test 32-bit PowerPC. The default qemu-system-ppc g3beige machine [1] is used to run 32-bit powerpc kernel with pmac32_defconfig. The missing PMACZILOG serial tty and console are enabled in another patch [2]. Note, - zImage doesn't boot due to "qemu-system-ppc: Some ROM regions are overlapping" error, so, vmlinux is used instead. - since the VSX support may be disabled in kernel side, to avoid "illegal instruction" errors due to missing VSX kernel support, let's simply let compiler not generate vector/scalar (VSX) instructions via the '-mno-vsx' option. - as 'man gcc' shows, '-mmultiple' is used to generate code that uses the load multiple word instructions and the store multiple word instructions. Those instructions do not work when the processor is in little-endian mode (except PPC740/PPC750), so, we only enable it for big endian powerpc. [1]: https://qemu.readthedocs.io/en/latest/system/ppc/powermac.html [2]: https://lore.kernel.org/lkml/bb7b5f9958b3e3a20f6573ff7ce7c5dc566e7e32.1690982937.git.tanyuan@tinylab.org/ Suggested-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/lkml/ZL9leVOI25S2+0+g@1wt.eu/ Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
c6c3734f |
|
05-Aug-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: add XARCH and ARCH mapping support Most of the CPU architectures have different variants, but kernel usually only accepts parts of them via the ARCH variable, the others should be customized via kernel config files. To simplify testing, a new XARCH variable is added to extend the kernel's ARCH with a few variants of the same architecture, and it is used to customize variant specific variables, at last XARCH is converted to the kernel's ARCH: e.g. make run XARCH=<one of the supported variants> | \ | `-> variant specific variables: | IMAGE, DEFCONFIG, QEMU_ARCH, QEMU_ARGS, CFLAGS ... \ `---> kernel's ARCH XARCH and ARCH are carefully mapped to allow users to pass architecture variants via XARCH or pass architecture via ARCH from cmdline. PowerPC is the first user and also a very good reference architecture of this mapping, it has variants with different combinations of 32-bit/64-bit and bit endian/little endian. To use this mapping, the other architectures can refer to PowerPC, If the target architecture only has one variant, XARCH is simply an alias of ARCH, no additional mapping required. Suggested-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/lkml/20230702171715.GD16233@1wt.eu/ Link: https://lore.kernel.org/lkml/20230730061801.GA7690@1wt.eu/ Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
45f65f8d0 |
|
03-Aug-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: enable compiler warnings It will help the developers to avoid cruft and detect some bugs. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
711edef8 |
|
03-Aug-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: don't strip nolibc-test Binary size is not important for nolibc-test and some debugging information is nice to have, so don't strip the binary during linking. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
850fad7d |
|
15-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: allow test -include /path/to/nolibc.h As the head comment of nolibc-test.c shows, it can be built in 3 ways: $(CC) -nostdlib -include /path/to/nolibc.h => NOLIBC already defined $(CC) -nostdlib -I/path/to/nolibc/sysroot => _NOLIBC_* guards are present $(CC) with default libc => NOLIBC* never defined Only last two of them are tested currently, let's allow test the first one too. This may help to find issues about using nolibc.h to build programs. it derives from this change: commit 3a8039e289a3 ("tools/nolibc: Fix build of stdio.h due to header ordering") Usage: // test with sysroot by default $ make run-user // test without sysroot, using nolibc.h directly $ make run-user NOLIBC_SYSROOT=0 Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
b8143407 |
|
15-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: allow run nolibc-test locally It is able to run nolibc-test directly without qemu-user when the target machine is the same as the host machine. Sometimes, the result running locally may help a lot when the qemu-user package is too old. When the target machine differs from the host machine, it is also able to run nolibc-test directly with qemu-user-static + binfmt_misc. Link: https://lore.kernel.org/lkml/ZKutZwIOfy5MqedG@1wt.eu/ Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
4beb9be8 |
|
06-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: report: add newline before test failures a newline is inserted just before the test failures to avoid mixing the test failures with the raw test log. Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
7d92e893 |
|
06-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: report: extrude the test status line two newlines are added around the test summary line to extrude the test status. Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
0ac908e3 |
|
06-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: report: align passed, skipped and failed align the test values for different runs and different architectures. Since the total number of tests is not bigger than 1000 currently, let's align them with "%3d". Signed-off-by: Zhangjin Wu <falcon@tinylab.org> [wt: s/%03d/%3d/ as discussed with Zhangjin] Link: https://lore.kernel.org/lkml/20230709185112.97236-1-falcon@tinylab.org/ Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
c0faa0da |
|
06-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: report: print total tests Let's count and print the total number of tests, now, the data of passed, skipped and failed have the same format. Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
c0315c79 |
|
06-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: report: print a summarized test status one of the test status: success, warning and failure is printed to summarize the passed, skipped and failed values. - "success" means no skipped and no failed. - "warning" means has at least one skipped and no failed. - "failure" means all tests are failed. Suggested-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/lkml/20230702164358.GB16233@1wt.eu/ Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
cfb672f9 |
|
07-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: add run-libc-test target allow run and report glibc or musl based libc-test. Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
5163b8d3 |
|
19-Jun-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: restore the failed tests print The commit fa0df56a804b ("selftests/nolibc: also count skipped and failed tests in output") added counting for the skipped and failed tests, but also removed the 'FAIL' results print, let's restore it for it really allow users to learn the failed details without opening the log file. Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
b3389e48 |
|
19-Jun-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: always print the path to test log file Even when there is no failure, developers may be still interested in the test log file, especially, string alignment, duplicated print, kernel message and so forth, so, always print the path to test log file. A new line is added for such a print to avoid annoying people who don't care about it when the test pass completely. Suggested-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/lkml/ZIB792FtG6ibOudp@1wt.eu/ Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
5ef95663 |
|
19-Jun-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: add a standalone test report macro The run-user, run and rerun targets use the same test report script, let's add a standalone test report macro for them. This shrinks code lines and simplify the future maintainability. Suggested-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/lkml/ZIB792FtG6ibOudp@1wt.eu/ Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
|
#
dd58d666 |
|
07-Jun-2023 |
Willy Tarreau <w@1wt.eu> |
selftests/nolibc: make sure gcc always use little endian on MIPS The test on MIPS stopped working after I upgraded some of my toolchains to use the ones from kernel.org because the mips toolchain defaults to big endian, even though it supports both endians. Let's just add an explicit -EL to make sure it always succeeds like the kernel does. Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
fa0df56a |
|
04-Jun-2023 |
Willy Tarreau <w@1wt.eu> |
selftests/nolibc: also count skipped and failed tests in output Right now skipped and failed test counts are not reported, and a few times already we missed skipped ones that ought not to. Let's now count each category and continue to invite the user to check the report file when skipped+fail > 0. E.g: $ make run-user (...) CC nolibc-test 136 test(s) passed, 2 skipped, 0 failed. See all results in .../run.out Note that it's important to be careful about the trailing \r on the qemu output (thanks Zhangjin for noticing). Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
c88e46d6 |
|
03-Jun-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: allow specify extra arguments for qemu The opensbi package from Ubuntu 20.04 only provides rv64 firmwares: $ dpkg -S opensbi | grep -E "fw_.*bin|fw_.*elf" | uniq opensbi: /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_dynamic.bin opensbi: /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.bin opensbi: /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_dynamic.elf opensbi: /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf To run this nolibc test for rv32, users must build opensbi or download a prebuilt one from qemu repository: https://gitlab.com/qemu-project/qemu/-/blob/master/pc-bios/opensbi-riscv32-generic-fw_dynamic.bin And then use -bios to tell qemu use it to avoid such failure: $ qemu-system-riscv32 -display none -no-reboot -kernel /path/to/arch/riscv/boot/Image -serial stdio -M virt -append "console=ttyS0 panic=-1" qemu-system-riscv32: Unable to load the RISC-V firmware "opensbi-riscv32-generic-fw_dynamic.bin" To run from makefile, QEMU_ARGS_EXTRA is added to allow pass extra arguments like -bios: $ make run QEMU_ARGS_EXTRA="-bios /path/to/opensbi-riscv32-generic-fw_dynamic.bin" ... Suggested-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/linux-riscv/2ab94136-d341-4a26-964e-6d6c32e66c9b@t-8ch.de/ Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
0093c2da |
|
21-May-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: simplify stackprotector compiler flags Now that nolibc enable stackprotector support automatically when the compiler enables it we only have to get the -fstack-protector flags correct. The cc-options are structured so that -fstack-protector-all is only enabled if -mstack-protector=guard works, as that is the only mode supported by nolibc. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
56d294a5 |
|
20-May-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: riscv: add stackprotector support Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
3da0de37 |
|
17-Apr-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: mips: add stackprotector support Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
ca2d0437 |
|
17-Apr-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: loongarch: add stackprotector support Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
ed6c0d89 |
|
17-Apr-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: arm: add stackprotector support Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
c1e30f7d |
|
17-Apr-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: aarch64: add stackprotector support Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
f2fa6b38 |
|
06-Apr-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: validate C89 compatibility To make sure no non-compatible changes are introduced accidentally validate the language standard when building the tests. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
fc82d7db |
|
02-Apr-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: add libc-test binary This can be used to easily compare the behavior of nolibc to the system libc. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
0d8c461a |
|
25-Mar-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: x86_64: add stackprotector support Enable the new stackprotector support for x86_64. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
ff221a6d |
|
25-Mar-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: i386: add stackprotector support Enable the new stackprotector support for i386. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
97357168 |
|
25-Mar-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: tests: add test for -fstack-protector Test the previously introduce stack protector functionality in nolibc. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
255ffeee |
|
25-Mar-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: tests: fold in no-stack-protector cflags For the cflags to enable stack protectors to work properly they need to be specified after -fno-stack-protector. To do this fold all cflags into a single variable and move -fno-stack-protector before the arch-specific cflags and another one specific to stack protectors since we don't want to enable them on all archs. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
82e44139 |
|
04-Mar-2023 |
Feiyang Chen <chenfeiyang@loongson.cn> |
selftests/nolibc: Adjust indentation for Makefile Reindent only, no functional changes. Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn> Acked-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
6cd77def |
|
04-Mar-2023 |
Feiyang Chen <chenfeiyang@loongson.cn> |
selftests/nolibc: Add support for LoongArch Add support for LoongArch (64 bit) to nolibc selftest. Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn> Acked-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
077b70fb |
|
19-Mar-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: always disable stack protector for tests Stack protectors need support from libc. This support is not provided by nolibc which leads to compiler errors when stack protectors are enabled by default in a compiler: CC nolibc-test /usr/bin/ld: /tmp/ccqbHEPk.o: in function `stat': nolibc-test.c:(.text+0x1d1): undefined reference to `__stack_chk_fail' /usr/bin/ld: /tmp/ccqbHEPk.o: in function `poll.constprop.0': nolibc-test.c:(.text+0x37b): undefined reference to `__stack_chk_fail' /usr/bin/ld: /tmp/ccqbHEPk.o: in function `vfprintf.constprop.0': nolibc-test.c:(.text+0x712): undefined reference to `__stack_chk_fail' /usr/bin/ld: /tmp/ccqbHEPk.o: in function `pad_spc.constprop.0': nolibc-test.c:(.text+0x80d): undefined reference to `__stack_chk_fail' /usr/bin/ld: /tmp/ccqbHEPk.o: in function `printf': nolibc-test.c:(.text+0x8c4): undefined reference to `__stack_chk_fail' /usr/bin/ld: /tmp/ccqbHEPk.o:nolibc-test.c:(.text+0x12d4): more undefined references to `__stack_chk_fail' follow collect2: error: ld returned 1 exit status Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
c54ba417 |
|
21-Jan-2023 |
Willy Tarreau <w@1wt.eu> |
selftests/nolibc: Add a "run-user" target to test the program in user land When developing tests, it is much faster to use the QEMU Linux emulator instead of the system emulator, which among other things avoids kernel-build latencies. Although use of the QEMU Linux emulator does have its limitations (please see below), it is sufficient to test startup code, stdlib code, and syscall calling conventions. However, the current mainline Linux-kernel nolibc setup does not support this. Therefore, add a "run-user" target that immediately executes the prebuilt executable. Again, this approach does have its limitations. For example, the executable runs with the user's privilege level, which can cause some false-positive failures due to insufficient permissions. In addition, if the underlying kernel is old enough to lack some features that nolibc relies on, the result will be false-positive failures in the corresponding tests. However, for nolibc changes not affected by these limittions, the result is a much faster code-compile-test-debug cycle. With this patch, running a userland test is as simple as issuing: make ARCH=xxx CROSS_COMPILE=xxx run-user Signed-off-by: Willy Tarreau <w@1wt.eu> Tested-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
f9b06695 |
|
21-Jan-2023 |
Willy Tarreau <w@1wt.eu> |
selftests/nolibc: Support "x86_64" for arch name Building the kernel with ARCH=x86_64 works fine, but nolibc-test only supports "x86", which causes errors when reusing existing build environment. Let's permit this environment to be used as well by making nolibc also accept ARCH=x86_64. Signed-off-by: Willy Tarreau <w@1wt.eu> Tested-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
0043e6f2 |
|
09-Jan-2023 |
Sven Schnelle <svens@linux.ibm.com> |
selftests/nolibc: add s390 support Signed-off-by: Sven Schnelle <svens@linux.ibm.com> Acked-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
4a95be7e |
|
25-Oct-2022 |
Willy Tarreau <w@1wt.eu> |
selftests/nolibc: Always rebuild the sysroot when running a test Paul and I got trapped a few times by not seeing the effects of applying a patch to the nolibc source code until a "make clean" was issued in the nolibc directory. It's particularly annoying when trying to confirm that a proposed patch really solves a problem (or that reverting it reintroduces the problem). The reason for the sysroot not being rebuilt was that it can be quite slow. But in fact it's only slow after a "make clean" issued at the kernel's topdir, because it's the main "make headers" that can take a tens of seconds; as long as "usr/include" still contains headers, the "headers_install" phase is only a quick "rsync", and rebuilding the whole nolibc sysroot takes a bit less than one second, which is perfectly acceptable for a test, even more once the time lost caused by misleading results is factored in. This patch marks the sysroot target as phony and starts by clearing the previous sysroot for the current architecture before reinstalling it. Thanks to this, applying a patch to nolibc makes the effect immediately visible to "make nolibc-test": $ time make -j -C tools/testing/selftests/nolibc nolibc-test make: Entering directory '/k/tools/testing/selftests/nolibc' MKDIR sysroot/x86/include make[1]: Entering directory '/k/tools/include/nolibc' make[2]: Entering directory '/k' make[2]: Leaving directory '/k' make[2]: Entering directory '/k' INSTALL /k/tools/testing/selftests/nolibc/sysroot/sysroot/include make[2]: Leaving directory '/k' make[1]: Leaving directory '/k/tools/include/nolibc' CC nolibc-test make: Leaving directory '/k/tools/testing/selftests/nolibc' real 0m0.869s user 0m0.716s sys 0m0.149s Cc: "Paul E. McKenney" <paulmck@kernel.org> Link: https://lore.kernel.org/all/20221021155645.GK5600@paulmck-ThinkPad-P17-Gen-1/ Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
ffc297fe |
|
19-Jul-2022 |
Willy Tarreau <w@1wt.eu> |
selftests/nolibc: add a "help" target It presents the supported targets, and becomes the default target to save the user from having to read the makefile. The "all" target was placed after it and now points to "run" to do everything since it's no longer the default one. Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
b25c5284 |
|
19-Jul-2022 |
Willy Tarreau <w@1wt.eu> |
selftests/nolibc: "sysroot" target installs a local copy of the sysroot It's not convenient to rely on a sysroot built in another directory, especially when running cross-compilation tests, where one has to switch back and forth between directories. Let's make it possible to install the sysroot directly in the test directory. It's not big and even benefits from being copied by arch so that it's easier to switch between archs if needed. The new "sysroot" target does this, it just calls "headers_standalone" from nolibc to install the sysroot right here. Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
662ea60e |
|
19-Jul-2022 |
Willy Tarreau <w@1wt.eu> |
selftests/nolibc: add a "run" target to start the kernel in QEMU The "run" target will build the kernel and start it in QEMU. The "rerun" target will not have the kernel dependency and will just try to start QEMU. The QEMU architecture used to start the kernel is derived from the configured ARCH. This might need to be improved for archs which include different variants under the same name (mips vs mipsel, +/-64, riscv32 vs riscv64). This could be tested for i386, x86, arm, arm64, mips and riscv (the later two reporting issues on some tests). It is possible to pass a test specification for nolibc-test in the TEST variable, which will be passed as-is as NOLIBC_TEST. On success, the number of successful tests is printed. On failure, failed lines are individually printed. Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
5c43fd79 |
|
19-Jul-2022 |
Willy Tarreau <w@1wt.eu> |
selftests/nolibc: add a "defconfig" target While most archs will work fine with "make defconfig", not all will do, and it's not always easy to remember the most suitable choice to use for a specific architecture. This adds a "defconfig" target to the Makefile so that one may easily run "make -C ... defconfig" and make sure to clean and rebuild a fresh config. This is *not* used by default because we want to preserve the user's config by default. Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
d248cabf |
|
19-Jul-2022 |
Willy Tarreau <w@1wt.eu> |
selftests/nolibc: add a "kernel" target to build the kernel with the initramfs The "kernel" target rebuilds the kernel with the current config for the selected arch, with an initramfs containing the nolibc-test utility. Since image names depend on the architecture, the currently supported ones are referenced and resolved based on the architecture. Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|
#
362aecb2 |
|
19-Jul-2022 |
Willy Tarreau <w@1wt.eu> |
selftests/nolibc: add basic infrastructure to ease creation of nolibc tests This creates a "nolibc" selftest that intends to test various parts of the nolibc component, both in terms of build and execution for a given architecture. The aim is for it to be as simple to run as a kernel build, by just passing the compiler (for the build) and the ARCH (for kernel and execution). It brings a basic squeleton made of a single C file that will ease testing and error reporting. The code will be arranged so that it remains easy to add basic tests for syscalls or library calls that may rely on a condition to be executed, and whose result is compared to a value or to an error with a specific errno value. Tests will just use a relative line number in switch/case statements as an index, saving the user from having to maintain arrays and complicated functions which can often just be one-liners. MAINTAINERS was updated. Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
|