[LTP] [PATCH 1/7] io_cancel02: Add io_cancel02 test for libaio
Cyril Hrubis
chrubis@suse.cz
Mon Jun 21 10:42:31 CEST 2021
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
More information about the ltp
mailing list