[RFC PATCH v2 06/12] Do not use PIDs larger than INT_MAX in tests

Ákos Uzonyi uzonyi.akos at gmail.com
Fri Jun 12 18:24:00 UTC 2020


tests/bpf.c (BPF_TASK_FD_QUERY_checks): Use smaller PIDs.
tests/ioctl_block.c (main): Likewise.
---
 tests/bpf.c         | 8 ++++----
 tests/ioctl_block.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/bpf.c b/tests/bpf.c
index 0b426d8a..c83854cb 100644
--- a/tests/bpf.c
+++ b/tests/bpf.c
@@ -1289,16 +1289,16 @@ static const struct bpf_attr_check BPF_BTF_GET_FD_BY_ID_checks[] = {
 
 static const struct bpf_attr_check BPF_TASK_FD_QUERY_checks[] = {
 	{
-		.data = { .BPF_TASK_FD_QUERY_data = { .pid = 0xdeadbeef } },
+		.data = { .BPF_TASK_FD_QUERY_data = { .pid = 1735928559 } },
 		.size = offsetofend(struct BPF_TASK_FD_QUERY_struct, pid),
-		.str = "task_fd_query={pid=3735928559, fd=0" FD0_PATH
+		.str = "task_fd_query={pid=1735928559, fd=0" FD0_PATH
 		       ", flags=0, buf_len=0, buf=NULL, prog_id=0"
 		       ", fd_type=BPF_FD_TYPE_RAW_TRACEPOINT"
 		       ", probe_offset=0, probe_addr=0}"
 	},
 	{ /* 1 */
 		.data = { .BPF_TASK_FD_QUERY_data = {
-			.pid = 0xcafef00d,
+			.pid = 1405705229,
 			.fd = 0xdeadbeef,
 			.flags = 0xfacefeed,
 			.buf_len = 0xdefaced,
@@ -1309,7 +1309,7 @@ static const struct bpf_attr_check BPF_TASK_FD_QUERY_checks[] = {
 			.probe_addr = 0xfac5fed5fac7fed8
 		} },
 		.size = offsetofend(struct BPF_TASK_FD_QUERY_struct, probe_addr),
-		.str = "task_fd_query={pid=3405705229"
+		.str = "task_fd_query={pid=1405705229"
 		       ", fd=-559038737"
 		       ", flags=4207869677"
 		       ", buf_len=233811181"
diff --git a/tests/ioctl_block.c b/tests/ioctl_block.c
index 643daf87..67fee35c 100644
--- a/tests/ioctl_block.c
+++ b/tests/ioctl_block.c
@@ -165,7 +165,7 @@ main(void)
 
 	ioctl(-1, BLKTRACESETUP, buts);
 	printf("ioctl(-1, BLKTRACESETUP, {act_mask=%hu, buf_size=%u, buf_nr=%u"
-	       ", start_lba=%" PRI__u64 ", end_lba=%" PRI__u64 ", pid=%u})"
+	       ", start_lba=%" PRI__u64 ", end_lba=%" PRI__u64 ", pid=%d})"
 	       " = -1 EBADF (%m)\n",
 	       buts->act_mask, buts->buf_size, buts->buf_nr,
 	       buts->start_lba, buts->end_lba, buts->pid);
-- 
2.27.0



More information about the Strace-devel mailing list