ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 09/15] syscalls/fallocate04: Run test for all filesystems
Date: Tue, 10 Oct 2017 14:31:59 +0200	[thread overview]
Message-ID: <20171010123205.20147-9-chrubis@suse.cz> (raw)
In-Reply-To: <20171010123205.20147-1-chrubis@suse.cz>

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/syscalls/fallocate/fallocate04.c | 49 +++++++++++++----------
 1 file changed, 28 insertions(+), 21 deletions(-)

diff --git a/testcases/kernel/syscalls/fallocate/fallocate04.c b/testcases/kernel/syscalls/fallocate/fallocate04.c
index 4916c8b47..e576d728d 100644
--- a/testcases/kernel/syscalls/fallocate/fallocate04.c
+++ b/testcases/kernel/syscalls/fallocate/fallocate04.c
@@ -34,19 +34,15 @@
 #include "lapi/fallocate.h"
 
 static int fd;
-static const char fname[] = "fallocate04.txt";
 static size_t block_size;
 static size_t buf_size;
 
+#define MNTPOINT "fallocate"
+#define FNAME MNTPOINT "/fallocate.txt"
 #define NUM_OF_BLOCKS	3
 
 static char *verbose;
 
-static void cleanup(void)
-{
-	SAFE_CLOSE(fd);
-}
-
 static void get_blocksize(void)
 {
 	struct stat file_stat;
@@ -77,13 +73,6 @@ static void fill_tst_buf(char buf[])
 		memset(buf + i * block_size, 'a' + i, block_size);
 }
 
-static void setup(void)
-{
-	fd = SAFE_OPEN(fname, O_RDWR | O_CREAT, 0700);
-
-	get_blocksize();
-}
-
 static void check_file_data(const char exp_buf[], size_t size)
 {
 	char rbuf[size];
@@ -299,13 +288,26 @@ static void test05(void)
 	tst_res(TPASS, "test-case succeeded");
 }
 
-static void run(void)
+static void (*tcases[])(void) = {
+	test01, test02, test03, test04, test05
+};
+
+static void run(unsigned int i)
+{
+	tcases[i]();
+}
+
+static void setup(void)
+{
+	fd = SAFE_OPEN(FNAME, O_RDWR | O_CREAT, 0700);
+
+	get_blocksize();
+}
+
+static void cleanup(void)
 {
-	test01();
-	test02();
-	test03();
-	test04();
-	test05();
+	if (fd > 0)
+		SAFE_CLOSE(fd);
 }
 
 static struct tst_option opts[] = {
@@ -315,8 +317,13 @@ static struct tst_option opts[] = {
 
 static struct tst_test test = {
 	.options = opts,
-	.setup = setup,
 	.cleanup = cleanup,
-	.test_all = run,
+	.setup = setup,
+	.test = run,
+	.tcnt = ARRAY_SIZE(tcases),
+	.mount_device = 1,
+	.mntpoint = MNTPOINT,
+	.all_filesystems = 1,
 	.needs_tmpdir = 1,
+	.needs_root = 1,
 };
-- 
2.13.5


  parent reply	other threads:[~2017-10-10 12:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10 12:31 [LTP] [PATCH v2 01/15] lib/tst_mkfs: Clear first 512k of the device Cyril Hrubis
2017-10-10 12:31 ` [LTP] [PATCH v2 02/15] lib: Add interface to list supported filesystems Cyril Hrubis
2017-10-10 12:31 ` [LTP] [PATCH v2 03/15] SAFE_MOUNT: Handle FUSE mounts as well Cyril Hrubis
2017-10-10 12:31 ` [LTP] [PATCH v2 04/15] lib/tst_test: Add .all_filesystems flag Cyril Hrubis
2017-10-11  8:42   ` Jan Stancek
2017-10-11  9:54     ` Cyril Hrubis
2017-10-11 10:38       ` Jan Stancek
2017-10-11 11:11         ` Cyril Hrubis
2017-10-11 11:17           ` Jan Stancek
2017-10-10 12:31 ` [LTP] [PATCH v2 05/15] lib/tst_fs: Add tst_fill_fs() Cyril Hrubis
2017-10-10 12:31 ` [LTP] [PATCH v2 06/15] syscalls/fallocate05: New test Cyril Hrubis
2017-10-10 12:31 ` [LTP] [PATCH v2 07/15] syscalls/msync04: Run test for all filesystems Cyril Hrubis
2017-10-10 12:31 ` [LTP] [PATCH v2 08/15] syscalls/fallocate04: Convert to the new library Cyril Hrubis
2017-10-10 12:31 ` Cyril Hrubis [this message]
2017-10-10 12:32 ` [LTP] [PATCH v2 10/15] syscalls/setxattr01: " Cyril Hrubis
2017-10-10 12:32 ` [LTP] [PATCH v2 11/15] syscalls/setxattr01: Run test for all filesystems Cyril Hrubis
2017-10-10 12:32 ` [LTP] [PATCH v2 12/15] syscallse/setxattr02: Convert to the new library Cyril Hrubis
2017-10-10 12:32 ` [LTP] [PATCH v2 13/15] syscalls/fsync01: " Cyril Hrubis
2017-10-10 12:32 ` [LTP] [PATCH v2 14/15] syscalls/fsync01: Run test for all filesystems Cyril Hrubis
2017-10-10 12:32 ` [LTP] [PATCH v2 15/15] fs/fs_fill: Add a test to fill a FS in a few threads Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171010123205.20147-9-chrubis@suse.cz \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).