[LTP] [PATCH v2 3/3] writev01: rewrite and drop partially valid iovec tests
Cyril Hrubis
chrubis@suse.cz
Tue Oct 11 10:41:29 CEST 2016
Hi!
> How about:
>
> static void test_writev(unsigned int i)
> {
> struct testcase_t *tcase = &testcases[i];
> int ret;
>
> TEST(writev(*(tcase->pfd), *(tcase->piovec), tcase->iovcnt));
>
> ret = (TEST_RETURN == tcase->exp_ret);
> if (TEST_RETURN < 0 || tcase->exp_ret < 0) {
> ret &= (TEST_ERRNO == tcase->exp_errno);
> tst_res((ret ? TPASS : TFAIL),
> "%s, expected: %d (%s), got: %ld (%s)", tcase->desc,
> tcase->exp_ret, tst_strerrno(tcase->exp_errno),
> TEST_RETURN, tst_strerrno(TEST_ERRNO));
> } else {
> tst_res((ret ? TPASS : TFAIL),
> "%s, expected: %d, got: %ld", tcase->desc,
> tcase->exp_ret, TEST_RETURN);
> }
> }
Looks good.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list