[LTP] [PATCH 5/8] shell: Add tst_clear_device

Petr Vorel pvorel@suse.cz
Wed Jun 1 12:37:12 CEST 2022


Hi all,

> --- /dev/null
> +++ b/testcases/lib/tst_clear_device.c
...
> +int main(int argc, char *argv[])
> +{
> +	/*
> +	 * Force messages to be printed from the new library i.e. tst_test.c
> +	 *
> +	 * The new library prints messages into stderr while the old one prints
> +	 * them into stdout. When messages are printed into stderr we can
> +	 * safely do:
> +	 *
> +	 * DEV=$(tst_device acquire)
> +	 */
> +	tst_test = &test;
I guess this whole workaround is not needed for binary being used only in new
shell API (note for myself in case we decided to introduce new binary wrapper).

Kind regards,
Petr

> +	struct stat st;
> +
> +	if (argc < 2)
> +		goto help;
> +
> +	if (stat(argv[1], &st) < 0 || !S_ISBLK(st.st_mode))
> +		goto help;
> +
> +	return tst_clear_device(argv[1]);
> +help:
> +	print_help();
> +	return 1;
> +}


More information about the ltp mailing list