Skip to content

selftests/nolibc: allow run with minimal kernel config

Zhangjin Wu linux-kselftest lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest18 patches 6 repliesIn review
  2. v314 patches 3 repliesSuperseded
  3. v215 patches 6 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v117 patches9 repliesSuperseded

Changes in v4 from the cover letter

* selftests/nolibc: stat_fault: silence NULL argument warning with glibc selftests/nolibc: gettid: restore for glibc and musl selftests/nolibc: add _LARGEFILE64_SOURCE for musl selftests/nolibc: fix up int_fast16/32_t test cases for musl selftests/nolibc: fix up kernel parameters support selftests/nolibc: link_cross: use /proc/self/cmdline tools/nolibc: add rmdir() support
selftests/nolibc: add a new rmdir() test case selftests/nolibc: fix up failures when CONFIG_PROC_FS=n selftests/nolibc: prepare /tmp for tmpfs or ramfs selftests/nolibc: vfprintf: remove MEMFD_CREATE dependency

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/18selftests/nolibc: add run-libc-test targettools/testing/selftests/nolibc/Makefile+4 -00 replies
2/18selftests/nolibc: stat_fault: silence NULL argument warning with glibctools/testing/selftests/nolibc/nolibc-test.c+1 -10 replies
3/18selftests/nolibc: gettid: restore for glibc and musltools/testing/selftests/nolibc/nolibc-test.c+7 -30 replies
4/18selftests/nolibc: add _LARGEFILE64_SOURCE for musltools/testing/selftests/nolibc/nolibc-test.c+1 -00 replies
5/18selftests/nolibc: fix up int_fast16/32_t test cases for musltools/testing/selftests/nolibc/nolibc-test.c+8 -40 replies
6/18tools/nolibc: types.h: add RB_ flags for reboot()tools/include/nolibc/sys.h tools/include/nolibc/types.h+11 -20 replies
7/18selftests/nolibc: prefer <sys/reboot.h> to <linux/reboot.h>tools/testing/selftests/nolibc/nolibc-test.c+1 -20 replies
8/18selftests/nolibc: fix up kernel parameters supporttools/testing/selftests/nolibc/nolibc-test.c+31 -20 replies
9/18selftests/nolibc: link_cross: use /proc/self/cmdlinetools/testing/selftests/nolibc/nolibc-test.c+1 -10 replies
10/18tools/nolibc: add rmdir() supporttools/include/nolibc/sys.h+22 -00 replies
11/18selftests/nolibc: add a new rmdir() test casetools/testing/selftests/nolibc/nolibc-test.c+1 -00 replies
12/18selftests/nolibc: fix up failures when CONFIG_PROC_FS=ntools/testing/selftests/nolibc/nolibc-test.c+5 -20 replies
13/18selftests/nolibc: prepare /tmp for tmpfs or ramfstools/testing/selftests/nolibc/nolibc-test.c+4 -04 replies
14/18selftests/nolibc: vfprintf: remove MEMFD_CREATE dependencytools/testing/selftests/nolibc/nolibc-test.c+3 -30 replies
15/18selftests/nolibc: chdir_root: restore current path after testtools/testing/selftests/nolibc/nolibc-test.c+1 -10 replies
16/18selftests/nolibc: stat_timestamps: remove procfs dependencytools/testing/selftests/nolibc/nolibc-test.c+1 -10 replies
17/18selftests/nolibc: chroot_exe: remove procfs dependencytools/testing/selftests/nolibc/nolibc-test.c+1 -10 replies
18/18selftests/nolibc: add chmod_argv0 testtools/testing/selftests/nolibc/nolibc-test.c+1 -00 replies

Reviews trailers per patch

13 of 18 patches have a Reviewed-by or Acked-by.

PatchThomas Weißschuh
1/18
2/18R-b
3/18R-b
4/18R-b
5/18R-b
6/18
7/18
8/18R-b
9/18R-b
10/18R-b
11/18R-b
12/18R-b
13/18R-b R-b
14/18R-b
15/18
16/18R-b
17/18
18/18R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 00/18] selftests/nolibc: allow run with minimal kernel config

Hi, Willy

This v4 mainly uses the argv0 suggested by you, at the same time, a new run-libc-test target is added for glibc and musl, and the RB_ flags are added for nolibc to allow compile nolibc-test.c without <linux/reboot.h> for glibc, musl and nolibc (mainly for musl-gcc, without -I /path/to/sysroot).

This patchset is based on the 20230705-nolibc-series2 branch of nolibc repo [2], it must be applied after our v6 __sysret series [3] (argv0 exported there) and Thomas' chmod_net removal patchset [4] (the new chmod_argv0 is added at the same line of chmod_net, will conflict).

This patchset assumes the chmod_net removal patchset will be applied at first, if not, the chmod_argv0 added alphabetically will not be applied. Since our new chmod_argv0 is exactly added to replace chmod_net, so, Willy, is it ok for you to at least apply the chmod_net removal patch
[5] before this patchset?

selftests/nolibc: drop test chmod_net

This patchset is tested together with the v6 __sysret series [3]:

               arch/board | result
              ------------|------------
          arm/vexpress-a9 | 142 test(s) passed, 1 skipped, 0 failed.
                 arm/virt | 142 test(s) passed, 1 skipped, 0 failed.
             aarch64/virt | 142 test(s) passed, 1 skipped, 0 failed.
              ppc/g3beige | not supported
              ppc/ppce500 | not supported
                  i386/pc | 142 test(s) passed, 1 skipped, 0 failed.
                x86_64/pc | 142 test(s) passed, 1 skipped, 0 failed.
             mipsel/malta | 142 test(s) passed, 1 skipped, 0 failed.
         loongarch64/virt | 142 test(s) passed, 1 skipped, 0 failed.
             riscv64/virt | 142 test(s) passed, 1 skipped, 0 failed.
             riscv32/virt | 0 test(s) passed, 0 skipped, 0 failed.
    s390x/s390-ccw-virtio | 142 test(s) passed, 1 skipped, 0 failed.

If use tinyconfig + basic console options (means disable all of the other options, include procfs, shmem, tmpfs, net and memfd_create, to save test time, only randomly choose 4 archs):

...

LOG: testing report for loongarch64/virt:

15 chmod_self [SKIPPED]
16 chown_self [SKIPPED]
40 link_cross [SKIPPED]
0 -fstackprotector not supported [SKIPPED]

139 test(s) passed, 4 skipped, 0 failed.
See all results in /labs/linux-lab/logging/nolibc/loongarch64-virt-nolibc-test.log

LOG: testing summary:

arch/board | result
------------|------------
arm/vexpress-a9 | 139 test(s) passed, 4 skipped, 0 failed.
x86_64/pc | 139 test(s) passed, 4 skipped, 0 failed.
mipsel/malta | 139 test(s) passed, 4 skipped, 0 failed.
loongarch64/virt | 139 test(s) passed, 4 skipped, 0 failed.

Changes from v3 --> v4:

* selftests/nolibc: stat_fault: silence NULL argument warning with glibc selftests/nolibc: gettid: restore for glibc and musl selftests/nolibc: add _LARGEFILE64_SOURCE for musl selftests/nolibc: fix up int_fast16/32_t test cases for musl selftests/nolibc: fix up kernel parameters support selftests/nolibc: link_cross: use /proc/self/cmdline tools/nolibc: add rmdir() support
selftests/nolibc: add a new rmdir() test case selftests/nolibc: fix up failures when CONFIG_PROC_FS=n selftests/nolibc: prepare /tmp for tmpfs or ramfs selftests/nolibc: vfprintf: remove MEMFD_CREATE dependency

No change.

* selftests/nolibc: add run-libc-test target

New run and report for glibc or musl. for musl, we can simply issue:

$ make run-libc-test CC=/path/to/musl-install/bin/musl-gcc

* tools/nolibc: types.h: add RB_ flags for reboot() selftests/nolibc: prefer <sys/reboot.h> to <linux/reboot.h>

Required by musl to compile nolibc-test.c without -I/path/to/sysroot

* selftests/nolibc: chdir_root: restore current path after test

restore current path to prevent breakage of using relative path

* selftests/nolibc: stat_timestamps: remove procfs dependency selftests/nolibc: chroot_exe: remove procfs dependency selftests/nolibc: add chmod_argv0 test

use argv0 instead of '/init' as before.

Best regards,
Zhangjin
---
[1]: https://lore.kernel.org/lkml/[email protected]/
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/nolibc.git
[3]: https://lore.kernel.org/lkml/[email protected]/
[4]: https://lore.kernel.org/lkml/[email protected]/
[5]: https://lore.kernel.org/lkml/[email protected]/

Zhangjin Wu (18):
selftests/nolibc: add run-libc-test target selftests/nolibc: stat_fault: silence NULL argument warning with glibc selftests/nolibc: gettid: restore for glibc and musl selftests/nolibc: add _LARGEFILE64_SOURCE for musl selftests/nolibc: fix up int_fast16/32_t test cases for musl tools/nolibc: types.h: add RB_ flags for reboot() selftests/nolibc: prefer <sys/reboot.h> to <linux/reboot.h> selftests/nolibc: fix up kernel parameters support selftests/nolibc: link_cross: use /proc/self/cmdline tools/nolibc: add rmdir() support
selftests/nolibc: add a new rmdir() test case selftests/nolibc: fix up failures when CONFIG_PROC_FS=n selftests/nolibc: prepare /tmp for tmpfs or ramfs selftests/nolibc: vfprintf: remove MEMFD_CREATE dependency selftests/nolibc: chdir_root: restore current path after test selftests/nolibc: stat_timestamps: remove procfs dependency selftests/nolibc: chroot_exe: remove procfs dependency selftests/nolibc: add chmod_argv0 test

 tools/include/nolibc/sys.h                   | 23 ++++-
 tools/include/nolibc/types.h                 | 12 ++-
 tools/testing/selftests/nolibc/Makefile      |  4 +
 tools/testing/selftests/nolibc/nolibc-test.c | 88 +++++++++++++++-----
 4 files changed, 104 insertions(+), 23 deletions(-)
Signature · 1 line
2.25.1