public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 1/2] syscalls/symlink02: Convert to new API
@ 2023-10-20  9:37 Yang Xu
  2023-10-20  9:37 ` [LTP] [PATCH v2 2/2] Refactor and merge symlink04/05 using new LTP API Yang Xu
  2023-10-25 22:46 ` [LTP] [PATCH v2 1/2] syscalls/symlink02: Convert to new API Petr Vorel
  0 siblings, 2 replies; 5+ messages in thread
From: Yang Xu @ 2023-10-20  9:37 UTC (permalink / raw)
  To: ltp

The original test didn't produce any output results.
Use tst_macro to enable test to produce output results.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/syscalls/symlink/symlink02.c | 218 ++----------------
 1 file changed, 25 insertions(+), 193 deletions(-)

diff --git a/testcases/kernel/syscalls/symlink/symlink02.c b/testcases/kernel/syscalls/symlink/symlink02.c
index c18db2b37..c152bb2b7 100644
--- a/testcases/kernel/syscalls/symlink/symlink02.c
+++ b/testcases/kernel/syscalls/symlink/symlink02.c
@@ -1,208 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2000 Silicon Graphics, Inc.  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.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * 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.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
+ * Copyright (c) Linux Test Project, 2003-2023
+ * Author: William Roske
  */
-/* $Id: symlink02.c,v 1.6 2009/08/28 14:17:14 vapier Exp $ */
-/**********************************************************
- *
- *    OS Test - Silicon Graphics, Inc.
- *
- *    TEST IDENTIFIER	: symlink02
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: Basic test for symlink(2)
- *
- *    PARENT DOCUMENT	: usctpl01
- *
- *    TEST CASE TOTAL	: 1
- *
- *    WALL CLOCK TIME	: 1
- *
- *    CPU TYPES		: ALL
- *
- *    AUTHOR		: William Roske
- *
- *    CO-PILOT		: Dave Fenner
- *
- *    DATE STARTED	: 03/30/92
- *
- *    INITIAL RELEASE	: UNICOS 7.0
- *
- *    TEST CASES
- *
- * 	1.) symlink(2) returns...(See Description)
- *
- *    INPUT SPECIFICATIONS
- * 	The standard options for system call tests are accepted.
- *	(See the parse_opts(3) man page).
- *
- *    OUTPUT SPECIFICATIONS
- *$
- *    DURATION
- * 	Terminates - with frequency and infinite modes.
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    RESOURCES
- * 	None
- *
- *    ENVIRONMENTAL NEEDS
- *      No run-time environmental needs.
- *
- *    SPECIAL PROCEDURAL REQUIREMENTS
- * 	None
- *
- *    INTERCASE DEPENDENCIES
- * 	None
- *
- *    DETAILED DESCRIPTION
- *	This is a Phase I test for the symlink(2) system call.  It is intended
- *	to provide a limited exposure of the system call, for now.  It
- *	should/will be extended when full functional tests are written for
- *	symlink(2).
- *
- * 	Setup:
- * 	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *
- * 	Test:
- *	 Loop if the proper options are given.
- * 	  Execute system call
- *	  Check return code, if system call failed (return=-1)
- *		Log the errno and Issue a FAIL message.
- *	  Otherwise, Issue a PASS message.
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
 
-#include <sys/types.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "safe_macros.h"
-
-void setup();
-void cleanup();
+/*\
+ * [Description]
+ *
+ * Check the basic functionality of the symlink() system call.
+ */
 
-char *TCID = "symlink02";
-int TST_TOTAL = 1;
+#include "tst_test.h"
 
-char fname[255], symlnk[255];
-int fd;
+static char *fname, *symlnk;
 
-int main(int ac, char **av)
+static void verify_symlink(void)
 {
-	int lc;
-
-    /***************************************************************
-     * parse standard options
-     ***************************************************************/
-	tst_parse_opts(ac, av, NULL, NULL);
-
-    /***************************************************************
-     * perform global setup for test
-     ***************************************************************/
-	setup();
-
-    /***************************************************************
-     * check looping state if -c option given
-     ***************************************************************/
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		/*
-		 * Call symlink(2)
-		 */
-		TEST(symlink(fname, symlnk));
-
-		/* check return code */
-		if (TEST_RETURN == -1) {
-			tst_resm(TFAIL, "symlink(%s, %s) Failed, errno=%d : %s",
-				 fname, symlnk, TEST_ERRNO,
-				 strerror(TEST_ERRNO));
-		} else {
-			SAFE_UNLINK(cleanup, symlnk);
-		}
-	}
-
-    /***************************************************************
-     * cleanup and exit
-     ***************************************************************/
-	cleanup();
-	tst_exit();
+	TST_EXP_POSITIVE(symlink(fname, symlnk), "symlink(%s, %s)",
+			 fname, symlnk);
 
+	if (TST_RET == -1)
+		tst_res(TFAIL, "symlink(%s, %s) Failed", fname, symlnk);
+	else
+		SAFE_UNLINK(symlnk);
 }
 
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void setup(void)
+static void setup(void)
 {
+	fname = tst_aprintf("tfile_%d", getpid());
 
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
-	tst_tmpdir();
-
-	sprintf(fname, "tfile_%d", getpid());
-	if ((fd = open(fname, O_RDWR | O_CREAT, 0700)) == -1) {
-		tst_brkm(TBROK, cleanup,
-			 "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
-			 fname, errno, strerror(errno));
-	}
-
-	if (close(fd) == -1) {
-		tst_resm(TWARN, "close(%s) Failed, errno=%d : %s",
-			 fname, errno, strerror(errno));
-	}
-	sprintf(symlnk, "st_%d", getpid());
+	symlnk = tst_aprintf("st_%d", getpid());
 }
 
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- *		completion or premature exit.
- ***************************************************************/
-void cleanup(void)
-{
-
-	tst_rmdir();
-
-}
+static struct tst_test test = {
+	.needs_tmpdir = 1,
+	.setup = setup,
+	.test_all = verify_symlink,
+};
-- 
2.39.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [LTP] [PATCH v2 2/2] Refactor and merge symlink04/05 using new LTP API
  2023-10-20  9:37 [LTP] [PATCH v2 1/2] syscalls/symlink02: Convert to new API Yang Xu
@ 2023-10-20  9:37 ` Yang Xu
  2023-10-25 23:09   ` Petr Vorel
  2023-10-25 22:46 ` [LTP] [PATCH v2 1/2] syscalls/symlink02: Convert to new API Petr Vorel
  1 sibling, 1 reply; 5+ messages in thread
From: Yang Xu @ 2023-10-20  9:37 UTC (permalink / raw)
  To: ltp

symlink04 and symlink05 has been merged together, testing
the results of symlink(2) for the existence or non-existence
of a file

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 runtest/syscalls                              |   1 -
 testcases/kernel/syscalls/symlink/.gitignore  |   1 -
 testcases/kernel/syscalls/symlink/symlink04.c | 218 ++++--------------
 testcases/kernel/syscalls/symlink/symlink05.c | 180 ---------------
 4 files changed, 49 insertions(+), 351 deletions(-)
 delete mode 100644 testcases/kernel/syscalls/symlink/symlink05.c

diff --git a/runtest/syscalls b/runtest/syscalls
index 1851752cf..7e2f793f6 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -1559,7 +1559,6 @@ symlink01 symlink01
 symlink02 symlink02
 symlink03 symlink03
 symlink04 symlink04
-symlink05 symlink05
 
 #symlinkat test cases
 symlinkat01 symlinkat01
diff --git a/testcases/kernel/syscalls/symlink/.gitignore b/testcases/kernel/syscalls/symlink/.gitignore
index d1497e680..6ea587ff3 100644
--- a/testcases/kernel/syscalls/symlink/.gitignore
+++ b/testcases/kernel/syscalls/symlink/.gitignore
@@ -2,4 +2,3 @@
 /symlink02
 /symlink03
 /symlink04
-/symlink05
diff --git a/testcases/kernel/syscalls/symlink/symlink04.c b/testcases/kernel/syscalls/symlink/symlink04.c
index 2190b3b1b..5022d4f13 100644
--- a/testcases/kernel/syscalls/symlink/symlink04.c
+++ b/testcases/kernel/syscalls/symlink/symlink04.c
@@ -1,193 +1,73 @@
+// 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) International Business Machines  Corp., 2001
+ * Copyright (c) Linux Test Project, 2003-2023
+ * Author: 07/2001 John George
  */
 
-/*
- * Test Name : symlink04
- *
- * Test Description :
- *  Verify that, symlink will succeed to creat a symbolic link of an existing
- *  object name path.
- *
- * Expected Result:
- *  symlink() should return value 0 on success and symbolic link of an
- *  existing object should be created.
- *
- * Algorithm:
- *  Setup:
- *   Setup signal handling.
- *   Create temporary directory.
- *   Pause for SIGUSR1 if option specified.
- *
- *  Test:
- *   Loop if the proper options are given.
- *   Execute system call
- *   Check return code, if system call failed (return=-1)
- *   	Log the errno and Issue a FAIL message.
- *   Otherwise,
- *   	Verify the Functionality of system call
- *      if successful,
- *      	Issue Functionality-Pass message.
- *      Otherwise,
- *		Issue Functionality-Fail message.
- *  Cleanup:
- *   Print errno log and/or timing stats if options given
- *   Delete the temporary directory created.
- *
- * Usage:  <for command-line>
- *  symlink04 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t]
- *	where,  -c n : Run n copies concurrently.
- *		-e   : Turn on errno logging.
- *		-f   : Turn off functionality Testing.
- *		-i n : Execute test n times.
- *		-I x : Execute test for x seconds.
- *		-P x : Pause for x seconds between iterations.
- *		-t   : Turn on syscall timing.
- *
- * History
- *	07/2001 John George
- *		-Ported
- *
- * Restrictions:
- *  None.
+/*\
+ * [Description]
  *
+ * Check that a symbolic link may point to an existing file or
+ * to a nonexistent one.
  */
 
+#include "tst_test.h"
+#include <stdlib.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include "test.h"
-#include "safe_macros.h"
 
-#define  TESTFILE	"testfile"
-#define  SYMFILE	"slink_file"
-#define FILE_MODE       S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
+#define TESTFILE    "testfile"
+#define NONFILE     "noexistfile"
+#define SYMFILE     "slink_file"
 
-char *TCID = "symlink04";
-int TST_TOTAL = 1;
+static int fd;
+static char *testfile;
+static char *nonfile;
 
-void setup();
-void cleanup();
+static struct tcase {
+	char **srcfile;
+} tcases[] = {
+	{&testfile},
+	{&nonfile},
+};
 
-int main(int ac, char **av)
+static void setup(void)
 {
-	struct stat stat_buf;	/* stat structure buffer */
-	int lc;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		/*
-		 * Call symlink(2) to create a symlink of
-		 * testfile.
-		 */
-		TEST(symlink(TESTFILE, SYMFILE));
-
-		if (TEST_RETURN == -1) {
-			tst_resm(TFAIL, "symlink(%s, %s) Failed, errno=%d : %s",
-				 TESTFILE, SYMFILE, TEST_ERRNO,
-				 strerror(TEST_ERRNO));
-		} else {
-			/*
-			 * Get the symlink file status information
-			 * using lstat(2).
-			 */
-			if (lstat(SYMFILE, &stat_buf) < 0) {
-				tst_brkm(TFAIL, cleanup, "lstat(2) of "
-					 "%s failed, error:%d", SYMFILE,
-					 errno);
-			}
-
-			/* Check if the st_mode contains a link  */
-			if (!S_ISLNK(stat_buf.st_mode)) {
-				tst_resm(TFAIL,
-					 "symlink of %s doesn't exist",
-					 TESTFILE);
-			} else {
-				tst_resm(TPASS, "symlink(%s, %s) "
-					 "functionality successful",
-					 TESTFILE, SYMFILE);
-			}
-		}
-
-		/* Unlink the symlink file for next loop */
-		SAFE_UNLINK(cleanup, SYMFILE);
-		tst_count++;	/* incr TEST_LOOP counter */
-	}
-
-	cleanup();
-	tst_exit();
-
+	fd = SAFE_OPEN(TESTFILE, O_RDWR | O_CREAT, 0644);
 }
 
-/*
- * void
- * setup() - performs all ONE TIME setup for this test.
- *  Create a temporary directory and change directory to it.
- *  Create a test file under temporary directory and close it
- */
-void setup(void)
+static void verify_symlink(unsigned int i)
 {
-	int fd;			/* file handle for testfile */
+	struct tcase *tc = &tcases[i];
 
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
+	struct stat stat_buf;
 
-	/* Pause if that option was specified
-	 * TEST_PAUSE contains the code to fork the test with the -i option.
-	 * You want to make sure you do this before you create your temporary
-	 * directory.
-	 */
-	TEST_PAUSE;
+	TST_EXP_PASS(symlink(*tc->srcfile, SYMFILE), "symlink(%s, %s)",
+		     *tc->srcfile, SYMFILE);
 
-	tst_tmpdir();
+	SAFE_LSTAT(SYMFILE, &stat_buf);
 
-	/* creat/open a testfile */
-	if ((fd = open(TESTFILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) {
-		tst_brkm(TBROK, cleanup,
-			 "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d : %s",
-			 TESTFILE, FILE_MODE, errno, strerror(errno));
-	}
+	if (!S_ISLNK(stat_buf.st_mode))
+		tst_res(TFAIL, "symlink of %s doesn't exist", *tc->srcfile);
 
-	/* Close the temporary file created above */
-	if (close(fd) == -1) {
-		tst_resm(TBROK, "close(%s) Failed, errno=%d : %s",
-			 TESTFILE, errno, strerror(errno));
-	}
+	SAFE_UNLINK(SYMFILE);
 }
 
-/*
- * void
- * cleanup() - performs all ONE TIME cleanup for this test at
- *             completion or premature exit.
- *  Remove the test directory and testfile created in the setup.
- */
-void cleanup(void)
+static void cleanup(void)
 {
-
-	tst_rmdir();
-
+	if (fd > -1)
+		SAFE_CLOSE(fd);
 }
+
+static struct tst_test test = {
+	.tcnt = ARRAY_SIZE(tcases),
+	.setup = setup,
+	.cleanup = cleanup,
+	.test = verify_symlink,
+	.bufs = (struct tst_buffers []) {
+		{&testfile, .str = TESTFILE},
+		{&nonfile, .str = NONFILE},
+		{},
+	},
+	.needs_tmpdir = 1,
+};
diff --git a/testcases/kernel/syscalls/symlink/symlink05.c b/testcases/kernel/syscalls/symlink/symlink05.c
deleted file mode 100644
index 83b151f5d..000000000
--- a/testcases/kernel/syscalls/symlink/symlink05.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- *
- *   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
- */
-
-/*
- * Test Name : symlink05
- *
- * Test Description :
- *  Verify that, symlink will succeed to creat a symbolic link of an
- *  non-existing object name path.
- *
- * Expected Result:
- *  symlink() should return value 0 on success and symlink of an
- *  non-existing object should be created.
- *
- * Algorithm:
- *  Setup:
- *   Setup signal handling.
- *   Create temporary directory.
- *   Pause for SIGUSR1 if option specified.
- *
- *  Test:
- *   Loop if the proper options are given.
- *   Execute system call
- *   Check return code, if system call failed (return=-1)
- *   	Log the errno and Issue a FAIL message.
- *   Otherwise,
- *   	Verify the Functionality of system call
- *      if successful,
- *      	Issue Functionality-Pass message.
- *      Otherwise,
- *		Issue Functionality-Fail message.
- *  Cleanup:
- *   Print errno log and/or timing stats if options given
- *   Delete the temporary directory created.
- *
- * Usage:  <for command-line>
- *  symlink05 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t]
- *	where,  -c n : Run n copies concurrently.
- *		-e   : Turn on errno logging.
- *		-f   : Turn off functionality Testing.
- *		-i n : Execute test n times.
- *		-I x : Execute test for x seconds.
- *		-P x : Pause for x seconds between iterations.
- *		-t   : Turn on syscall timing.
- *
- * History
- *	07/2001 John George
- *		-Ported
- *
- * Restrictions:
- *  This test should be run by 'non-super-user' only.
- *
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-
-#include "test.h"
-#include "safe_macros.h"
-
-#define  TESTFILE	"testfile"
-#define  SYMFILE	"slink_file"
-
-char *TCID = "symlink05";
-int TST_TOTAL = 1;
-
-void setup();
-void cleanup();
-
-int main(int ac, char **av)
-{
-	struct stat stat_buf;	/* stat structure buffer */
-	int lc;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		/*
-		 * Call symlink(2) to create a symlink of
-		 * an non-existing testfile.
-		 */
-		TEST(symlink(TESTFILE, SYMFILE));
-
-		if (TEST_RETURN == -1) {
-			tst_resm(TFAIL,
-				 "symlink(%s, %s) Failed, errno=%d : %s",
-				 TESTFILE, SYMFILE, TEST_ERRNO,
-				 strerror(TEST_ERRNO));
-		} else {
-			/*
-			 * Get the symlink file status information
-			 * using lstat(2).
-			 */
-			if (lstat(SYMFILE, &stat_buf) < 0) {
-				tst_brkm(TFAIL, cleanup, "lstat(2) of "
-					 "%s failed, error:%d",
-					 SYMFILE, errno);
-			}
-
-			/* Check if the st_mode contains a link  */
-			if (!S_ISLNK(stat_buf.st_mode)) {
-				tst_resm(TFAIL,
-					 "symlink of %s doesn't exist",
-					 TESTFILE);
-			} else {
-				tst_resm(TPASS, "symlink(%s, %s) "
-					 "functionality successful",
-					 TESTFILE, SYMFILE);
-			}
-		}
-
-		/* Unlink the symlink file for next loop */
-		SAFE_UNLINK(cleanup, SYMFILE);
-		tst_count++;	/* incr TEST_LOOP counter */
-	}
-
-	cleanup();
-	tst_exit();
-
-}
-
-/*
- * void
- * setup() - performs all ONE TIME setup for this test.
- *  Create a temporary directory and change directory to it.
- */
-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 -i option.
-	 * You want to make sure you do this before you create your temporary
-	 * directory.
-	 */
-	TEST_PAUSE;
-
-	tst_tmpdir();
-
-}
-
-/*
- * void
- * cleanup() - performs all ONE TIME cleanup for this test at
- *             completion or premature exit.
- *  Remove the temporary directory created in the setup.
- */
-void cleanup(void)
-{
-
-	tst_rmdir();
-
-}
-- 
2.39.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH v2 1/2] syscalls/symlink02: Convert to new API
  2023-10-20  9:37 [LTP] [PATCH v2 1/2] syscalls/symlink02: Convert to new API Yang Xu
  2023-10-20  9:37 ` [LTP] [PATCH v2 2/2] Refactor and merge symlink04/05 using new LTP API Yang Xu
@ 2023-10-25 22:46 ` Petr Vorel
  1 sibling, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2023-10-25 22:46 UTC (permalink / raw)
  To: Yang Xu; +Cc: ltp

Hi Xu,

> The original test didn't produce any output results.
> Use tst_macro to enable test to produce output results.

> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>  testcases/kernel/syscalls/symlink/symlink02.c | 218 ++----------------
>  1 file changed, 25 insertions(+), 193 deletions(-)

> diff --git a/testcases/kernel/syscalls/symlink/symlink02.c b/testcases/kernel/syscalls/symlink/symlink02.c
> index c18db2b37..c152bb2b7 100644
> --- a/testcases/kernel/syscalls/symlink/symlink02.c
> +++ b/testcases/kernel/syscalls/symlink/symlink02.c
> @@ -1,208 +1,40 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
>  /*
>   * Copyright (c) 2000 Silicon Graphics, Inc.  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.

Unfortunately this is GPL v2 only.

I fixed that and merged also with Li's RBT (he added it to v1 and pointed out
the useless fd).

Thanks!

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH v2 2/2] Refactor and merge symlink04/05 using new LTP API
  2023-10-20  9:37 ` [LTP] [PATCH v2 2/2] Refactor and merge symlink04/05 using new LTP API Yang Xu
@ 2023-10-25 23:09   ` Petr Vorel
  2023-10-26  6:13     ` [LTP] 回复: " Yang Xu (Fujitsu)
  0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2023-10-25 23:09 UTC (permalink / raw)
  To: Yang Xu; +Cc: ltp

Hi Xu,

> symlink04 and symlink05 has been merged together, testing
> the results of symlink(2) for the existence or non-existence
> of a file
> + * Copyright (c) International Business Machines  Corp., 2001
> + * Copyright (c) Linux Test Project, 2003-2023
nit: IMHO LTP copyright was from 2001.

> + * Author: 07/2001 John George
>   */

...
> +	TST_EXP_PASS(symlink(*tc->srcfile, SYMFILE), "symlink(%s, %s)",
> +		     *tc->srcfile, SYMFILE);

nit: I would use just:
TST_EXP_PASS(symlink(*tc->srcfile, SYMFILE));

this:
symlink04.c:45: TFAIL: symlink(testfile, slink_file) failed: EFAULT (14)

is not much more informative than this:
symlink04.c:47: TFAIL: symlink(*tc->srcfile, SYMFILE) failed: EFAULT (14)

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] 回复:  [PATCH v2 2/2] Refactor and merge symlink04/05 using new LTP API
  2023-10-25 23:09   ` Petr Vorel
@ 2023-10-26  6:13     ` Yang Xu (Fujitsu)
  0 siblings, 0 replies; 5+ messages in thread
From: Yang Xu (Fujitsu) @ 2023-10-26  6:13 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp@lists.linux.it

Hi Petr,

>Hi Xu,

>> symlink04 and symlink05 has been merged together, testing
>> the results of symlink(2) for the existence or non-existence
>> of a file
>> + * Copyright (c) International Business Machines  Corp., 2001
>> + * Copyright (c) Linux Test Project, 2003-2023
>nit: IMHO LTP copyright was from 2001.

OK.

>> + * Author: 07/2001 John George
>>   */

>...
>> +     TST_EXP_PASS(symlink(*tc->srcfile, SYMFILE), "symlink(%s, %s)",
>> +                  *tc->srcfile, SYMFILE);

>nit: I would use just:
>TST_EXP_PASS(symlink(*tc->srcfile, SYMFILE));

>this:
>symlink04.c:45: TFAIL: symlink(testfile, slink_file) failed: EFAULT (14)

>is not much more informative than this:
>symlink04.c:47: TFAIL: symlink(*tc->srcfile, SYMFILE) failed: EFAULT (14)

>Reviewed-by: Petr Vorel <pvorel@suse.cz>

Yes.

Best Regards
Yang Xu

>Kind regards,
>Petr

________________________________
发件人: Petr Vorel <pvorel@suse.cz>
发送时间: 2023年10月26日 7:09
收件人: Xu, Yang/徐 杨 <xuyang2018.jy@fujitsu.com>
抄送: ltp@lists.linux.it <ltp@lists.linux.it>
主题: Re: [LTP] [PATCH v2 2/2] Refactor and merge symlink04/05 using new LTP API

Hi Xu,

> symlink04 and symlink05 has been merged together, testing
> the results of symlink(2) for the existence or non-existence
> of a file
> + * Copyright (c) International Business Machines  Corp., 2001
> + * Copyright (c) Linux Test Project, 2003-2023
nit: IMHO LTP copyright was from 2001.

> + * Author: 07/2001 John George
>   */

...
> +     TST_EXP_PASS(symlink(*tc->srcfile, SYMFILE), "symlink(%s, %s)",
> +                  *tc->srcfile, SYMFILE);

nit: I would use just:
TST_EXP_PASS(symlink(*tc->srcfile, SYMFILE));

this:
symlink04.c:45: TFAIL: symlink(testfile, slink_file) failed: EFAULT (14)

is not much more informative than this:
symlink04.c:47: TFAIL: symlink(*tc->srcfile, SYMFILE) failed: EFAULT (14)

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-10-26  6:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-20  9:37 [LTP] [PATCH v2 1/2] syscalls/symlink02: Convert to new API Yang Xu
2023-10-20  9:37 ` [LTP] [PATCH v2 2/2] Refactor and merge symlink04/05 using new LTP API Yang Xu
2023-10-25 23:09   ` Petr Vorel
2023-10-26  6:13     ` [LTP] 回复: " Yang Xu (Fujitsu)
2023-10-25 22:46 ` [LTP] [PATCH v2 1/2] syscalls/symlink02: Convert to new API Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox