Skip to content

Commit 8efb32c

Browse files
higuoxingKernel Patches Daemon
authored andcommitted
selftests: arg_parsing: Ensure data is flushed to disk before reading.
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 <[email protected]>
1 parent 06bf66d commit 8efb32c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ static void test_parse_test_list_file(void)
140140
fprintf(fp, "testA/subtest2\n");
141141
fprintf(fp, "testC_no_eof_newline");
142142
fflush(fp);
143+
fsync(fd);
143144

144145
if (!ASSERT_OK(ferror(fp), "prepare tmp"))
145146
goto out_fclose;

0 commit comments

Comments
 (0)