linux-test-project / ltp

Linux Test Project (mailing list: https://lists.linux.it/listinfo/ltp)
https://linux-test-project.readthedocs.io/
GNU General Public License v2.0
2.27k stars 1k forks source link

Make warning happen in getcwd01.c #1120

Closed coolgw closed 5 months ago

coolgw commented 5 months ago

Current latest LTP versin show following error, suspect triggered by following commit.

commit 1cfe6142898204890e61429a66bd782cfcf8c23c Author: Cyril Hrubis chrubis@suse.cz Date: Wed Jan 3 12:57:00 2024 +0100

lib: TST_EXP_FAIL: Add array variants

/home/ltp/testcases/kernel/syscalls/getcwd # make clean;make rm -f -f -r getcwd01 getcwd02 getcwd03 getcwd04 .o .pyc .cache.mk .dwo ..dwo make -C "/home/ltp/lib" -f "/home/ltp/lib/Makefile" all make[1]: Entering directory '/home/ltp/lib' GEN ltp-version.h CC lib/tst_test.o CC lib/tst_test_macros.o AR libltp.a RANLIB libltp.a make[2]: Nothing to be done for 'all'. CC lib/newlib_tests/test_macros02 make[1]: Leaving directory '/home/ltp/lib' In file included from ../../../../include/tst_test.h:21:0, from getcwd01.c:26: getcwd01.c: In function ‘verify_getcwd’: getcwd01.c:48:72: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=] TST_EXP_FAIL2(tst_syscall(__NR_getcwd, tc->buf, tc->size), tc->exp_err); ^ ../../../../include/tst_test_macros.h:42:32: note: in definition of macro ‘TSTFMT

define TSTFMT(FMT, _1, ...) FMT, ##__VA_ARGS__

                            ^~~

../../../../include/tst_test_macros.h:46:12: note: in expansion of macro ‘TST2’ TSTFMT(TST2(dummy, ##VA_ARGS, SCALL) FMT, VA_ARGS)) ^~ ../../../../include/tst_test_macros.h:209:4: note: in expansion of macro ‘TSTMSG’ TSTMSG(TFAIL, " succeeded", SSCALL, ##VA_ARGS__); \ ^~~~ ../../../../include/tst_test_macros.h:251:3: note: in expansion of macro ‘TST_EXP_FAILSILENT’ TST_EXP_FAILSILENT(TST_RET >= 0, SCALL, #SCALL, \ ^~~~~~~~ ../../../../include/tst_test_macros.h:264:3: note: in expansion of macro ‘TST_EXP_FAIL2ARR’ TST_EXP_FAIL2ARR(SCALL, &tst_exp_err, 1, \ ^~~~~~ getcwd01.c:48:2: note: in expansion of macro ‘TST_EXP_FAIL2’ TST_EXP_FAIL2(tst_syscall(__NR_getcwd, tc->buf, tc->size), tc->exp_err); ^~~~~ getcwd01.c:48:72: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘long int’ [-Wformat=] TST_EXP_FAIL2(tst_syscall(__NR_getcwd, tc->buf, tc->size), tc->exp_err); ^ ../../../../include/tst_test_macros.h:42:32: note: in definition of macro ‘TSTFMT

define TSTFMT(FMT, _1, ...) FMT, ##__VA_ARGS__

                            ^~~

../../../../include/tst_test_macros.h:50:12: note: in expansion of macro ‘TST2’ TSTFMT(TST2(dummy, ##VA_ARGS, SCALL) FMT, VA_ARGS), PAR) ^~ ../../../../include/tst_test_macros.h:214:4: note: in expansion of macro ‘TSTMSGP’ TSTMSGP(TFAIL | TTERRNO, " invalid retval %ld", \ ^~~~~ ../../../../include/tst_test_macros.h:251:3: note: in expansion of macro ‘TST_EXP_FAILSILENT’ TST_EXP_FAILSILENT(TST_RET >= 0, SCALL, #SCALL, \ ^~~~~~~~ ../../../../include/tst_test_macros.h:264:3: note: in expansion of macro ‘TST_EXP_FAIL2ARR’ TST_EXP_FAIL2ARR(SCALL, &tst_exp_err, 1, \ ^~~~~~ getcwd01.c:48:2: note: in expansion of macro ‘TST_EXP_FAIL2’ TST_EXP_FAIL2(tst_syscall(__NR_getcwd, tc->buf, tc->size), tc->exp_err); ^~~~~ getcwd01.c:48:72: warning: format ‘%ld’ expects a matching ‘long int’ argument [-Wformat=] TST_EXP_FAIL2(tst_syscall(NR_getcwd, tc->buf, tc->size), tc->exp_err); ^ ../../../../include/tst_test_macros.h:42:32: note: in definition of macro ‘TSTFMT

define TSTFMT(FMT, _1, ...) FMT, ##__VA_ARGS__

                            ^~~

../../../../include/tst_test_macros.h:50:12: note: in expansion of macro ‘TST2’ TSTFMT(TST2(dummy, ##VA_ARGS, SCALL) FMT, VA_ARGS), PAR) ^~ ../../../../include/tst_test_macros.h:214:4: note: in expansion of macro ‘TSTMSGP’ TSTMSGP(TFAIL | TTERRNO, " invalid retval %ld", \ ^~~~~ ../../../../include/tst_test_macros.h:251:3: note: in expansion of macro ‘TST_EXP_FAILSILENT’ TST_EXP_FAILSILENT(TST_RET >= 0, SCALL, #SCALL, \ ^~~~~~~~ ../../../../include/tst_test_macros.h:264:3: note: in expansion of macro ‘TST_EXP_FAIL2ARR’ TST_EXP_FAIL2ARR(SCALL, &tst_exp_err, 1, \ ^~~~~~ getcwd01.c:48:2: note: in expansion of macro ‘TST_EXP_FAIL2’ TST_EXP_FAIL2(tst_syscall(__NR_getcwd, tc->buf, tc->size), tc->exp_err); ^~~~~ getcwd01.c:48:72: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘const char *’ [-Wformat=] TST_EXP_FAIL2(tst_syscall(NR_getcwd, tc->buf, tc->size), tc->exp_err); ^ ../../../../include/tst_test_macros.h:42:32: note: in definition of macro ‘TSTFMT

define TSTFMT(FMT, _1, ...) FMT, ##__VA_ARGS__

                            ^~~

../../../../include/tst_test_macros.h:50:12: note: in expansion of macro ‘TST2’ TSTFMT(TST2(dummy, ##VA_ARGS, SCALL) FMT, VA_ARGS), PAR) ^~ ../../../../include/tst_test_macros.h:223:4: note: in expansion of macro ‘TSTMSGP’ TSTMSGP(TFAIL | TTERRNO, " expected %s", \ ^~~~~ ../../../../include/tst_test_macros.h:251:3: note: in expansion of macro ‘TST_EXP_FAILSILENT’ TST_EXP_FAILSILENT(TST_RET >= 0, SCALL, #SCALL, \ ^~~~~~~~ ../../../../include/tst_test_macros.h:264:3: note: in expansion of macro ‘TST_EXP_FAIL2ARR’ TST_EXP_FAIL2ARR(SCALL, &tst_exp_err, 1, \ ^~~~~~ getcwd01.c:48:2: note: in expansion of macro ‘TST_EXP_FAIL2’ TST_EXP_FAIL2(tst_syscall(__NR_getcwd, tc->buf, tc->size), tc->exp_err); ^~~~~ getcwd01.c:48:72: warning: format ‘%s’ expects a matching ‘char *’ argument [-Wformat=] TST_EXP_FAIL2(tst_syscall(NR_getcwd, tc->buf, tc->size), tc->exp_err); ^ ../../../../include/tst_test_macros.h:42:32: note: in definition of macro ‘TSTFMT

define TSTFMT(FMT, _1, ...) FMT, ##__VA_ARGS__

                            ^~~

../../../../include/tst_test_macros.h:50:12: note: in expansion of macro ‘TST2’ TSTFMT(TST2(dummy, ##VA_ARGS, SCALL) FMT, VA_ARGS), PAR) ^~ ../../../../include/tst_test_macros.h:223:4: note: in expansion of macro ‘TSTMSGP’ TSTMSGP(TFAIL | TTERRNO, " expected %s", \ ^~~~~ ../../../../include/tst_test_macros.h:251:3: note: in expansion of macro ‘TST_EXP_FAILSILENT’ TST_EXP_FAILSILENT(TST_RET >= 0, SCALL, #SCALL, \ ^~~~~~~~ ../../../../include/tst_test_macros.h:264:3: note: in expansion of macro ‘TST_EXP_FAIL2ARR’ TST_EXP_FAIL2ARR(SCALL, &tst_exp_err, 1, \ ^~~~~~ getcwd01.c:48:2: note: in expansion of macro ‘TST_EXP_FAIL2’ TST_EXP_FAIL2(tst_syscall(__NR_getcwd, tc->buf, tc->size), tc->exp_err); ^~~~~ getcwd01.c:48:72: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=] TST_EXP_FAIL2(tst_syscall(NR_getcwd, tc->buf, tc->size), tc->exp_err); ^ ../../../../include/tst_test_macros.h:42:32: note: in definition of macro ‘TSTFMT

define TSTFMT(FMT, _1, ...) FMT, ##__VA_ARGS__

                            ^~~

../../../../include/tst_test_macros.h:46:12: note: in expansion of macro ‘TST2’ TSTFMT(TST2(dummy, ##VA_ARGS, SCALL) FMT, VA_ARGS)) ^~ ../../../../include/tst_test_macros.h:254:4: note: in expansion of macro ‘TSTMSG’ TSTMSG(TPASS | TTERRNO, " ", #SCALL, ##VA_ARGS); \ ^~~~ ../../../../include/tst_test_macros.h:264:3: note: in expansion of macro ‘TST_EXP_FAIL2ARR’ TST_EXP_FAIL2ARR(SCALL, &tst_exp_err, 1, \ ^~~~~~ getcwd01.c:48:2: note: in expansion of macro ‘TST_EXP_FAIL2’ TST_EXP_FAIL2(tst_syscall(NR_getcwd, tc->buf, tc->size), tc->exp_err); ^~~~~ CC testcases/kernel/syscalls/getcwd/getcwd01 CC testcases/kernel/syscalls/getcwd/getcwd02 CC testcases/kernel/syscalls/getcwd/getcwd03 CC testcases/kernel/syscalls/getcwd/getcwd04

metan-ucw commented 5 months ago

Ah, right, the SCALL argument has to be stringified in the first pass otherwise it will expand. Will send a fix right away.