Skip to content

Commit 1c031d9

Browse files
higuoxingKernel Patches Daemon
authored andcommitted
selftests: arg_parsing: Ensure data is flushed to disk before reading.
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.
1 parent 631bcf6 commit 1c031d9

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
ASSERT_OK(parse_test_list_file(tmpfile, &set, true), "parse file");

0 commit comments

Comments
 (0)