[LTP] [PATCH 1/3] lib: Print tested kernel and arch
Petr Vorel
pvorel@suse.cz
Fri Jul 26 11:55:44 CEST 2024
This helps reviewing tests posted on ML or github issue
(reporters sometimes don't include this info).
Using interesting parts from struct utsname to get used linux
distribution, kernel version, release and architecture (less info than
when running 'uname -a', but other info is not much useful).
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
lib/tst_test.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/tst_test.c b/lib/tst_test.c
index e5bc5bf4da..63221c5e9d 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -13,6 +13,7 @@
#include <errno.h>
#include <sys/mount.h>
#include <sys/types.h>
+#include <sys/utsname.h>
#include <sys/wait.h>
#include <math.h>
@@ -1793,6 +1794,7 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
{
int ret = 0;
unsigned int test_variants = 1;
+ struct utsname uval;
lib_pid = getpid();
tst_test = self;
@@ -1805,6 +1807,10 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
tst_res(TINFO, "LTP version: "LTP_VERSION);
+
+ uname(&uval);
+ tst_res(TINFO, "Tested kernel: %s %s %s", uval.release, uval.version, uval.machine);
+
if (tst_test->max_runtime)
results->max_runtime = multiply_runtime(tst_test->max_runtime);
--
2.45.2
More information about the ltp
mailing list