[LTP] [PATCH v3 2/2] sigpending/rt_sigpending: add basic test

Petr Vorel pvorel@suse.cz
Tue Mar 19 18:24:54 CET 2019


Hi Matthias,

> +	for (int i = 1; i < SIGMAX; ++i)
Please define i before.
Old distros using old C standards (probably -std=gnu89) by default, which breaks
build [1]:

gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition -D_FORTIFY_SOURCE=2 -DTEST_RT_SIGPENDING -I../../../../include -I../../../../include -I../../../../include/old/   -L../../../../lib  /usr/src/ltp/testcases/kernel/syscalls/rt_sigpending/../sigpending/sigpending02.c   -lltp -o rt_sigpending02
/usr/src/ltp/testcases/kernel/syscalls/rt_sigpending/../sigpending/sigpending02.c: In function 'test_sigpending':
/usr/src/ltp/testcases/kernel/syscalls/rt_sigpending/../sigpending/sigpending02.c:67:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
  for (int i = 1; i < SIGMAX; ++i)
  ^
/usr/src/ltp/testcases/kernel/syscalls/rt_sigpending/../sigpending/sigpending02.c:67:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
/usr/src/ltp/testcases/kernel/syscalls/rt_sigpending/../sigpending/sigpending02.c:82:11: error: redefinition of 'i'

...
> +	/* now we should have exactly one pending signal (SIGUSR1) */
> +	sigemptyset(&pending);
> +	tested_sigpending(&pending);
> +	for (int i = 1; i < SIGMAX; ++i)
> +		if ((i == SIGUSR1) != sigismember(&pending, i))
> +			tst_brk(TFAIL, "only SIGUSR1 should be pending by now");


Kind regards,
Petr

[1] https://api.travis-ci.org/v3/job/508433905/log.txt


More information about the ltp mailing list