Skip to contentSkip to conversation

syscalls/fcntl12: Convert to new API

PATCH In review Dai Shili 2 participants 4 messages Dec 3, 2021 – Dec 6, 2021

lore
Share & tools
lore

Dai Shili

author
#0 lore raw

PATCH 1/2 syscalls/fcntl12: Convert to new API

1) use SAFE macro
2) use TST_EXP_FAIL2 macro

---
 testcases/kernel/syscalls/fcntl/fcntl12.c | 135 ++++++++----------------------
 1 file changed, 36 insertions(+), 99 deletions(-)
testcases/kernel/syscalls/fcntl/fcntl12.c +36 -99
index ae382dd..e4dbe42 100644
@@ -1,120 +1,57 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *
- *   Copyright (c) International Business Machines  Corp., 2001
- *
- *   This program is free software;  you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
- *   the GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program;  if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Copyright (c) Linux Test Project, 2021
+ * Copyright (c) International Business Machines  Corp., 2001
+ * 07/2001 Ported by Wayne Boyer
  */
 
-/*
- * NAME
- *	fcntl12.c
+/*\
+ * [Description]
  *
- * DESCRIPTION
- *	Testcase to test that fcntl() sets EMFILE for F_DUPFD command.
+ * Tests basic error handling of the fcntl syscall.
  *
- * ALGORITHM
- *	Get the size of the descriptor table of a process, by calling the
- *	getdtablesize() system call. Then attempt to use the F_DUPFD command
- *	for fcntl(), which should fail with EMFILE.
- *
- * USAGE
- *	fcntl12
- *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
- *
- * RESTRICTIONS
- *	NONE
+ * - EMFILE when cmd refers to F_DUPFD after gets the size of the descriptor table of a process
  */
 
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/wait.h>
-#include <errno.h>
-#include "test.h"
+#include <stdlib.h>
+#include "tst_test.h"
 
-char *TCID = "fcntl12";
-int TST_TOTAL = 1;
+static pid_t pid;
+static char fname[20] = "testfile";
+static int fd = -1;
+static int i, max_files;
 
-int fail;
-char fname[20];
-void setup(void);
-void cleanup(void);
-
-int main(int ac, char **av)
+static void verify_fcntl(void)
 {
-	int lc;
-
-	pid_t pid;
-	int fd, i, status, max_files;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	/* check for looping state if -i option is given */
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		tst_count = 0;
-
-		tst_resm(TINFO, "Test for errno EMFILE");
-		fail = 0;
-
-		pid = FORK_OR_VFORK();
-		if (pid < 0) {
-			tst_brkm(TBROK | TERRNO, cleanup, "Fork failed");
-		} else if (pid == 0) {
-			max_files = getdtablesize();
-			for (i = 0; i < max_files; i++) {
-				if ((fd = open(fname, O_CREAT | O_RDONLY,
-					       0444)) == -1) {
-					break;
-				}
-			}
-
-			if (fcntl(1, F_DUPFD, 1) != -1) {
-				tst_resm(TFAIL, "fcntl failed to FAIL");
-				exit(1);
-			} else if (errno != EMFILE) {
-				tst_resm(TFAIL, "Expected EMFILE got %d",
-					 errno);
-				exit(1);
-			}
-			exit(0);
+	pid = SAFE_FORK();
+	if (pid == 0) {
+		max_files = getdtablesize();
+		for (i = 0; i < max_files; i++) {
+			fd = open(fname, O_CREAT | O_RDONLY, 0444);
+			if (fd == -1)
+				break;
 		}
-		waitpid(pid, &status, 0);
-		if (WEXITSTATUS(status) == 0)
-			tst_resm(TPASS, "block 1 PASSED");
-		else
-			tst_resm(TFAIL, "block 1 FAILED");
+		TST_EXP_FAIL2(fcntl(1, F_DUPFD, 1), EMFILE,
+		"fcntl() got EMFILE");
 	}
-	cleanup();
-	tst_exit();
+	tst_reap_children();
+
 }
 
-void setup(void)
+static void cleanup(void)
 {
-	tst_sig(FORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
+	if (fd > -1)
+		SAFE_CLOSE(fd);
 
-	sprintf(fname, "fcnlt12.%d", getpid());
-	tst_tmpdir();
+	SAFE_UNLINK(fname);
 }
 
-void cleanup(void)
-{
-	unlink(fname);
-	tst_rmdir();
-}
+static struct tst_test test = {
+	.forks_child = 1,
+	.needs_tmpdir = 1,
+	.cleanup = cleanup,
+	.test_all = verify_fcntl,
+};
Signature · 5 lines
1.8.3.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#1 lore raw

PATCH 2/2 syscalls/fcntl13: Convert to new API

1) use TST_EXP_FAIL2 macro
2) remove uclinux code
3) remove duplicate cases

---
 testcases/kernel/syscalls/fcntl/fcntl13.c | 160 +++++++++---------------------
 1 file changed, 48 insertions(+), 112 deletions(-)
testcases/kernel/syscalls/fcntl/fcntl13.c +48 -112
index dae4c37..33c4460 100644
@@ -1,127 +1,63 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *
- *   Copyright (c) International Business Machines  Corp., 2001
- *
- *   This program is free software;  you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
- *   the GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program;  if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Copyright (c) Linux Test Project, 2021
+ * Copyright (c) International Business Machines  Corp., 2001
+ * 07/2001 Ported by Wayne Boyer
  */
 
-/*
- * NAME
- *	fcntl13.c
- *
- * DESCRIPTION
- *	Testcase to test that fcntl() sets errno correctly.
+/*\
+ * [Description]
  *
- * USAGE
- *	fcntl13
+ * Tests basic error handling of the fcntl syscall.
  *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
- *
- * RESTRICTIONS
- *	NONE
+ * - EFAULT when cmd argument is F_SETLK and the data pointed to by arg is not valid
+ * - EINVAL when cmd argument is not recognized by this kernel
+ * - EINVAL when cmd argument is F_GETLK, F_SETLK, or F_SETLKW and fd does not support locking
+ * - EBADF when fd refers to an invalid file descriptor
  */
 
 #include <fcntl.h>
-#include <errno.h>
-#include "test.h"
-
-#define F_BADCMD 99999
-
-char *TCID = "fcntl13";
-int TST_TOTAL = 1;
-
-void setup(void);
-
-int main(int ac, char **av)
+#include "tst_test.h"
+
+#define F_BADCMD 999
+#define DATA    "ABCDEFGHIJ"
+
+static struct flock flock;
+
+static struct tcase {
+	int fd;
+	int cmd;
+	struct flock *flock;
+	char *desc;
+	int exp_errno;
+} tcases[] = {
+	{1, F_SETLK, NULL, "F_SETLK", EFAULT},
+	{1, F_BADCMD, &flock, "F_BADCMD", EINVAL},
+	{1, F_SETLK, &flock,  "F_SETLK", EINVAL},
+	{-1, F_GETLK, &flock, "F_GETLK", EBADF}
+};
+
+static void verify_fcntl(unsigned int n)
 {
-	int lc;
-
-	struct flock flock;
+	struct tcase *tc = &tcases[n];
 
-	tst_parse_opts(ac, av, NULL, NULL);
+	if (!tc->flock)
+		tc->flock = tst_get_bad_addr(NULL);
 
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		tst_count = 0;
-
-		if (fcntl(1, F_BADCMD, 1) != -1)
-			tst_resm(TFAIL, "fcntl(2) failed to FAIL");
-		else if (errno != EINVAL)
-			tst_resm(TFAIL, "Expected EINVAL got %d", errno);
-		else
-			tst_resm(TPASS, "got EINVAL");
-
-#ifndef UCLINUX
-		if (fcntl(1, F_SETLK, (void *)-1) != -1) {
-			tst_resm(TFAIL, "F_SETLK: fcntl(2) failed to FAIL");
-		} else if (errno != EFAULT) {
-			tst_resm(TFAIL, "F_SETLK: Expected EFAULT got %d",
-				 errno);
-		} else {
-			tst_resm(TPASS, "F_SETLK: got EFAULT");
-		}
-
-		if (fcntl(1, F_SETLKW, (void *)-1) != -1) {
-			tst_resm(TFAIL, "F_SETLKW: fcntl(2) failed to FAIL");
-		} else if (errno != EFAULT) {
-			tst_resm(TFAIL, "F_SETLKW: Expected EFAULT got %d",
-				 errno);
-		} else {
-			tst_resm(TPASS, "F_SETLKW: got EFAULT");
-		}
-
-		if (fcntl(1, F_GETLK, (void *)-1) != -1) {
-			tst_resm(TFAIL, "F_GETLK: fcntl(2) failed to FAIL");
-		} else if (errno != EFAULT) {
-			tst_resm(TFAIL, "F_GETLK: Expected EFAULT got %d",
-				 errno);
-		} else {
-			tst_resm(TPASS, "F_GETLK: got EFAULT");
-		}
-
-#else
-		tst_resm(TCONF, "Skip EFAULT on uClinux");
-#endif
-		flock.l_whence = -1;
-		flock.l_type = F_WRLCK;
-		flock.l_start = 0L;
-		flock.l_len = 0L;
-
-		if (fcntl(1, F_SETLK, &flock) != -1)
-			tst_resm(TFAIL, "fcntl(2) failed to FAIL");
-		else if (errno != EINVAL)
-			tst_resm(TFAIL, "Expected EINVAL, got %d", errno);
-		else
-			tst_resm(TPASS, "got EINVAL");
-
-		if (fcntl(-1, F_GETLK, &flock) != -1)
-			tst_resm(TFAIL, "fcntl(2) failed to FAIL");
-		else if (errno != EBADF)
-			tst_resm(TFAIL, "Expected EBADF, got %d", errno);
-		else
-			tst_resm(TPASS, "got EBADFD");
-	}
-
-	tst_exit();
+	TST_EXP_FAIL2(fcntl(tc->fd, tc->cmd, tc->flock), tc->exp_errno,
+		"fcntl(%d, %s, %d)", tc->fd, tc->desc, tc->exp_errno);
 }
 
-void setup(void)
+static void setup(void)
 {
-	tst_sig(NOFORK, DEF_HANDLER, NULL);
-
-	TEST_PAUSE;
+	flock.l_whence = -1;
+	flock.l_type = F_WRLCK;
+	flock.l_start = 0L;
+	flock.l_len = 0L;
 }
+
+static struct tst_test test = {
+	.setup = setup,
+	.tcnt = ARRAY_SIZE(tcases),
+	.test = verify_fcntl,
+};
Signature · 5 lines
1.8.3.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Re: [LTP] [PATCH 2/2] syscalls/fcntl13: Convert to new API

Hi Dai

I do some minor changes and pushed, thanks.

1) fix description
2) fix TST_EXP_FAIL2 usage
3) remove useless DATA macro

Best Regards
Yang Xu

Quoted 189 lines

1) use TST_EXP_FAIL2 macro
2) remove uclinux code
3) remove duplicate cases

---
  testcases/kernel/syscalls/fcntl/fcntl13.c | 160 +++++++++---------------------
  1 file changed, 48 insertions(+), 112 deletions(-)
testcases/kernel/syscalls/fcntl/fcntl13.c +48 -112
index dae4c37..33c4460 100644
@@ -1,127 +1,63 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
  /*
- *
- *   Copyright (c) International Business Machines  Corp., 2001
- *
- *   This program is free software;  you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
- *   the GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program;  if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Copyright (c) Linux Test Project, 2021
+ * Copyright (c) International Business Machines  Corp., 2001
+ * 07/2001 Ported by Wayne Boyer
   */
 
-/*
- * NAME
- *	fcntl13.c
- *
- * DESCRIPTION
- *	Testcase to test that fcntl() sets errno correctly.
+/*\
+ * [Description]
   *
- * USAGE
- *	fcntl13
+ * Tests basic error handling of the fcntl syscall.
   *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
- *
- * RESTRICTIONS
- *	NONE
+ * - EFAULT when cmd argument is F_SETLK and the data pointed to by arg is not valid
+ * - EINVAL when cmd argument is not recognized by this kernel
+ * - EINVAL when cmd argument is F_GETLK, F_SETLK, or F_SETLKW and fd does not support locking
+ * - EBADF when fd refers to an invalid file descriptor
   */
 
  #include<fcntl.h>
-#include<errno.h>
-#include "test.h"
-
-#define F_BADCMD 99999
-
-char *TCID = "fcntl13";
-int TST_TOTAL = 1;
-
-void setup(void);
-
-int main(int ac, char **av)
+#include "tst_test.h"
+
+#define F_BADCMD 999
+#define DATA    "ABCDEFGHIJ"
+
+static struct flock flock;
+
+static struct tcase {
+	int fd;
+	int cmd;
+	struct flock *flock;
+	char *desc;
+	int exp_errno;
+} tcases[] = {
+	{1, F_SETLK, NULL, "F_SETLK", EFAULT},
+	{1, F_BADCMD,&flock, "F_BADCMD", EINVAL},
+	{1, F_SETLK,&flock,  "F_SETLK", EINVAL},
+	{-1, F_GETLK,&flock, "F_GETLK", EBADF}
+};
+
+static void verify_fcntl(unsigned int n)
  {
-	int lc;
-
-	struct flock flock;
+	struct tcase *tc =&tcases[n];
 
-	tst_parse_opts(ac, av, NULL, NULL);
+	if (!tc->flock)
+		tc->flock = tst_get_bad_addr(NULL);
 
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		tst_count = 0;
-
-		if (fcntl(1, F_BADCMD, 1) != -1)
-			tst_resm(TFAIL, "fcntl(2) failed to FAIL");
-		else if (errno != EINVAL)
-			tst_resm(TFAIL, "Expected EINVAL got %d", errno);
-		else
-			tst_resm(TPASS, "got EINVAL");
-
-#ifndef UCLINUX
-		if (fcntl(1, F_SETLK, (void *)-1) != -1) {
-			tst_resm(TFAIL, "F_SETLK: fcntl(2) failed to FAIL");
-		} else if (errno != EFAULT) {
-			tst_resm(TFAIL, "F_SETLK: Expected EFAULT got %d",
-				 errno);
-		} else {
-			tst_resm(TPASS, "F_SETLK: got EFAULT");
-		}
-
-		if (fcntl(1, F_SETLKW, (void *)-1) != -1) {
-			tst_resm(TFAIL, "F_SETLKW: fcntl(2) failed to FAIL");
-		} else if (errno != EFAULT) {
-			tst_resm(TFAIL, "F_SETLKW: Expected EFAULT got %d",
-				 errno);
-		} else {
-			tst_resm(TPASS, "F_SETLKW: got EFAULT");
-		}
-
-		if (fcntl(1, F_GETLK, (void *)-1) != -1) {
-			tst_resm(TFAIL, "F_GETLK: fcntl(2) failed to FAIL");
-		} else if (errno != EFAULT) {
-			tst_resm(TFAIL, "F_GETLK: Expected EFAULT got %d",
-				 errno);
-		} else {
-			tst_resm(TPASS, "F_GETLK: got EFAULT");
-		}
-
-#else
-		tst_resm(TCONF, "Skip EFAULT on uClinux");
-#endif
-		flock.l_whence = -1;
-		flock.l_type = F_WRLCK;
-		flock.l_start = 0L;
-		flock.l_len = 0L;
-
-		if (fcntl(1, F_SETLK,&flock) != -1)
-			tst_resm(TFAIL, "fcntl(2) failed to FAIL");
-		else if (errno != EINVAL)
-			tst_resm(TFAIL, "Expected EINVAL, got %d", errno);
-		else
-			tst_resm(TPASS, "got EINVAL");
-
-		if (fcntl(-1, F_GETLK,&flock) != -1)
-			tst_resm(TFAIL, "fcntl(2) failed to FAIL");
-		else if (errno != EBADF)
-			tst_resm(TFAIL, "Expected EBADF, got %d", errno);
-		else
-			tst_resm(TPASS, "got EBADFD");
-	}
-
-	tst_exit();
+	TST_EXP_FAIL2(fcntl(tc->fd, tc->cmd, tc->flock), tc->exp_errno,
+		"fcntl(%d, %s, %d)", tc->fd, tc->desc, tc->exp_errno);
  }
 
-void setup(void)
+static void setup(void)
  {
-	tst_sig(NOFORK, DEF_HANDLER, NULL);
-
-	TEST_PAUSE;
+	flock.l_whence = -1;
+	flock.l_type = F_WRLCK;
+	flock.l_start = 0L;
+	flock.l_len = 0L;
  }
+
+static struct tst_test test = {
+	.setup = setup,
+	.tcnt = ARRAY_SIZE(tcases),
+	.test = verify_fcntl,
+};
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw
In reply to Dai Shili

Hi Dai

I do some minor changes and pushed, thanks.

1) move getdtablesize into setup function and include <unistd.h> header
2) fix TST_EXP_FAIL2 usage
3) fix EMFILE description as man-pages said
4) move i,pid variable declaration to verify_fcntl funtion.

Best Regards
Yang Xu

Quoted 169 lines

1) use SAFE macro
2) use TST_EXP_FAIL2 macro

---
  testcases/kernel/syscalls/fcntl/fcntl12.c | 135 ++++++++----------------------
  1 file changed, 36 insertions(+), 99 deletions(-)
testcases/kernel/syscalls/fcntl/fcntl12.c +36 -99
index ae382dd..e4dbe42 100644
@@ -1,120 +1,57 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
  /*
- *
- *   Copyright (c) International Business Machines  Corp., 2001
- *
- *   This program is free software;  you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
- *   the GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program;  if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Copyright (c) Linux Test Project, 2021
+ * Copyright (c) International Business Machines  Corp., 2001
+ * 07/2001 Ported by Wayne Boyer
   */
 
-/*
- * NAME
- *	fcntl12.c
+/*\
+ * [Description]
   *
- * DESCRIPTION
- *	Testcase to test that fcntl() sets EMFILE for F_DUPFD command.
+ * Tests basic error handling of the fcntl syscall.
   *
- * ALGORITHM
- *	Get the size of the descriptor table of a process, by calling the
- *	getdtablesize() system call. Then attempt to use the F_DUPFD command
- *	for fcntl(), which should fail with EMFILE.
- *
- * USAGE
- *	fcntl12
- *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
- *
- * RESTRICTIONS
- *	NONE
+ * - EMFILE when cmd refers to F_DUPFD after gets the size of the descriptor table of a process
   */
 
  #include<fcntl.h>
  #include<sys/types.h>
  #include<sys/wait.h>
-#include<errno.h>
-#include "test.h"
+#include<stdlib.h>
+#include "tst_test.h"
 
-char *TCID = "fcntl12";
-int TST_TOTAL = 1;
+static pid_t pid;
+static char fname[20] = "testfile";
+static int fd = -1;
+static int i, max_files;
 
-int fail;
-char fname[20];
-void setup(void);
-void cleanup(void);
-
-int main(int ac, char **av)
+static void verify_fcntl(void)
  {
-	int lc;
-
-	pid_t pid;
-	int fd, i, status, max_files;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	/* check for looping state if -i option is given */
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		tst_count = 0;
-
-		tst_resm(TINFO, "Test for errno EMFILE");
-		fail = 0;
-
-		pid = FORK_OR_VFORK();
-		if (pid<  0) {
-			tst_brkm(TBROK | TERRNO, cleanup, "Fork failed");
-		} else if (pid == 0) {
-			max_files = getdtablesize();
-			for (i = 0; i<  max_files; i++) {
-				if ((fd = open(fname, O_CREAT | O_RDONLY,
-					       0444)) == -1) {
-					break;
-				}
-			}
-
-			if (fcntl(1, F_DUPFD, 1) != -1) {
-				tst_resm(TFAIL, "fcntl failed to FAIL");
-				exit(1);
-			} else if (errno != EMFILE) {
-				tst_resm(TFAIL, "Expected EMFILE got %d",
-					 errno);
-				exit(1);
-			}
-			exit(0);
+	pid = SAFE_FORK();
+	if (pid == 0) {
+		max_files = getdtablesize();
+		for (i = 0; i<  max_files; i++) {
+			fd = open(fname, O_CREAT | O_RDONLY, 0444);
+			if (fd == -1)
+				break;
  		}
-		waitpid(pid,&status, 0);
-		if (WEXITSTATUS(status) == 0)
-			tst_resm(TPASS, "block 1 PASSED");
-		else
-			tst_resm(TFAIL, "block 1 FAILED");
+		TST_EXP_FAIL2(fcntl(1, F_DUPFD, 1), EMFILE,
+		"fcntl() got EMFILE");
  	}
-	cleanup();
-	tst_exit();
+	tst_reap_children();
+
  }
 
-void setup(void)
+static void cleanup(void)
  {
-	tst_sig(FORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
+	if (fd>  -1)
+		SAFE_CLOSE(fd);
 
-	sprintf(fname, "fcnlt12.%d", getpid());
-	tst_tmpdir();
+	SAFE_UNLINK(fname);
  }
 
-void cleanup(void)
-{
-	unlink(fname);
-	tst_rmdir();
-}
+static struct tst_test test = {
+	.forks_child = 1,
+	.needs_tmpdir = 1,
+	.cleanup = cleanup,
+	.test_all = verify_fcntl,
+};
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp