From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: Richard Palethorpe <rpalethorpe@suse.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 1/3] lib/tests: Add test for testing tst_res() flags
Date: Wed, 13 Dec 2023 20:04:11 +0100 [thread overview]
Message-ID: <ZXoAKxPxfXxU8bxw@rei> (raw)
In-Reply-To: <20231211161807.526714-2-pvorel@suse.cz>
Hi!
> +#define FLAG(x) .flag = x, .str = #x
> +static struct tcase {
> + int flag;
> + const char *str;
> +} tcases[] = {
> + {FLAG(TPASS)},
> + {FLAG(TFAIL)},
> + {FLAG(TBROK)},
> + {FLAG(TCONF)},
> + {FLAG(TWARN)},
> + {FLAG(TINFO)},
> +};
> +
> +static void do_cleanup(void)
> +{
> + tst_brk(TBROK, "TBROK message should be TWARN in cleanup");
> +}
> +
> +static void do_test(unsigned int n)
> +{
> + int flag = tcases[n].flag;
> + const char *str = tcases[n].str;
> +
> + tst_res(flag, "%s message", str);
> +
> + if (flag == TWARN || flag == TINFO)
> + tst_res(TPASS, "%s message is not a result", str);
Maybe it would make sense the loop over the flags here instead, so that
we don't have to produce second TPASS message.
> +}
> +
> +static struct tst_test test = {
> + .test = do_test,
> + .tcnt = ARRAY_SIZE(tcases),
> + .cleanup = do_cleanup,
> +};
> --
> 2.43.0
>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-12-13 19:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-11 16:18 [LTP] [PATCH v3 0/3] Add TDEBUG tst_res() flag Petr Vorel
2023-12-11 16:18 ` [LTP] [PATCH v3 1/3] lib/tests: Add test for testing tst_res() flags Petr Vorel
2023-12-13 19:04 ` Cyril Hrubis [this message]
2023-12-13 23:40 ` Petr Vorel
2023-12-14 9:09 ` Cyril Hrubis
2023-12-14 12:19 ` Petr Vorel
2023-12-14 12:26 ` Petr Vorel
2023-12-11 16:18 ` [LTP] [PATCH v3 2/3] lib: Add support for TDEBUG tst_res() flag Petr Vorel
2023-12-13 19:15 ` Cyril Hrubis
2023-12-13 23:11 ` Petr Vorel
2023-12-14 9:41 ` Cyril Hrubis
2023-12-14 12:08 ` Petr Vorel
2023-12-13 23:48 ` Petr Vorel
2023-12-14 9:39 ` Cyril Hrubis
2023-12-11 16:18 ` [LTP] [PATCH v3 3/3] fsx-linux: Reduce log output with TDEBUG Petr Vorel
2023-12-12 10:08 ` Andrea Cervesato via ltp
2023-12-13 19:18 ` Cyril Hrubis
2023-12-11 16:27 ` [LTP] [PATCH v3 0/3] Add TDEBUG tst_res() flag Jan Stancek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZXoAKxPxfXxU8bxw@rei \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
--cc=rpalethorpe@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.