@@ -242,9 +242,9 @@ const char *tst_errno_names(char *buf, const int *exp_errs, int exp_errs_cnt);
##__VA_ARGS__); \
} while (0)
-#define TST_EXP_FAIL_ARR(SCALL, EXP_ERRS, ...) \
+#define TST_EXP_FAIL_ARR(SCALL, EXP_ERRS, EXP_ERRS_CNT, ...) \
TST_EXP_FAIL_ARR_(SCALL, #SCALL, EXP_ERRS, \
- ARRAY_SIZE(EXP_ERRS), ##__VA_ARGS__);
+ EXP_ERRS_CNT, ##__VA_ARGS__);
#define TST_EXP_FAIL2_ARR_(SCALL, SSCALL, EXP_ERRS, EXP_ERRS_CNT, ...) \
do { \
@@ -254,9 +254,9 @@ const char *tst_errno_names(char *buf, const int *exp_errs, int exp_errs_cnt);
TST_MSG_(TPASS | TTERRNO, " ", SSCALL, ##__VA_ARGS__); \
} while (0)
-#define TST_EXP_FAIL2_ARR(SCALL, EXP_ERRS, ...) \
+#define TST_EXP_FAIL2_ARR(SCALL, EXP_ERRS, EXP_ERRS_CNT, ...) \
TST_EXP_FAIL2_ARR_(SCALL, #SCALL, EXP_ERRS, \
- ARRAY_SIZE(EXP_ERRS), ##__VA_ARGS__);
+ EXP_ERRS_CNT, ##__VA_ARGS__);
#define TST_EXP_FAIL2(SCALL, EXP_ERR, ...) \
do { \
@@ -39,9 +39,9 @@ static void do_test(void)
tst_res(TINFO, "TST_PASS = %i", TST_PASS);
TST_EXP_FAIL(inval_ret_fn(), ENOTTY, "inval_ret_fn()");
tst_res(TINFO, "TST_PASS = %i", TST_PASS);
- TST_EXP_FAIL_ARR(fail_fn(), exp_errs_pass, "fail_fn()");
+ TST_EXP_FAIL_ARR(fail_fn(), exp_errs_pass, ARRAY_SIZE(exp_errs_pass), "fail_fn()");
tst_res(TINFO, "TST_PASS = %i", TST_PASS);
- TST_EXP_FAIL_ARR(fail_fn(), exp_errs_fail, "fail_fn()");
+ TST_EXP_FAIL_ARR(fail_fn(), exp_errs_fail, ARRAY_SIZE(exp_errs_fail), "fail_fn()");
tst_res(TINFO, "TST_PASS = %i", TST_PASS);
tst_res(TINFO, "Testing TST_EXP_FAIL2 macro");
@@ -53,9 +53,9 @@ static void do_test(void)
tst_res(TINFO, "TST_PASS = %i", TST_PASS);
TST_EXP_FAIL2(inval_ret_fn(), ENOTTY, "inval_ret_fn()");
tst_res(TINFO, "TST_PASS = %i", TST_PASS);
- TST_EXP_FAIL2_ARR(fail_fn(), exp_errs_pass, "fail_fn()");
+ TST_EXP_FAIL2_ARR(fail_fn(), exp_errs_pass, ARRAY_SIZE(exp_errs_pass), "fail_fn()");
tst_res(TINFO, "TST_PASS = %i", TST_PASS);
- TST_EXP_FAIL2_ARR(fail_fn(), exp_errs_fail, "fail_fn()");
+ TST_EXP_FAIL2_ARR(fail_fn(), exp_errs_fail, ARRAY_SIZE(exp_errs_fail), "fail_fn()");
tst_res(TINFO, "TST_PASS = %i", TST_PASS);
}
@@ -61,7 +61,7 @@ static void test_invalid_fd(struct tst_fd *fd)
int exp_errnos[] = {EBADF, EINVAL, ESPIPE};
TST_EXP_FAIL_ARR(readahead(fd->fd, 0, getpagesize()), exp_errnos,
- "readahead() on %s", tst_fd_desc(fd));
+ ARRAY_SIZE(exp_errnos), "readahead() on %s", tst_fd_desc(fd));
}
static void test_readahead(void)
Although having to pass ARRAY_SIZE() of the expected errnos is not ideal, it gives more flexibility to the tests allowing to use just portion of the array (will be used in fanotify14 in the next commit). It looks to be better than keep introduce yet another functions. Suggested-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Petr Vorel <pvorel@suse.cz> --- include/tst_test_macros.h | 8 ++++---- lib/newlib_tests/test_macros02.c | 8 ++++---- testcases/kernel/syscalls/readahead/readahead01.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-)