[LTP] [PATCH v1] Delete getdtablesize01 test

Andrea Cervesato andrea.cervesato@suse.de
Mon Nov 20 16:48:42 CET 2023


From: Andrea Cervesato <andrea.cervesato@suse.com>

The getdtablesize syscall has been created in the early Linux versions
and it has been replaced by getrlimit, which is now tested by its own
testing suite. For this reason we don't need this test anymore, since
its refactoring to new API can be considered a waste of time.

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
 runtest/syscalls                              |   2 -
 .../kernel/syscalls/getdtablesize/.gitignore  |   1 -
 .../kernel/syscalls/getdtablesize/Makefile    |   8 --
 .../syscalls/getdtablesize/getdtablesize01.c  | 119 ------------------
 4 files changed, 130 deletions(-)
 delete mode 100644 testcases/kernel/syscalls/getdtablesize/.gitignore
 delete mode 100644 testcases/kernel/syscalls/getdtablesize/Makefile
 delete mode 100644 testcases/kernel/syscalls/getdtablesize/getdtablesize01.c

diff --git a/runtest/syscalls b/runtest/syscalls
index c98992d44..4dc7c8ddc 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -449,8 +449,6 @@ getdents02 getdents02
 
 getdomainname01 getdomainname01
 
-getdtablesize01 getdtablesize01
-
 getegid01 getegid01
 getegid01_16 getegid01_16
 getegid02 getegid02
diff --git a/testcases/kernel/syscalls/getdtablesize/.gitignore b/testcases/kernel/syscalls/getdtablesize/.gitignore
deleted file mode 100644
index 67a71b5e2..000000000
--- a/testcases/kernel/syscalls/getdtablesize/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/getdtablesize01
diff --git a/testcases/kernel/syscalls/getdtablesize/Makefile b/testcases/kernel/syscalls/getdtablesize/Makefile
deleted file mode 100644
index 044619fb8..000000000
--- a/testcases/kernel/syscalls/getdtablesize/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines  Corp., 2001
-
-top_srcdir		?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c b/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c
deleted file mode 100644
index d25cac261..000000000
--- a/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) International Business Machines  Corp., 2005
- * Copyright (c) Wipro Technologies Ltd, 2005.  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.
- *
- */
-/**********************************************************
- *
- *    TEST IDENTIFIER   : getdtablesize01
- *
- *    EXECUTED BY       : root / superuser
- *
- *    TEST TITLE        : Basic tests for getdtablesize01(2)
- *
- *    TEST CASE TOTAL   : 1
- *
- *    AUTHOR            : Prashant P Yendigeri
- *                        <prashant.yendigeri@wipro.com>
- *                        Robbie Williamson
- *                        <robbiew@us.ibm.com>
- *
- *    DESCRIPTION
- *      This is a Phase I test for the getdtablesize01(2) system call.
- *      It is intended to provide a limited exposure of the system call.
- *
- **********************************************************/
-
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <unistd.h>
-#include "test.h"
-
-void setup();
-void cleanup();
-
-char *TCID = "getdtablesize01";
-int TST_TOTAL = 1;
-
-int main(void)
-{
-	int table_size, fd = 0, count = 0;
-	int max_val_opfiles;
-	struct rlimit rlp;
-
-	setup();
-	table_size = getdtablesize();
-	getrlimit(RLIMIT_NOFILE, &rlp);
-	max_val_opfiles = (rlim_t) rlp.rlim_cur;
-
-	tst_resm(TINFO,
-		 "Maximum number of files a process can have opened is %d",
-		 table_size);
-	tst_resm(TINFO,
-		 "Checking with the value returned by getrlimit...RLIMIT_NOFILE");
-
-	if (table_size == max_val_opfiles)
-		tst_resm(TPASS, "got correct dtablesize, value is %d",
-			 max_val_opfiles);
-	else {
-		tst_resm(TFAIL, "got incorrect table size, value is %d",
-			 max_val_opfiles);
-		cleanup();
-	}
-
-	tst_resm(TINFO,
-		 "Checking Max num of files that can be opened by a process.Should be: RLIMIT_NOFILE - 1");
-	for (;;) {
-		fd = open("/etc/hosts", O_RDONLY);
-
-		if (fd == -1)
-			break;
-		count = fd;
-
-#ifdef DEBUG
-		printf("Opened file num %d\n", fd);
-#endif
-	}
-
-//Now the max files opened should be RLIMIT_NOFILE - 1 , why ? read getdtablesize man page
-
-	if (count > 0)
-		close(count);
-	if (count == (max_val_opfiles - 1))
-		tst_resm(TPASS, "%d = %d", count, (max_val_opfiles - 1));
-	else if (fd < 0 && errno == ENFILE)
-		tst_brkm(TCONF, cleanup, "Reached maximum number of open files for the system");
-	else
-		tst_resm(TFAIL, "%d != %d", count, (max_val_opfiles - 1));
-
-	cleanup();
-	tst_exit();
-}
-
-void setup(void)
-{
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-}
-
-void cleanup(void)
-{
-}
-- 
2.35.3



More information about the ltp mailing list