[LTP] [PATCH 1/7] io_cancel02: Add io_cancel02 test for libaio

Cyril Hrubis
2021-06-21T08:42:31Z

Hi!
> +#include "config.h"
> +#include "tst_test.h"
> +
> +#ifdef HAVE_LIBAIO
> +#define EXP_RET (-EFAULT)
> +
> +#include <libaio.h>
> +
> +static void run(void)
> +{
> + io_context_t ctx;
> +
> + memset(&ctx, 0, sizeof(ctx));
> + TEST(io_cancel(ctx, NULL, NULL));
> +
> + if (TST_RET == 0)
> + tst_res(TFAIL, "call succeeded unexpectedly");
> + else if (TST_RET == EXP_RET)
> + tst_res(TPASS, "io_cancel(ctx, NULL, NULL) returns %ld : %s",
> + TST_RET, strerror(-TST_RET));
> + else
> + tst_res(TFAIL, "io_cancel(ctx, NULL, NULL) returns %ld : %s, expected %d : %s",
> + TST_RET, strerror(-TST_RET), EXP_RET, strerror(-EXP_RET));

Please use TST_EXP_FAIL() instead.

> +}
> +
> +static struct tst_test test = {
> + .needs_kconfigs = (const char *[]) {
> + "CONFIG_AIO=y",
> + NULL
> + },
> + .test_all = run,
> +};
> +
> +#else
> +TST_TEST_TCONF("test requires libaio and it's development packages");
> +#endif
> --
> 2.17.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp

--
Cyril Hrubis
chrubis@suse.cz