diff mbox series

[3/3] fdatasync03: add [Description] tag and cleanup code

Message ID 20240126040139.2534873-3-ruansy.fnst@fujitsu.com
State New
Headers show
Series [1/3] fdatasync01: Convert to new API | expand

Commit Message

Shiyang Ruan Jan. 26, 2024, 4:01 a.m. UTC
Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
---
 testcases/kernel/syscalls/fdatasync/fdatasync03.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Cyril Hrubis March 13, 2024, 4:14 p.m. UTC | #1
Hi!
> +/*\
> + * [Description]
>   *
>   * It basically tests fdatasync() to sync test file data having large dirty
>   * file pages to block device. Also, it tests all supported filesystems on a
> @@ -37,10 +37,7 @@ static void verify_fdatasync(void)
>  
>  	tst_fill_fd(fd, 0, TST_MB, FILE_SIZE_MB);
>  
> -	TEST(fdatasync(fd));
> -
> -	if (TST_RET)
> -		tst_brk(TFAIL | TTERRNO, "fdatasync(fd) failed");
> +	TST_EXP_PASS_SILENT(fdatasync(fd));

There is a subtle difference the TST_EXP_PASS_SILENT() does not exit the
function as the tst_brk() does, so this should be:

	TST_EXP_PASS_SILENT(fdatasync(fd));

	if (!TST_PASS)
		return;

So that we do not continue with the test if the fdatasync() failed.

>  	written = tst_dev_bytes_written(tst_device->dev);
>  
> -- 
> 2.34.1
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/fdatasync/fdatasync03.c b/testcases/kernel/syscalls/fdatasync/fdatasync03.c
index 5f3e0c96f..257e413d0 100644
--- a/testcases/kernel/syscalls/fdatasync/fdatasync03.c
+++ b/testcases/kernel/syscalls/fdatasync/fdatasync03.c
@@ -4,8 +4,8 @@ 
  * Author: Sumit Garg <sumit.garg@linaro.org>
  */
 
-/*
- * fdatasync03
+/*\
+ * [Description]
  *
  * It basically tests fdatasync() to sync test file data having large dirty
  * file pages to block device. Also, it tests all supported filesystems on a
@@ -37,10 +37,7 @@  static void verify_fdatasync(void)
 
 	tst_fill_fd(fd, 0, TST_MB, FILE_SIZE_MB);
 
-	TEST(fdatasync(fd));
-
-	if (TST_RET)
-		tst_brk(TFAIL | TTERRNO, "fdatasync(fd) failed");
+	TST_EXP_PASS_SILENT(fdatasync(fd));
 
 	written = tst_dev_bytes_written(tst_device->dev);