Ltp linux kernel testcases build and running support#3336
Closed
extinguish wants to merge 5 commits intoapache:masterfrom
Closed
Ltp linux kernel testcases build and running support#3336extinguish wants to merge 5 commits intoapache:masterfrom
extinguish wants to merge 5 commits intoapache:masterfrom
Conversation
xiaoxiang781216
previously approved these changes
Jan 16, 2026
11ac9a7 to
8d854f3
Compare
Major enhancements to LTP build system: - Split CMakeLists.txt into shared/posix/kernel sections with unified blacklisting - Add header stubs (linux/*.h, asm/*.h, lapi/*.h) for kernel test dependencies - Implement syscalls.h generation via regen.sh for NuttX syscall mapping - Define feature macros (HAVE_*, UNIT_TEST) and compiler flags for kernel tests - Resolve naming conflicts (safe_* functions) with macro renaming This enables LTP kernel test execution on NuttX, covering syscalls, filesystem, device drivers, and scheduler tests. Signed-off-by: guoshichao <guoshichao@xiaomi.com>
Define the complete loop_info structure and LOOP_* ioctl command constants in testing/ltp/include/linux/loop.h, matching Linux kernel's loop device interface. This allows LTP loop device testcases to build and execute when NuttX loop device support (CONFIG_DEV_LOOP) is available. Signed-off-by: guoshichao <guoshichao@xiaomi.com>
For the NuttX platform, the system call numbers themselves are independent of the architecture(arm/x86/risc-v). Therefore, there is no need to consider the differences between different architectures(arm/x86/risc-v). As a result, we can directly maintain them manually instead of relying on the regen.sh script to generate them dynamically. This makes it easier for maintenance, upgrading, and modification. Signed-off-by: guoshichao <guoshichao@xiaomi.com>
for kernel testcases that using main() method to execute, when invoke tst_exit() on execute finished, will report " executed from newlib!" error, this is caused by two kinds kernel testcases are forbidded linked together, in Linux this is OK, but for NuttX, this is necssary, so we choose to modify the NO_NEWLIB_ASSERT macro's implementation, thus to make kernel testcases can work in NuttX Signed-off-by: guoshichao <guoshichao@xiaomi.com>
blacklist nftw64 to resolve symbol duplication errors, the following are the detailed link error info: ``` /usr/bin/ld: /home/testing/vela/cmake_out/vela_vela/apps/testing/ltp/libapps_ltp_syscalls_nftw_nftw64.a(nftw64.c.o):(.bss.__odr_asan.next_fd+0x0): multiple definition of `__odr_asan.next_fd'; /home/testing/vela/cmake_out/vela_vela/apps/testing/ltp/libapps_ltp_syscalls_nftw_nftw.a(nftw.c.o):(.bss.__odr_asan.next_fd+0x0): first defined here /usr/bin/ld: /home/testing/vela/cmake_out/vela_vela/apps/testing/ltp/libapps_ltp_syscalls_nftw_nftw64.a(nftw64.c.o):(.bss.__odr_asan.visit+0x0): multiple definition of `__odr_asan.visit'; /home/testing/vela/cmake_out/vela_vela/apps/testing/ltp/libapps_ltp_syscalls_nftw_nftw.a(nftw.c.o):(.bss.__odr_asan.visit+0x0): first defined here /usr/bin/ld: /home/testing/vela/cmake_out/vela_vela/apps/testing/ltp/libapps_ltp_syscalls_nftw_nftw64.a(nftw64.c.o):(.bss.__odr_asan.dirlist+0x0): multiple definition of `__odr_asan.dirlist'; /home/testing/vela/cmake_out/vela_vela/apps/testing/ltp/libapps_ltp_syscalls_nftw_nftw.a(nftw.c.o):(.bss.__odr_asan.dirlist+0x0): first defined here /usr/bin/ld: /home/testing/vela/cmake_out/vela_vela/apps/testing/ltp/libapps_ltp_syscalls_nftw_nftw64.a(nftw64.c.o):(.bss.__odr_asan.ebuf+0x0): multiple definition of `__odr_asan.ebuf'; /home/testing/vela/cmake_out/vela_vela/apps/testing/ltp/libapps_ltp_syscalls_nftw_nftw.a(nftw.c.o):(.bss.__odr_asan.ebuf+0x0): first defined here /usr/bin/ld: /home/testing/vela/cmake_out/vela_vela/apps/testing/ltp/libapps_ltp_syscalls_nftw_nftw64.a(nftw64.c.o):(.bss.__odr_asan.s2+0x0): multiple definition of `__odr_asan.s2'; /home/testing/vela/cmake_out/vela_vela/apps/testing/ltp/libapps_ltp_syscalls_nftw_nftw.a(nftw.c.o):(.bss.__odr_asan.s2+0x0): first defined here /usr/bin/ld: /home/testing/vela/cmake_out/vela_vela/apps/testing/ltp/libapps_ltp_syscalls_nftw_nftw64.a(nftw64.c.o):(.bss.__odr_asan.temp+0x0): multiple definition of `__odr_asan.temp'; /home/testing/vela/cmake_out/vela_vela/apps/testing/ltp/libapps_ltp_syscalls_nftw_nftw.a(nftw.c.o):(.bss.__odr_asan.temp+0x0): first defined here ``` Signed-off-by: guoshichao <guoshichao@xiaomi.com>
8d854f3 to
c8175c8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extend LTP (Linux Test Project) support on NuttX to enable compilation and execution of Linux kernel testcases, adding necessary infrastructure for kernel‑level API validation:
struct loop_infoandLOOP_* ioctlconstants intesting/ltp/include/linux/loop.h, allowing LTP loop‑device testcases to build and run whenCONFIG_DEV_LOOP=y.CMakeinfrastructure with proper header stubs,syscall mapping, and feature configuration to support kernel‑level test execution.Impact
Testing