From bf4e683ad4ef10afea93d8258c88d227385a5baa Mon Sep 17 00:00:00 2001 From: "Duncan.chu" Date: Fri, 7 Jul 2023 17:17:58 +0800 Subject: [PATCH] diotest: Fix the repeated log printing problem Fix the problem of repeated printing logs when the dio module specifies the output log file. This is a typical buffer problem. In the diotest6/diotes3 third step will fork lots of process. If the cache subprocess is not cleaned up, the cache generated in the previous step will be copied, and then when each process exits, a large number of repeated prints will be generated. Signed-off-by: Duncan.chu Reviewed-by: Cyril Hrubis --- testcases/kernel/io/direct_io/diotest3.c | 2 ++ testcases/kernel/io/direct_io/diotest6.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/testcases/kernel/io/direct_io/diotest3.c b/testcases/kernel/io/direct_io/diotest3.c index 92f7afaad69..ba2fd0473bc 100644 --- a/testcases/kernel/io/direct_io/diotest3.c +++ b/testcases/kernel/io/direct_io/diotest3.c @@ -292,6 +292,7 @@ int main(int argc, char *argv[]) } unlink(filename); free(pidlst); + fflush(stdout); total++; /* Testblock-2: Write with Direct IO, Read without */ @@ -309,6 +310,7 @@ int main(int argc, char *argv[]) } unlink(filename); free(pidlst); + fflush(stdout); total++; /* Testblock-3: Read, Write with Direct IO. */ diff --git a/testcases/kernel/io/direct_io/diotest6.c b/testcases/kernel/io/direct_io/diotest6.c index 1905380f01d..fb925ff0af1 100644 --- a/testcases/kernel/io/direct_io/diotest6.c +++ b/testcases/kernel/io/direct_io/diotest6.c @@ -320,6 +320,7 @@ int main(int argc, char *argv[]) } unlink(filename); free(pidlst); + fflush(stdout); total++; /* Testblock-2: Write with Direct IO, Read without */ @@ -337,6 +338,7 @@ int main(int argc, char *argv[]) } unlink(filename); free(pidlst); + fflush(stdout); total++; /* Testblock-3: Read, Write with Direct IO. */