aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/test_prog_array_init.c
diff options
context:
space:
mode:
authorDmitry Safonov <[email protected]>2024-08-23 23:04:52 +0100
committerJakub Kicinski <[email protected]>2024-08-27 14:11:27 -0700
commit7053e788ded5f8ec589e4507d764d6a894780d6c (patch)
tree27615d6409f1f1b681d7d725b6e2cd142df0f759 /tools/testing/selftests/bpf/progs/test_prog_array_init.c
parent79504a47339cd9a1574d974869aecaba838e1213 (diff)
selftests/net: Provide test_snprintf() helper
Instead of pre-allocating a fixed-sized buffer of TEST_MSG_BUFFER_SIZE and printing into it, call vsnprintf() with str = NULL, which will return the needed size of the buffer. This hack is documented in man 3 vsnprintf. Essentially, in C++ terms, it re-invents std::stringstream, which is going to be used to print different tracing paths and formatted strings. Use it straight away in __test_print() - which is thread-safe version of printing in selftests. Signed-off-by: Dmitry Safonov <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_prog_array_init.c')
0 files changed, 0 insertions, 0 deletions