[LTP] [PATCH V2] syscall/kcmp: Add tests for kcmp
Cyril Hrubis
chrubis@suse.cz
Mon Oct 12 18:15:21 CEST 2015
Hi!
Pushed with a few changes (explained below), thanks.
> +#if !defined(HAVE_ENUM_KCMP_TYPE)
> +
> +enum kcmp_type {
> + KCMP_FILE,
> + KCMP_VM,
> + KCMP_FILES,
> + KCMP_FS,
> + KCMP_SIGHAND,
> + KCMP_IO,
> + KCMP_SYSVSEM,
> + KCMP_TYPES,
> +};
> +
> +#endif
> +
> +#if !defined(HAVE_KCMP)
> +
> +int kcmp(int pid1, int pid2, int type, int fd1, int fd2)
> +{
> + return ltp_syscall(__NR_kcmp, pid1, pid2, type, fd1, fd2);
> +}
> +
> +#else
> +
> +#include <linux/kcmp.h>
> +
> +#endif
This was wrong #if to add the #else to, the kcmp.h defines the enum not
the syscall. I've fixed that.
> +static struct test_case {
> + int *pid1;
> + int *pid2;
> + int type;
> + int *fd1;
> + int *fd2;
> + int exp_different;
> +} test_cases[] = {
> + {&pid1, &pid2, KCMP_FILE, &fd1, &fd2, 0},
> + {&pid1, &pid2, KCMP_FILE, &fd1, &fd3, 1},
> +};
I've added a few more tests here. Case where pid1 == pid2, fd1 == fd2
and both at the same time.
> + if (test->exp_errno && TEST_RETURN != -1) {
> + tst_resm(TFAIL, "kcmp() succeeded unexpectedly");
> + return;
> + }
> +
And I've removed the test->exp_errno from this condition, since we test
only failures in this test.
--
Cyril Hrubis
chrubis@suse.cz
More information about the Ltp
mailing list