All of lore.kernel.org
 help / color / mirror / Atom feed
* libtraceevent: bail out of utest if mmap fails
@ 2026-05-05 20:22 Emil Thorsoe
  2026-05-06 13:27 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Emil Thorsoe @ 2026-05-05 20:22 UTC (permalink / raw)
  To: linux-trace-devel

Just like, when failing to open the BTF file, failing to
mmap the BTF is testing the test environment, not the code.

This mmap fails with ENODEV on i686 nix build on nixos-unstable.

Just bail out without failing the test, when mmap fails.

Signed-off-by: Emil Thorsoe <ethorsoe@tuxera.com>
---
 utest/traceevent-utest.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/utest/traceevent-utest.c b/utest/traceevent-utest.c
index b62411c..df98fa1 100644
--- a/utest/traceevent-utest.c
+++ b/utest/traceevent-utest.c
@@ -397,8 +397,11 @@ static void test_btf_read(void)
 	CU_TEST(fstat(fd, &st) == 0);
 
 	buf = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
-	CU_TEST(buf != MAP_FAILED);
-
+	if (buf == MAP_FAILED) {
+		printf("[KERNEL DOES NOT ALLOW MMAP OF BTF FILE] ...");
+		close(fd);
+		return;
+	}
 	CU_TEST(tep_load_btf(test_tep, buf, st.st_size) == 0);
 
 	munmap(buf, st.st_size);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-06 13:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 20:22 libtraceevent: bail out of utest if mmap fails Emil Thorsoe
2026-05-06 13:27 ` Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.