Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH] selftests: arg_parsing: Ensure data is flushed to disk before reading.
@ 2025-10-14  8:03 Xing Guo
  2025-10-14 12:39 ` Jiri Olsa
  0 siblings, 1 reply; 19+ messages in thread
From: Xing Guo @ 2025-10-14  8:03 UTC (permalink / raw)
  To: bpf; +Cc: linux-kselftest, ast, sveiss, andrii, Xing Guo

Recently, I noticed a selftest failure in my local environment. The
test_parse_test_list_file writes some data to
/tmp/bpf_arg_parsing_test.XXXXXX and parse_test_list_file() will read
the data back.  However, after writing data to that file, we forget to
call fsync() and it's causing testing failure in my laptop.  This patch
helps fix it by adding the missing fsync() call.

Signed-off-by: Xing Guo <higuoxing@gmail.com>
---
 tools/testing/selftests/bpf/prog_tests/arg_parsing.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/bpf/prog_tests/arg_parsing.c b/tools/testing/selftests/bpf/prog_tests/arg_parsing.c
index bb143de68875..4f071943ffb0 100644
--- a/tools/testing/selftests/bpf/prog_tests/arg_parsing.c
+++ b/tools/testing/selftests/bpf/prog_tests/arg_parsing.c
@@ -140,6 +140,7 @@ static void test_parse_test_list_file(void)
 	fprintf(fp, "testA/subtest2\n");
 	fprintf(fp, "testC_no_eof_newline");
 	fflush(fp);
+	fsync(fd);
 
 	if (!ASSERT_OK(ferror(fp), "prepare tmp"))
 		goto out_fclose;
-- 
2.51.0


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

end of thread, other threads:[~2025-10-21 22:15 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-14  8:03 [PATCH] selftests: arg_parsing: Ensure data is flushed to disk before reading Xing Guo
2025-10-14 12:39 ` Jiri Olsa
2025-10-14 20:53   ` Andrii Nakryiko
2025-10-15  2:43     ` [PATCH v2] " Xing Guo
2025-10-15  2:45       ` Alexei Starovoitov
2025-10-15  2:50         ` Xing Guo
2025-10-15 16:10           ` patchwork-bot+netdevbpf
2025-10-15 16:20           ` Andrii Nakryiko
2025-10-16  2:28             ` [PATCH v3] " Xing Guo
2025-10-16  2:32             ` [PATCH v2] " Xing Guo
2025-10-16  2:37             ` [PATCH bpf v4] " Xing Guo
2025-10-16  3:19             ` [PATCH bpf v5] " Xing Guo
2025-10-16  3:53             ` [PATCH bpf v6] " Xing Guo
2025-10-16 16:36               ` Andrii Nakryiko
2025-10-20  8:59                 ` strace log before the fix, with fsync fix and with fclose fix Xing Guo
2025-10-20 16:28                   ` Alexei Starovoitov
2025-10-20 20:12                     ` Andrii Nakryiko
2025-10-21 22:14                       ` Dominique Martinet
2025-10-16 16:40               ` [PATCH bpf v6] selftests: arg_parsing: Ensure data is flushed to disk before reading patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox