Skip to content
Snippets Groups Projects
Commit abc58d88 authored by Richard Palethorpe's avatar Richard Palethorpe
Browse files

lib: Cache kernel_bits value


This is primarily to avoid printing the uname info two or more
times. Which is increasingly likely with using tst_kernel_bits in
other library functions. Also with features like test variants where
setup may be run multiple times.

Signed-off-by: default avatarRichard Palethorpe <rpalethorpe@suse.com>
Reviewed-by: default avatarCyril Hrubis <chrubis@suse.cz>
parent 94f867a5
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +37,12 @@ static int get_kernel_bits_from_uname(struct utsname *buf)
int tst_kernel_bits(void)
{
struct utsname buf;
int kernel_bits = get_kernel_bits_from_uname(&buf);
static int kernel_bits;
if (kernel_bits)
return kernel_bits;
kernel_bits = get_kernel_bits_from_uname(&buf);
if (kernel_bits == -1)
return -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment