tests/kcmp: add more checks

Let's check all kcmp commands that they indeed do not print idx1/idx2.
Also, check that upper bits of pid arguments are ignored.

* tests/gen_tests.in (kcmp): Decrease -a argument's value from 27 to 22.
* tests/kcmp.c: Add checks for upper bits of pid1/pid2 and for all
kcmp types not tested before.
This commit is contained in:
Eugene Syromyatnikov 2017-09-16 02:59:10 +02:00 committed by Dmitry V. Levin
parent 9acc241775
commit 8cddc598da
2 changed files with 15 additions and 3 deletions

View File

@ -143,7 +143,7 @@ ipc -a19
ipc_msg +ipc.sh
ipc_sem +ipc.sh
ipc_shm +ipc.sh
kcmp -a27
kcmp -a22
kexec_file_load -s9
kexec_load -s9
keyctl -a31 -s10

View File

@ -47,6 +47,11 @@
# include <linux/kcmp.h>
# else
# define KCMP_FILE 0
# define KCMP_VM 1
# define KCMP_FILES 2
# define KCMP_FS 3
# define KCMP_SIGHAND 4
# define KCMP_IO 5
# define KCMP_SYSVSEM 6
# endif
@ -93,12 +98,19 @@ main(void)
/* Invalid values */
do_kcmp(bogus_pid1, bogus_pid2, bogus_type, NULL, bogus_idx1,
bogus_idx2);
do_kcmp(0, 0, KCMP_SYSVSEM + 1, NULL, 0, 0);
do_kcmp(F8ILL_KULONG_MASK, F8ILL_KULONG_MASK, KCMP_SYSVSEM + 1, NULL,
0, 0);
/* KCMP_FILE is the only type which has additional args */
do_kcmp(3141592653U, 2718281828U, ARG_STR(KCMP_FILE), bogus_idx1,
bogus_idx2);
/* Some type without additional args */
/* Types without additional args */
do_kcmp(-1, -1, ARG_STR(KCMP_VM), bogus_idx1, bogus_idx2);
do_kcmp(-1, -1, ARG_STR(KCMP_FILES), bogus_idx1, bogus_idx2);
do_kcmp(-1, -1, ARG_STR(KCMP_FS), bogus_idx1, bogus_idx2);
do_kcmp(-1, -1, ARG_STR(KCMP_SIGHAND), bogus_idx1, bogus_idx2);
do_kcmp(-1, -1, ARG_STR(KCMP_IO), bogus_idx1, bogus_idx2);
do_kcmp(-1, -1, ARG_STR(KCMP_SYSVSEM), bogus_idx1, bogus_idx2);
puts("+++ exited with 0 +++");