From: Masatake YAMATO Date: Wed, 8 Mar 2023 12:51:08 +0000 (+0900) Subject: tests: (mkfds) provide the way to declare the number of extra printing values X-Git-Tag: v2.40-rc1~458^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=26406d1a72e2df26ef66b56c0e373f45b7d7a279;p=thirdparty%2Futil-linux.git tests: (mkfds) provide the way to declare the number of extra printing values Signed-off-by: Masatake YAMATO --- diff --git a/tests/helpers/test_mkfds.c b/tests/helpers/test_mkfds.c index 4cae1e06db..2aad1dacf6 100644 --- a/tests/helpers/test_mkfds.c +++ b/tests/helpers/test_mkfds.c @@ -312,9 +312,10 @@ struct factory { #define MAX_N 5 int N; /* the number of fds this factory makes */ int EX_N; /* fds made optionally */ + int EX_R; /* the number of extra words printed to stdout. */ void *(*make)(const struct factory *, struct fdesc[], int, char **); void (*free)(const struct factory *, void *); - void (*report)(const struct factory *, void *, FILE *); + void (*report)(const struct factory *, int, void *, FILE *); const struct parameter * params; }; @@ -2465,17 +2466,18 @@ static int count_parameters(const struct factory *factory) static void print_factory(const struct factory *factory) { - printf("%-20s %4s %5d %6d %s\n", + printf("%-20s %4s %5d %7d %6d %s\n", factory->name, factory->priv? "yes": "no", factory->N, + factory->EX_R + 1, count_parameters(factory), factory->desc); } static void list_factories(void) { - printf("%-20s PRIV COUNT NPARAM DESCRIPTION\n", "FACTORY"); + printf("%-20s PRIV COUNT NRETURN NPARAM DESCRIPTION\n", "FACTORY"); for (size_t i = 0; i < ARRAY_SIZE(factories); i++) print_factory(factories + i); } @@ -2646,9 +2648,12 @@ int main(int argc, char **argv) if (!quiet) { printf("%d", getpid()); if (factory->report) { - putchar(' '); - factory->report(factory, data, stdout); + for (int i = 0; i < factory->EX_R; i++) { + putchar(' '); + factory->report(factory, i, data, stdout); + } } + putchar('\n'); fflush(stdout); }