]> granicus.if.org Git - strace/commitdiff
tests/kcmp: add more checks
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sat, 16 Sep 2017 00:59:10 +0000 (02:59 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 17 Sep 2017 12:04:11 +0000 (12:04 +0000)
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.

tests/gen_tests.in
tests/kcmp.c

index 50e62a02c366a9452f65a748ec0aca3c259279bd..9f398e03510009364d82f6b91032e90417d8833e 100644 (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
index e3425cdfaf6888c6da61a10192c6671f4ca0c277..46bb173c55b5c3ff061f97853866aae98ff130eb 100644 (file)
 #  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 +++");