aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/net/tcp_ao/lib/kconfig.c
diff options
context:
space:
mode:
authorDmitry Safonov <0x7f454c46@gmail.com>2024-08-23 23:04:52 +0100
committerJakub Kicinski <kuba@kernel.org>2024-08-27 14:11:27 -0700
commit7053e788ded5f8ec589e4507d764d6a894780d6c (patch)
tree27615d6409f1f1b681d7d725b6e2cd142df0f759 /tools/testing/selftests/net/tcp_ao/lib/kconfig.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 <0x7f454c46@gmail.com> Link: https://patch.msgid.link/20240823-tcp-ao-selftests-upd-6-12-v4-2-05623636fe8c@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing/selftests/net/tcp_ao/lib/kconfig.c')
0 files changed, 0 insertions, 0 deletions