[dm-devel] [PATCH v2 17/17] tests: make directio tests able to work on a real device

Martin Wilck mwilck at suse.com
Mon Feb 10 17:27:24 UTC 2020


On Wed, 2020-02-05 at 12:58 -0600, Benjamin Marzinski wrote:
> There is now a file in tests called directio_test_dev. If the
> commented
> out test device line is uncommented and set to a device, it can be
> used
> to test the directio checker on that device, instead of faking the
> device.
> 
> Signed-off-by: Benjamin Marzinski <bmarzins at redhat.com>
> ---
>  tests/Makefile          |  16 +++++-
>  tests/directio.c        | 114
> ++++++++++++++++++++++++++++++++++++++--
>  tests/directio_test_dev |   4 ++
>  3 files changed, 130 insertions(+), 4 deletions(-)
>  create mode 100644 tests/directio_test_dev
> 
> @@ -359,6 +427,11 @@ static void test_check_state_timeout(void
> **state)
>  	will_return(__wrap_io_cancel, 0);
>  	do_check_state(&c, 1, 30, PATH_DOWN);
>  	check_aio_grp(aio_grp, 1, 0);
> +#ifdef DIO_TEST_DEV
> +	/* io_cancel will return negative value on timeout, so it
> happens again
> +	 * when freeing the checker */
> +	will_return(__wrap_io_cancel, 0);
> +#endif

I found this a bit confusing after the "will_return(__wrap_io_cancel,
0)" above. (The reader needs to realize that with DIO_TEST_DEV,
__wrap_io_cancel() discards the value passed by will_return()).

But that's just a nit.

Acked-by: Martin Wilck <mwilck at suse.com>






More information about the dm-devel mailing list