Skip to content

selftests/bpf: Improve libc portability / musl support (part 2)

Tony Ambardar bpf linux-kselftest netdev 2 versions – Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest8 patches 0 repliesApplied 8/8
  2. v18 patches 10 repliesSuperseded

Changelog from the cover letter

----------

Patches in v2 All 8 applied

#Subject and filesSizeRepliesApplied
1/8selftests/bpf: Use portable POSIX basename()tools/testing/selftests/bpf/veristat.c tools/testing/selftests/bpf/xskxceiver.c+6 -30 repliesApplied
2/8selftests/bpf: Fix arg parsing in veristat, test_progstools/testing/selftests/bpf/testing_helpers.c tools/testing/selftests/bpf/veristat.c+6 -60 repliesApplied
3/8selftests/bpf: Fix error compiling test_lru_map.ctools/testing/selftests/bpf/test_lru_map.c+2 -10 repliesApplied
4/8selftests/bpf: Fix C++ compile error from missing _Bool typetools/testing/selftests/bpf/test_cpp.cpp+4 -00 repliesApplied
5/8selftests/bpf: Fix redefinition errors compiling lwt_reroute.ctools/testing/selftests/bpf/prog_tests/lwt_reroute.c+1 -00 repliesApplied
6/8selftests/bpf: Fix compile if backtrace support missing in libctools/testing/selftests/bpf/test_progs.c+15 -10 repliesApplied
7/8selftests/bpf: Fix using stdout, stderr as struct field namestools/testing/selftests/bpf/prog_tests/reg_bounds.c tools/testing/selftests/bpf/test_progs.c tools/testing/selftests/bpf/test_progs.h+38 -380 repliesApplied
8/8selftests/bpf: Fix error compiling tc_redirect.c with musl libctools/testing/selftests/bpf/prog_tests/tc_redirect.c+6 -60 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH bpf-next v2 0/8] selftests/bpf: Improve libc portability / musl support (part 2)

Hello all,

This is part 2 of a series of fixes for libc-related issues encountered building for musl-based systems. The series has been tested with the kernel-patches/bpf CI and locally using mips64el-gcc/musl-libc and QEMU with an OpenWrt rootfs.

The patches cover a few areas of portability issues:

- problematic libc usage (strtok_r(), stdio macros/reserved identifiers)
- gcc compile errors (include header ordering, sequence-point errors)
- POSIX vs GNU basename()
- missing GNU extensions (<execinfo.h>, C++ <stdbool.h>)
- Y2038 and setsockopt() / SO_TIMESTAMPNS_NEW

Feedback and suggestions are appreciated!

Thanks,
Tony

Changelog:
----------

v1->v2: (feedback from Andrii)
- P2: rewrite simpler code using counter
- P5: update description/fix after more research
- P6: use weak functions for backtrace stubs
- P7: use stdxxx_saved names, update desc

Tony Ambardar (8):
selftests/bpf: Use portable POSIX basename() selftests/bpf: Fix arg parsing in veristat, test_progs selftests/bpf: Fix error compiling test_lru_map.c selftests/bpf: Fix C++ compile error from missing _Bool type selftests/bpf: Fix redefinition errors compiling lwt_reroute.c selftests/bpf: Fix compile if backtrace support missing in libc selftests/bpf: Fix using stdout, stderr as struct field names selftests/bpf: Fix error compiling tc_redirect.c with musl libc

 .../selftests/bpf/prog_tests/lwt_reroute.c    |  1 +
 .../selftests/bpf/prog_tests/reg_bounds.c     |  2 +-
 .../selftests/bpf/prog_tests/tc_redirect.c    | 12 +--
 tools/testing/selftests/bpf/test_cpp.cpp      |  4 +
 tools/testing/selftests/bpf/test_lru_map.c    |  3 +-
 tools/testing/selftests/bpf/test_progs.c      | 82 +++++++++++--------
 tools/testing/selftests/bpf/test_progs.h      |  8 +-
 tools/testing/selftests/bpf/testing_helpers.c |  4 +-
 tools/testing/selftests/bpf/veristat.c        | 16 ++--
 tools/testing/selftests/bpf/xskxceiver.c      |  1 +
 10 files changed, 78 insertions(+), 55 deletions(-)
Signature · 1 line
2.34.1