* [LTP] [PATCH 1/3] fdatasync01: Convert to new API
@ 2024-01-26 4:01 Shiyang Ruan
2024-01-26 4:01 ` [LTP] [PATCH 2/3] fdatasync02: " Shiyang Ruan
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Shiyang Ruan @ 2024-01-26 4:01 UTC (permalink / raw)
To: ltp
Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
---
.../kernel/syscalls/fdatasync/fdatasync01.c | 164 +++---------------
1 file changed, 26 insertions(+), 138 deletions(-)
diff --git a/testcases/kernel/syscalls/fdatasync/fdatasync01.c b/testcases/kernel/syscalls/fdatasync/fdatasync01.c
index 24a91785c..ba4375b68 100644
--- a/testcases/kernel/syscalls/fdatasync/fdatasync01.c
+++ b/testcases/kernel/syscalls/fdatasync/fdatasync01.c
@@ -1,155 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ * Copyright (c) Linux Test Project, 2003-2024
*/
-/**********************************************************
- *
- * TEST IDENTIFIER : fdatasync01
- *
- * EXECUTED BY : Any user
- *
- * TEST TITLE : Basic test for fdatasync(2)
- *
- * TEST CASE TOTAL : 1
- *
- * AUTHOR : Madhu T L <madhu.tarikere@wipro.com>
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * DESCRIPTION
- * This is a Phase I test for the fdatasync(2) system call.
- * It is intended to provide a limited exposure of the system call.
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- * Create a temp directory and cd to it
- * Initialize filename and open it in write mode for each child process.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Issue FAIL message with errno.
- * Otherwise, Issue PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- * Remove temporary directory and all files in it.
- *
- * USAGE: <for command-line>
- * fdatasync01 [-c n] [-e] [-f] [-h] [-i n] [-I x] [-p] [-P x] [-t]
- * where, -c n : Run n copies concurrently.
- * -e : Turn on errno logging.
- * -f : Turn off functional testing
- * -h : Show help screen
- * -i n : Execute test n times.
- * -I x : Execute test for x seconds.
- * -p : Pause for SIGUSR1 before starting
- * -P x : Pause for x seconds between iterations.
- * -t : Turn on syscall timing.
+
+/*\
+ * [Description]
*
- ****************************************************************/
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include "test.h"
+ * Basic test for fdatasync(). Call fdatasync() on a fd and expect it to pass.
+ */
-static int fd;
-static char filename[30];
-static void setup(void);
-static void cleanup(void);
+#include "tst_test.h"
-char *TCID = "fdatasync01";
-int TST_TOTAL = 1;
+static int fd;
+static char pfilename[30];
-int main(int argc, char **argv)
+static void run(void)
{
- int lc;
-
- tst_parse_opts(argc, argv, NULL, NULL);
-
- setup();
-
- for (lc = 0; TEST_LOOPING(lc); lc++) {
-
- /* reset tst_count in case we are looping */
- tst_count = 0;
-
- /* Test the system call */
- TEST(fdatasync(fd));
-
- /* check return code */
- if (TEST_RETURN == -1) {
- tst_resm(TFAIL, "fdatasync() failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /* No Functional verification yet */
- tst_resm(TPASS, "fdatasync() successful");
- }
- }
-
- /* perform global cleanup and exit */
- cleanup();
-
- tst_exit();
-
+ TST_EXP_PASS(fdatasync(fd), "fdatasync(%d)", fd);
}
-/* setup() - performs all ONE TIME setup for this test */
-void setup(void)
+static void setup(void)
{
-
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified
- * TEST_PAUSE contains the code to fork the test with the -c option.
- */
- TEST_PAUSE;
-
- tst_tmpdir();
-
/* Initialize unique filename for each child process */
- if (sprintf(filename, "fdatasync_%d", getpid()) <= 0) {
- tst_brkm(TBROK, cleanup, "Failed to initialize filename");
- }
- if ((fd = open(filename, O_CREAT | O_WRONLY, 0777)) == -1) { //mode must be specified when O_CREATE is in the flag
- tst_brkm(TBROK, cleanup, "open() failed");
- }
- if ((write(fd, filename, strlen(filename) + 1)) == -1) {
- tst_brkm(TBROK, cleanup, "write() failed");
- }
+ sprintf(pfilename, "fdatasync_%d", getpid());
+
+ /* mode must be specified when O_CREATE is in the flag */
+ fd = SAFE_OPEN(pfilename, O_CREAT | O_WRONLY, 0777);
+ SAFE_WRITE(SAFE_WRITE_ALL, fd, pfilename, strlen(pfilename) + 1);
}
-/*
- * cleanup()
- * performs all ONE TIME cleanup for this test at
- * completion or premature exit
- */
-void cleanup(void)
+static void cleanup(void)
{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
close(fd);
-
- tst_rmdir();
-
}
+
+static struct tst_test test = {
+ .needs_tmpdir = 1,
+ .test_all = run,
+ .setup = setup,
+ .cleanup = cleanup,
+};
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH 2/3] fdatasync02: Convert to new API
2024-01-26 4:01 [LTP] [PATCH 1/3] fdatasync01: Convert to new API Shiyang Ruan
@ 2024-01-26 4:01 ` Shiyang Ruan
2024-03-13 16:08 ` Cyril Hrubis
2024-01-26 4:01 ` [LTP] [PATCH 3/3] fdatasync03: add [Description] tag and cleanup code Shiyang Ruan
2024-03-13 16:04 ` [LTP] [PATCH 1/3] fdatasync01: Convert to new API Cyril Hrubis
2 siblings, 1 reply; 6+ messages in thread
From: Shiyang Ruan @ 2024-01-26 4:01 UTC (permalink / raw)
To: ltp
Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
---
.../kernel/syscalls/fdatasync/fdatasync02.c | 207 +++---------------
1 file changed, 33 insertions(+), 174 deletions(-)
diff --git a/testcases/kernel/syscalls/fdatasync/fdatasync02.c b/testcases/kernel/syscalls/fdatasync/fdatasync02.c
index 9ce4fc7bb..89a815219 100644
--- a/testcases/kernel/syscalls/fdatasync/fdatasync02.c
+++ b/testcases/kernel/syscalls/fdatasync/fdatasync02.c
@@ -1,197 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ * Copyright (c) Linux Test Project, 2003-2024
*/
-/**********************************************************
- *
- * TEST IDENTIFIER : fdatasync02
- *
- * EXECUTED BY : Any user
- *
- * TEST TITLE : Checking error conditions for fdatasync(2)
- *
- * TEST CASE TOTAL : 2
- *
- * AUTHOR : Madhu T L <madhu.tarikere@wipro.com>
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * DESCRIPTION
- * Verify that,
- * 1. fdatasync(2) returns -1 and sets errno to EBADF for invalid
- * file descriptor.
- * 2. fdatasync(2) returns -1 and sets errno to EINVAL for file
- * descriptor to a special file.
- *
- * Setup:
- * Setup signal handling.
- * Set expected errnos for logging
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Perform testcase specific setup (if needed)
- * Execute system call
- * Check return code and error number, if matching,
- * Issue PASS message
- * Otherwise,
- * Issue FAIL message
- * Perform testcase specific cleanup (if needed)
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- * USAGE: <for command-line>
- * fdatasync02 [-c n] [-e] [-f] [-h] [-i n] [-I x] [-p] [-P x] [-t]
- * where, -c n : Run n copies concurrently.
- * -e : Turn on errno logging.
- * -f : Turn off functional testing
- * -h : Show help screen
- * -i n : Execute test n times.
- * -I x : Execute test for x seconds.
- * -p : Pause for SIGUSR1 before starting
- * -P x : Pause for x seconds between iterations.
- * -t : Turn on syscall timing.
+
+/*\
+ * [Description]
*
- ****************************************************************/
+ * Verify that,
+ * 1. fdatasync(2) returns -1 and sets errno to EBADF for invalid file
+ * descriptor.
+ * 2. fdatasync(2) returns -1 and sets errno to EINVAL for file descriptor to a
+ * special file.
+ */
-#include <errno.h>
-#include <pwd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include "test.h"
-#include "safe_macros.h"
+#include "tst_test.h"
#define EXP_RET_VAL -1
#define SPL_FILE "/dev/null"
-struct test_case_t { /* test case structure */
+static struct tcase { /* test case structure */
+ int fd;
int experrno; /* expected errno */
char *desc;
- int (*setup) (void); /* Individual setup routine */
- void (*cleanup) (void); /* Individual cleanup routine */
+} tcases[] = {
+ { -1, EBADF, "invalid file descriptor" },
+ // initialize this fd later in setup()
+ { -1, EINVAL, "file descriptor to a special file" },
};
-char *TCID = "fdatasync02";
-
-static int testno;
-static int fd;
-
-static void setup(void);
-static void cleanup(void);
-static int setup1(void);
-static int setup2(void);
-static void cleanup2(void);
-
-static struct test_case_t tdat[] = {
- {EBADF, "invalid file descriptor", setup1, NULL},
- {EINVAL, "file descriptor to a special file", setup2, cleanup2},
-};
-
-int TST_TOTAL = sizeof(tdat) / sizeof(tdat[0]);
-
-int main(int argc, char **argv)
+static void run(unsigned int n)
{
- int lc;
+ struct tcase *tc = &tcases[n];
- tst_parse_opts(argc, argv, NULL, NULL);
-
- setup();
-
- for (lc = 0; TEST_LOOPING(lc); lc++) {
- /* reset tst_count in case we are looping */
- tst_count = 0;
-
- for (testno = 0; testno < TST_TOTAL; ++testno) {
- if ((tdat[testno].setup) && (tdat[testno].setup())) {
- /* setup() failed, skip this test */
- continue;
- }
-
- /* Test the system call */
- TEST(fdatasync(fd));
- if ((TEST_RETURN == EXP_RET_VAL) &&
- (TEST_ERRNO == tdat[testno].experrno)) {
- tst_resm(TPASS, "Expected failure for %s, "
- "errno: %d", tdat[testno].desc,
- TEST_ERRNO);
- } else {
- tst_resm(TFAIL, "Unexpected results for %s ; "
- "returned %ld (expected %d), errno %d "
- "(expected %d)", tdat[testno].desc,
- TEST_RETURN, EXP_RET_VAL,
- TEST_ERRNO, tdat[testno].experrno);
- }
- if (tdat[testno].cleanup) {
- tdat[testno].cleanup();
- }
- }
- }
- cleanup();
-
- tst_exit();
-}
-
-int setup1(void)
-{
- fd = -1;
- return 0;
-}
-
-int setup2(void)
-{
- /* Open special file */
- if ((fd = open(SPL_FILE, O_RDONLY)) == -1) {
- tst_resm(TBROK, "Failed to open %s", SPL_FILE);
- return 1;
- }
- return 0;
+ TST_EXP_FAIL(fdatasync(tc->fd), tc->experrno,
+ "fdatasync() for %s(%d)", tc->desc, tc->fd);
}
-void cleanup2(void)
+static void setup(void)
{
- /* close special file */
- SAFE_CLOSE(NULL, fd);
+ tcases[1].fd = SAFE_OPEN(SPL_FILE, O_RDONLY);
}
-/*
- * setup()
- * performs all ONE TIME setup for this test
- */
-void setup(void)
+static void cleanup(void)
{
-
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified
- * TEST_PAUSE contains the code to fork the test with the -c option.
- */
- TEST_PAUSE;
-
+ SAFE_CLOSE(tcases[1].fd);
}
-/*
- * cleanup()
- * performs all ONE TIME cleanup for this test at
- * completion or premature exit
- */
-void cleanup(void)
-{
-
-}
+static struct tst_test test = {
+ .needs_tmpdir = 1,
+ .test = run,
+ .tcnt = ARRAY_SIZE(tcases),
+ .setup = setup,
+ .cleanup = cleanup,
+};
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH 3/3] fdatasync03: add [Description] tag and cleanup code
2024-01-26 4:01 [LTP] [PATCH 1/3] fdatasync01: Convert to new API Shiyang Ruan
2024-01-26 4:01 ` [LTP] [PATCH 2/3] fdatasync02: " Shiyang Ruan
@ 2024-01-26 4:01 ` Shiyang Ruan
2024-03-13 16:14 ` Cyril Hrubis
2024-03-13 16:04 ` [LTP] [PATCH 1/3] fdatasync01: Convert to new API Cyril Hrubis
2 siblings, 1 reply; 6+ messages in thread
From: Shiyang Ruan @ 2024-01-26 4:01 UTC (permalink / raw)
To: ltp
Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
---
testcases/kernel/syscalls/fdatasync/fdatasync03.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
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);
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH 1/3] fdatasync01: Convert to new API
2024-01-26 4:01 [LTP] [PATCH 1/3] fdatasync01: Convert to new API Shiyang Ruan
2024-01-26 4:01 ` [LTP] [PATCH 2/3] fdatasync02: " Shiyang Ruan
2024-01-26 4:01 ` [LTP] [PATCH 3/3] fdatasync03: add [Description] tag and cleanup code Shiyang Ruan
@ 2024-03-13 16:04 ` Cyril Hrubis
2 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2024-03-13 16:04 UTC (permalink / raw)
To: Shiyang Ruan; +Cc: ltp
Hi!
> +// SPDX-License-Identifier: GPL-2.0-or-later
> /*
> * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
> - *
> - * This program is free software; you can redistribute it and/or modify it
> - * under the terms of version 2 of the GNU General Public License as
> - * published by the Free Software Foundation.
This is GPL-2.0 not GPL-2.0-or-later and we can't change license for the
old tests unless it's a complete rewrite.
> - * This program is distributed in the hope that it would be useful, but
> - * WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> - *
> - * You should have received a copy of the GNU General Public License along
> - * with this program; if not, write the Free Software Foundation, Inc.,
> - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> - *
> + * Copyright (c) Linux Test Project, 2003-2024
> */
> -/**********************************************************
> - *
> - * TEST IDENTIFIER : fdatasync01
> - *
> - * EXECUTED BY : Any user
> - *
> - * TEST TITLE : Basic test for fdatasync(2)
> - *
> - * TEST CASE TOTAL : 1
> - *
> - * AUTHOR : Madhu T L <madhu.tarikere@wipro.com>
> - *
> - * SIGNALS
> - * Uses SIGUSR1 to pause before test if option set.
> - * (See the parse_opts(3) man page).
> - *
> - * DESCRIPTION
> - * This is a Phase I test for the fdatasync(2) system call.
> - * It is intended to provide a limited exposure of the system call.
> - *
> - * Setup:
> - * Setup signal handling.
> - * Pause for SIGUSR1 if option specified.
> - * Create a temp directory and cd to it
> - * Initialize filename and open it in write mode for each child process.
> - *
> - * Test:
> - * Loop if the proper options are given.
> - * Execute system call
> - * Check return code, if system call failed (return=-1)
> - * Issue FAIL message with errno.
> - * Otherwise, Issue PASS message.
> - *
> - * Cleanup:
> - * Print errno log and/or timing stats if options given
> - * Remove temporary directory and all files in it.
> - *
> - * USAGE: <for command-line>
> - * fdatasync01 [-c n] [-e] [-f] [-h] [-i n] [-I x] [-p] [-P x] [-t]
> - * where, -c n : Run n copies concurrently.
> - * -e : Turn on errno logging.
> - * -f : Turn off functional testing
> - * -h : Show help screen
> - * -i n : Execute test n times.
> - * -I x : Execute test for x seconds.
> - * -p : Pause for SIGUSR1 before starting
> - * -P x : Pause for x seconds between iterations.
> - * -t : Turn on syscall timing.
> +
> +/*\
> + * [Description]
> *
> - ****************************************************************/
> -#include <errno.h>
> -#include <sys/types.h>
> -#include <sys/stat.h>
> -#include <fcntl.h>
> -#include <unistd.h>
> -#include "test.h"
> + * Basic test for fdatasync(). Call fdatasync() on a fd and expect it to pass.
> + */
>
> -static int fd;
> -static char filename[30];
> -static void setup(void);
> -static void cleanup(void);
> +#include "tst_test.h"
>
> -char *TCID = "fdatasync01";
> -int TST_TOTAL = 1;
> +static int fd;
> +static char pfilename[30];
>
> -int main(int argc, char **argv)
> +static void run(void)
> {
> - int lc;
> -
> - tst_parse_opts(argc, argv, NULL, NULL);
> -
> - setup();
> -
> - for (lc = 0; TEST_LOOPING(lc); lc++) {
> -
> - /* reset tst_count in case we are looping */
> - tst_count = 0;
> -
> - /* Test the system call */
> - TEST(fdatasync(fd));
> -
> - /* check return code */
> - if (TEST_RETURN == -1) {
> - tst_resm(TFAIL, "fdatasync() failed, errno=%d : %s",
> - TEST_ERRNO, strerror(TEST_ERRNO));
> - } else {
> - /* No Functional verification yet */
> - tst_resm(TPASS, "fdatasync() successful");
> - }
> - }
> -
> - /* perform global cleanup and exit */
> - cleanup();
> -
> - tst_exit();
> -
> + TST_EXP_PASS(fdatasync(fd), "fdatasync(%d)", fd);
> }
>
> -/* setup() - performs all ONE TIME setup for this test */
> -void setup(void)
> +static void setup(void)
> {
> -
> - tst_sig(NOFORK, DEF_HANDLER, cleanup);
> -
> - /* Pause if that option was specified
> - * TEST_PAUSE contains the code to fork the test with the -c option.
> - */
> - TEST_PAUSE;
> -
> - tst_tmpdir();
> -
> /* Initialize unique filename for each child process */
Such comments are useless and should be just removed.
> - if (sprintf(filename, "fdatasync_%d", getpid()) <= 0) {
> - tst_brkm(TBROK, cleanup, "Failed to initialize filename");
> - }
> - if ((fd = open(filename, O_CREAT | O_WRONLY, 0777)) == -1) { //mode must be specified when O_CREATE is in the flag
> - tst_brkm(TBROK, cleanup, "open() failed");
> - }
> - if ((write(fd, filename, strlen(filename) + 1)) == -1) {
> - tst_brkm(TBROK, cleanup, "write() failed");
> - }
> + sprintf(pfilename, "fdatasync_%d", getpid());
> +
> + /* mode must be specified when O_CREATE is in the flag */
Here as well.
> + fd = SAFE_OPEN(pfilename, O_CREAT | O_WRONLY, 0777);
> + SAFE_WRITE(SAFE_WRITE_ALL, fd, pfilename, strlen(pfilename) + 1);
> }
>
> -/*
> - * cleanup()
> - * performs all ONE TIME cleanup for this test at
> - * completion or premature exit
> - */
> -void cleanup(void)
> +static void cleanup(void)
> {
> - /*
> - * print timing stats if that option was specified.
> - * print errno log if that option was specified.
> - */
> close(fd);
It would be slightly better to close the fd only if it was opened and
with SAFE_CLOSE() i.e.
if (fd > 0)
SAFE_CLOSE(fd);
> -
> - tst_rmdir();
> -
> }
> +
> +static struct tst_test test = {
> + .needs_tmpdir = 1,
> + .test_all = run,
> + .setup = setup,
> + .cleanup = cleanup,
I suppose that it would make sense to run this test for .all_filesystems
as well.
> +};
> --
> 2.34.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH 2/3] fdatasync02: Convert to new API
2024-01-26 4:01 ` [LTP] [PATCH 2/3] fdatasync02: " Shiyang Ruan
@ 2024-03-13 16:08 ` Cyril Hrubis
0 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2024-03-13 16:08 UTC (permalink / raw)
To: Shiyang Ruan; +Cc: ltp
Hi!
It would actually make a lot of sense to use the tst_fd for the EINVAL
testcases. See readahead01.c to see how to implement that.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH 3/3] fdatasync03: add [Description] tag and cleanup code
2024-01-26 4:01 ` [LTP] [PATCH 3/3] fdatasync03: add [Description] tag and cleanup code Shiyang Ruan
@ 2024-03-13 16:14 ` Cyril Hrubis
0 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2024-03-13 16:14 UTC (permalink / raw)
To: Shiyang Ruan; +Cc: ltp
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
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-13 16:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-26 4:01 [LTP] [PATCH 1/3] fdatasync01: Convert to new API Shiyang Ruan
2024-01-26 4:01 ` [LTP] [PATCH 2/3] fdatasync02: " Shiyang Ruan
2024-03-13 16:08 ` Cyril Hrubis
2024-01-26 4:01 ` [LTP] [PATCH 3/3] fdatasync03: add [Description] tag and cleanup code Shiyang Ruan
2024-03-13 16:14 ` Cyril Hrubis
2024-03-13 16:04 ` [LTP] [PATCH 1/3] fdatasync01: Convert to new API Cyril Hrubis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.