From: Masatake YAMATO Date: Fri, 13 Dec 2024 17:28:50 +0000 (+0900) Subject: tests: (test_sysinfo) add a helper to call xgethostname X-Git-Tag: v2.42-start~111^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b0098ad2305d10379188cc66d32e52155bea00f4;p=thirdparty%2Futil-linux.git tests: (test_sysinfo) add a helper to call xgethostname Signed-off-by: Masatake YAMATO --- diff --git a/tests/helpers/test_sysinfo.c b/tests/helpers/test_sysinfo.c index ad423068b..b900a1547 100644 --- a/tests/helpers/test_sysinfo.c +++ b/tests/helpers/test_sysinfo.c @@ -43,6 +43,8 @@ # endif #endif +#include "xalloc.h" + typedef struct { const char *name; int (*fnc)(void); @@ -168,6 +170,13 @@ static int hlp_get_userns_ok(void) return 0; } +static int hlp_hostname(void) +{ + char * h = xgethostname(); + printf("%s\n", h); + return 0; +} + static const mntHlpfnc hlps[] = { { "WORDSIZE", hlp_wordsize }, @@ -185,6 +194,7 @@ static const mntHlpfnc hlps[] = { "sz(time_t)", hlp_sz_time }, { "ns-gettype-ok", hlp_get_nstype_ok }, { "ns-getuserns-ok", hlp_get_userns_ok }, + { "hostname", hlp_hostname, }, { NULL, NULL } };