On 03.06.25 20:27, Mark Brown wrote:
On Tue, Jun 03, 2025 at 02:37:41PM +0200, David Hildenbrand wrote:
On 27.05.25 18:04, Mark Brown wrote:
+static char test_name[1024];
+
+static inline void log_test_start(const char *name, ...)
+{
+ va_list args;
+ va_start(args, name);
+
+ vsnprintf(test_name, sizeof(test_name), name, args);
+ ksft_print_msg("[RUN] %s\n", test_name);
We could allocate the array in log_test_start() and free it in
log_test_result(). Then, we could assert more easily that we always have a
log_test_result() follow exactly one log_test_start() etc.
We could, however we don't have vasprintf() in nolibc and people have
been doing work towards making nolibc more generally useful as a libc
for the selftests (and/or the selftest interfaces more friendly to
nolibc). I don't really know what the end goal with that is but given
the fairly small gain and the hope that this won't be a long term
framework for anything I'd rather not add something that gets in the way
of whatever's going on there.
Ideally the test programs would be refactored and these helpers deleted,
but as we said previously that's a bigger job that neither of us is
likely to get to in the short term :(
Jup ...
--
Cheers,
David / dhildenb