Skip to content

Commit 2a87a1c

Browse files
higuoxinggregkh
authored andcommitted
selftests: arg_parsing: Ensure data is flushed to disk before reading.
[ Upstream commit 0c1999e ] 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. Fixes: 64276f0 ("selftests/bpf: Test_progs can read test lists from file") Signed-off-by: Xing Guo <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent 095d692 commit 2a87a1c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tools/testing/selftests/bpf/prog_tests/arg_parsing.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ static void test_parse_test_list_file(void)
144144
if (!ASSERT_OK(ferror(fp), "prepare tmp"))
145145
goto out_fclose;
146146

147+
if (!ASSERT_OK(fsync(fileno(fp)), "fsync tmp"))
148+
goto out_fclose;
149+
147150
init_test_filter_set(&set);
148151

149152
if (!ASSERT_OK(parse_test_list_file(tmpfile, &set, true), "parse file"))

0 commit comments

Comments
 (0)