Re: [PATCH 1/2] libtraceevent utest: Handle short reads when reading BTF
Steven Rostedt <[email protected]> Mon, 1 Jun 2026 10:11:48 -0400
| Newsgroups | org.kernel.vger.linux-trace-devel |
|---|---|
| Message-ID | <20260601101148.24e445e5@fedora> |
On Mon, 1 Jun 2026 18:37:49 +0800 Cao Ruichuang <[email protected]> wrote: > @@ -532,7 +557,13 @@ static void test_btf_read(void) > close(fd); > return; > } > - CU_TEST(read(fd, buf, st.st_size) == st.st_size); > + ret = read_full(fd, buf, st.st_size); > + CU_TEST(ret == 0); Nit, can you change this to: CU_TEST((ret = read_full(fd, buf, st.st_size)) == 0); so that if it fails, it doesn't just report "ret == 0" in the failure. I'm working to make the CU_TEST() more informative on failures. Thanks, -- Steve > + if (ret < 0) { > + free(buf); > + close(fd); > + return; > + } > }