tst_test: Add option parsing helpers.
Add two helpers for parsing integers and floats, these are intended to
be used in the test setup to parse options from struct tst_option.
static char *str_threads;
static int threads;
...
static struct tst_option options[] = {
{"t:", &str_threads, "Number of threads"},
...
{NULL, NULL, NULL}
};
static void setup(void)
{
if (tst_parse_int(str_threads, &threads, 1, INT_MAX))
tst_brk(TBROK, "Invalid number of threads '%s'", str_threads);
...
}
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
3 files changed