|
From: Cyril H. <su...@li...> - 2013-09-12 13:51:30
|
The branch, master, has been updated
via 565f46aaa29bc58d9fec4f62e5782d075969f2a0 (commit)
via 61e3e02a1b230a02d864d1fb6969ba2b8efe0cab (commit)
via 4940d00b75ec0f7a375dce5542afd56cfc0267f0 (commit)
via 3875344caeeaec34826929a1708ce73e58c0e862 (commit)
via 7dc42c97696f135e1fef92e612ecc66bf8d74318 (commit)
via 1c44244849cee68dec5f38a61a3441b0e0a3b472 (commit)
via e1f32ce1ff8f7038806c9565d6dd9c1c8644b51e (commit)
from 372fbd2416fd02b205690443f93e609c462b409e (commit)
- Log -----------------------------------------------------------------
commit 565f46aaa29bc58d9fec4f62e5782d075969f2a0
Author: Cyril Hrubis <ch...@su...>
Date: Thu Sep 12 15:39:10 2013 +0200
device-drivers/rtc: Fix .gitignore
I forget to fix it when the test was renamed.
Signed-off-by: Cyril Hrubis <ch...@su...>
commit 61e3e02a1b230a02d864d1fb6969ba2b8efe0cab
Author: Cyril Hrubis <ch...@su...>
Date: Thu Sep 12 15:37:26 2013 +0200
syscalls: get{egid, euid} Cleanup.
Remove useless comments, decleare local vars static, etc.
Signed-off-by: Cyril Hrubis <ch...@su...>
commit 4940d00b75ec0f7a375dce5542afd56cfc0267f0
Author: Stanislav Kholmanskikh <sta...@or...>
Date: Wed Sep 11 13:25:44 2013 +0400
getegid, geteuid: fixed 16-bit versions
Signed-off-by: Stanislav Kholmanskikh <sta...@or...>
commit 3875344caeeaec34826929a1708ce73e58c0e862
Author: Cyril Hrubis <ch...@su...>
Date: Thu Sep 12 14:58:41 2013 +0200
syscalls: setuid04: Make use of tst_{tmpdir,rmdir}
Signed-off-by: Cyril Hrubis <ch...@su...>
commit 7dc42c97696f135e1fef92e612ecc66bf8d74318
Author: Cyril Hrubis <ch...@su...>
Date: Thu Sep 12 14:55:55 2013 +0200
syscalls: {set,get}{gid,uid}: Cleanup.
Remove useless comments, decleare local vars static, etc.
Signed-off-by: Cyril Hrubis <ch...@su...>
commit 1c44244849cee68dec5f38a61a3441b0e0a3b472
Author: Stanislav Kholmanskikh <sta...@or...>
Date: Wed Sep 11 13:25:43 2013 +0400
getuid, getgid, setuid, setgid: fixed 16-bit versions
Fixed 16-bit versions of testcases:
* getgid
* getuid
* setgid
* setuid
the way like setgroups.
Testcase getuid02 in fact tests geteuid() so renamed it to geteuid02.
Signed-off-by: Stanislav Kholmanskikh <sta...@or...>
commit e1f32ce1ff8f7038806c9565d6dd9c1c8644b51e
Author: Cyril Hrubis <ch...@su...>
Date: Wed Sep 11 11:48:01 2013 +0200
runtest/mm: Fix ksn -> ksm typo.
Signed-off-by: Cyril Hrubis <ch...@su...>
Acked-by: Wanlong Gao <gao...@cn...>
-----------------------------------------------------------------------
Summary of changes:
runtest/ltplite | 2 +-
runtest/mm | 2 +-
runtest/stress.part3 | 2 +-
runtest/syscalls | 4 +-
testcases/kernel/device-drivers/rtc/.gitignore | 2 +-
testcases/kernel/syscalls/.gitignore | 4 +-
testcases/kernel/syscalls/getegid/compat_16.h | 48 -------
testcases/kernel/syscalls/getegid/getegid01.c | 96 +------------
testcases/kernel/syscalls/getegid/getegid02.c | 128 +++++-------------
testcases/kernel/syscalls/geteuid/compat_16.h | 48 -------
testcases/kernel/syscalls/geteuid/geteuid01.c | 96 +------------
.../getitimer01.c => geteuid/geteuid02.c} | 83 +++++-------
testcases/kernel/syscalls/getgid/compat_16.h | 60 --------
testcases/kernel/syscalls/getgid/getgid01.c | 95 ++------------
testcases/kernel/syscalls/getgid/getgid03.c | 128 +++++-------------
testcases/kernel/syscalls/getuid/compat_16.h | 60 --------
testcases/kernel/syscalls/getuid/getuid01.c | 95 ++------------
testcases/kernel/syscalls/getuid/getuid02.c | 112 ---------------
testcases/kernel/syscalls/getuid/getuid03.c | 92 +++++--------
testcases/kernel/syscalls/setgid/compat_16.h | 68 ----------
testcases/kernel/syscalls/setgid/setgid01.c | 136 ++-----------------
testcases/kernel/syscalls/setgid/setgid02.c | 113 +++++-----------
testcases/kernel/syscalls/setgid/setgid03.c | 105 ++++-----------
testcases/kernel/syscalls/setuid/setuid01.c | 142 ++-----------------
testcases/kernel/syscalls/setuid/setuid02.c | 14 +--
testcases/kernel/syscalls/setuid/setuid03.c | 101 +++++---------
testcases/kernel/syscalls/setuid/setuid04.c | 138 +++++++------------
testcases/kernel/syscalls/utils/compat_16.h | 49 +++++++
28 files changed, 414 insertions(+), 1609 deletions(-)
delete mode 100644 testcases/kernel/syscalls/getegid/compat_16.h
delete mode 100644 testcases/kernel/syscalls/geteuid/compat_16.h
copy testcases/kernel/syscalls/{getitimer/getitimer01.c => geteuid/geteuid02.c} (55%)
delete mode 100644 testcases/kernel/syscalls/getgid/compat_16.h
delete mode 100644 testcases/kernel/syscalls/getuid/compat_16.h
delete mode 100644 testcases/kernel/syscalls/getuid/getuid02.c
delete mode 100644 testcases/kernel/syscalls/setgid/compat_16.h
diff --git a/runtest/ltplite b/runtest/ltplite
index 2a704db..8ff55ee 100644
--- a/runtest/ltplite
+++ b/runtest/ltplite
@@ -285,6 +285,7 @@ getdtablesize01 getdtablesize01
getegid01 getegid01
geteuid01 geteuid01
+geteuid02 geteuid02
getgid01 getgid01
getgid03 getgid03
@@ -341,7 +342,6 @@ gettimeofday01 gettimeofday01
gettimeofday02 gettimeofday02
getuid01 getuid01
-getuid02 getuid02
getuid03 getuid03
#Needs tty device.
diff --git a/runtest/mm b/runtest/mm
index a39becd..28151b5 100644
--- a/runtest/mm
+++ b/runtest/mm
@@ -72,7 +72,7 @@ ksm04_1 ksm04 -u 128
ksm05 ksm05 -I 10
ksm06 ksm06
ksm06_1 ksm06 -n 10
-ksn06_2 ksm06 -n 10000
+ksm06_2 ksm06 -n 10000
cpuset01 cpuset01 -I 3600
diff --git a/runtest/stress.part3 b/runtest/stress.part3
index b783b7f..0533d4d 100644
--- a/runtest/stress.part3
+++ b/runtest/stress.part3
@@ -224,6 +224,7 @@ getdtablesize01 getdtablesize01
getegid01 getegid01
geteuid01 geteuid01
+geteuid02 geteuid02
getgid01 getgid01
getgid03 getgid03
@@ -281,7 +282,6 @@ gettimeofday01 gettimeofday01
gettimeofday02 gettimeofday02
getuid01 getuid01
-getuid02 getuid02
getuid03 getuid03
ioperm01 ioperm01
diff --git a/runtest/syscalls b/runtest/syscalls
index b778b64..09e5f7f 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -343,6 +343,8 @@ getegid02_16 getegid02_16
geteuid01 geteuid01
geteuid01_16 geteuid01_16
+geteuid02 geteuid02
+geteuid02_16 geteuid02_16
getgid01 getgid01
getgid01_16 getgid01_16
@@ -413,8 +415,6 @@ gettimeofday02 gettimeofday02
getuid01 getuid01
getuid01_16 getuid01_16
-getuid02 getuid02
-getuid02_16 getuid02_16
getuid03 getuid03
getuid03_16 getuid03_16
diff --git a/testcases/kernel/device-drivers/rtc/.gitignore b/testcases/kernel/device-drivers/rtc/.gitignore
index 727656a..8412fe6 100644
--- a/testcases/kernel/device-drivers/rtc/.gitignore
+++ b/testcases/kernel/device-drivers/rtc/.gitignore
@@ -1 +1 @@
-/rtc-test
+/rtc01
diff --git a/testcases/kernel/syscalls/.gitignore b/testcases/kernel/syscalls/.gitignore
index f8f02d5..ad23c2e 100644
--- a/testcases/kernel/syscalls/.gitignore
+++ b/testcases/kernel/syscalls/.gitignore
@@ -286,6 +286,8 @@
/getegid/getegid02_16
/geteuid/geteuid01
/geteuid/geteuid01_16
+/geteuid/geteuid02
+/geteuid/geteuid02_16
/getgid/getgid01
/getgid/getgid01_16
/getgid/getgid03
@@ -336,8 +338,6 @@
/gettimeofday/gettimeofday02
/getuid/getuid01
/getuid/getuid01_16
-/getuid/getuid02
-/getuid/getuid02_16
/getuid/getuid03
/getuid/getuid03_16
/getxattr/getxattr01
diff --git a/testcases/kernel/syscalls/getegid/compat_16.h b/testcases/kernel/syscalls/getegid/compat_16.h
deleted file mode 100644
index a28289b..0000000
--- a/testcases/kernel/syscalls/getegid/compat_16.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Copyright (c) Red Hat Inc., 2008
- *
- * 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
- */
-
-/* Author: Masatake YAMATO <ya...@re...> */
-
-#ifndef __GETEGID_COMPAT_16_H__
-#define __GETEGID_COMPAT_16_H__
-
-
-#include "linux_syscall_numbers.h"
-#include "compat_gid.h"
-
-
-#ifdef TST_USE_COMPAT16_SYSCALL
-
-GID_T
-GETEGID(void)
-{
- return ltp_syscall(__NR_getegid);
-}
-
-#else
-
-GID_T
-GETEGID(void)
-{
- return getegid();
-}
-
-#endif
-
-#endif /* __GETEGID_COMPAT_16_H__ */
diff --git a/testcases/kernel/syscalls/getegid/getegid01.c b/testcases/kernel/syscalls/getegid/getegid01.c
index 3b4f17e..6c10b42 100644
--- a/testcases/kernel/syscalls/getegid/getegid01.c
+++ b/testcases/kernel/syscalls/getegid/getegid01.c
@@ -30,82 +30,11 @@
* http://oss.sgi.com/projects/GenInfo/NoticeExplan/
*
*/
-/* $Id: getegid01.c,v 1.8 2009/10/26 14:55:47 subrata_modak Exp $ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : getegid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for getegid(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.) getegid(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * 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 getegid(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
- * getegid(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 <errno.h>
@@ -114,17 +43,14 @@
#include "test.h"
#include "usctest.h"
-
#include "compat_16.h"
-void setup();
-void cleanup();
+static void setup();
+static void cleanup();
TCID_DEFINE(getegid01);
int TST_TOTAL = 1;
-int exp_enos[] = { 0 }; /* must be a 0 terminated list */
-
int main(int ac, char **av)
{
int lc;
@@ -135,13 +61,11 @@ int main(int ac, char **av)
setup();
- TEST_EXP_ENOS(exp_enos);
-
for (lc = 0; TEST_LOOPING(lc); lc++) {
tst_count = 0;
- TEST(GETEGID());
+ TEST(GETEGID(cleanup));
if (TEST_RETURN == -1) {
tst_resm(TFAIL | TTERRNO, "getegid failed");
@@ -154,20 +78,16 @@ int main(int ac, char **av)
}
cleanup();
-
tst_exit();
}
-void setup()
+static void setup(void)
{
-
tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
TEST_PAUSE;
}
-void cleanup()
+static void cleanup(void)
{
TEST_CLEANUP;
-
}
diff --git a/testcases/kernel/syscalls/getegid/getegid02.c b/testcases/kernel/syscalls/getegid/getegid02.c
index e8b4022..c848d53 100644
--- a/testcases/kernel/syscalls/getegid/getegid02.c
+++ b/testcases/kernel/syscalls/getegid/getegid02.c
@@ -1,62 +1,27 @@
/*
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported by Wayne Boyer
*
- * 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 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.
*
- * 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
+ * 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
*/
/*
- * NAME
- * getegid02.c
- *
- * DESCRIPTION
- * Testcase to check the basic functionality of getegid().
- *
- * ALGORITHM
- * call setup
- * loop if that option was specified
- * Execute getegid() call using TEST macro
- * if not expected value
- * break remaining tests and cleanup
- * if STD_FUNCTIONAL_TEST
- * Execute geteuid() call
- * Execute getpwduid() call
- * if the passwd entry is NULL
- * break the remaining tests and cleanup
- * else if pwent->pw_gid != TEST_RETURN
- * print failure message
- * else
- * print pass message
- * else
- * print pass message
- * call cleanup
- *
- * USAGE: <for command-line>
- * getegid02 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
- * where, -c n : Run n copies concurrently.
- * -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 Ported by Wayne Boyer
+ * Testcase to check the basic functionality of getegid().
*
- * RESTRICTIONS
- * none
+ * For functionality test the return value from getegid() is compared to passwd
+ * entry.
*/
#include <pwd.h>
@@ -64,11 +29,10 @@
#include "test.h"
#include "usctest.h"
-
#include "compat_16.h"
-void cleanup(void);
-void setup(void);
+static void cleanup(void);
+static void setup(void);
TCID_DEFINE(getegid02);
int TST_TOTAL = 1;
@@ -77,21 +41,18 @@ int main(int ac, char **av)
{
int lc;
char *msg;
- int euid;
+ uid_t euid;
struct passwd *pwent;
if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- setup(); /* global setup */
+ setup();
- /* The following loop checks looping state if -i option given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
-
- /* reset tst_count in case we are looping */
tst_count = 0;
- TEST(GETEGID());
+ TEST(GETEGID(cleanup));
if (TEST_RETURN < 0) {
tst_brkm(TBROK, cleanup, "This should never happen");
@@ -99,58 +60,39 @@ int main(int ac, char **av)
if (STD_FUNCTIONAL_TEST) {
euid = geteuid();
-
pwent = getpwuid(euid);
- if (pwent == NULL) {
+ if (pwent == NULL)
tst_brkm(TBROK, cleanup, "geteuid() returned "
"unexpected value %d", euid);
- } else if (!GID_SIZE_CHECK(pwent->pw_gid)) {
- tst_brkm(TBROK,
- cleanup,
- "gid for euid %d is too large for testing getegid16",
- euid);
+
+ GID16_CHECK(pwent->pw_gid, getegid, cleanup);
+
+ if (pwent->pw_gid != TEST_RETURN) {
+ tst_resm(TFAIL, "getegid() return value"
+ " %ld unexpected - expected %d",
+ TEST_RETURN, pwent->pw_gid);
} else {
- if (pwent->pw_gid != TEST_RETURN) {
- tst_resm(TFAIL, "getegid() return value"
- " %ld unexpected - expected %d",
- TEST_RETURN, pwent->pw_gid);
- } else {
- tst_resm(TPASS,
- "effective group id %ld "
- "is correct", TEST_RETURN);
- }
+ tst_resm(TPASS,
+ "effective group id %ld "
+ "is correct", TEST_RETURN);
}
} else {
tst_resm(TPASS, "call succeeded");
}
}
- cleanup();
+ cleanup();
tst_exit();
}
-/*
- * setup() - performs all ONE TIME setup for this test
- */
-void setup()
+static void setup(void)
{
-
tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
TEST_PAUSE;
}
-/*
- * cleanup() - performs all the ONE TIME cleanup for this test at completion
- * or premature exit.
- */
-void cleanup()
+static void cleanup(void)
{
- /*
- * print timing status if that option was specified.
- * print errno log if that option was specified
- */
TEST_CLEANUP;
-
}
diff --git a/testcases/kernel/syscalls/geteuid/compat_16.h b/testcases/kernel/syscalls/geteuid/compat_16.h
deleted file mode 100644
index 9436cd5..0000000
--- a/testcases/kernel/syscalls/geteuid/compat_16.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Copyright (c) Red Hat Inc., 2009
- *
- * 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
- */
-
-/* Author: Masatake YAMATO <ya...@re...> */
-
-#ifndef __GETUID_COMPAT_16_H__
-#define __GETUID_COMPAT_16_H__
-
-
-#include "linux_syscall_numbers.h"
-#include "compat_uid.h"
-
-
-#ifdef TST_USE_COMPAT16_SYSCALL
-
-UID_T
-GETEUID(void)
-{
- return ltp_syscall(__NR_geteuid);
-}
-
-#else
-
-UID_T
-GETEUID(void)
-{
- return geteuid();
-}
-
-#endif
-
-#endif /* __GETUID_COMPAT_16_H__ */
diff --git a/testcases/kernel/syscalls/geteuid/geteuid01.c b/testcases/kernel/syscalls/geteuid/geteuid01.c
index 15d9a32..d6505b8 100644
--- a/testcases/kernel/syscalls/geteuid/geteuid01.c
+++ b/testcases/kernel/syscalls/geteuid/geteuid01.c
@@ -30,82 +30,11 @@
* http://oss.sgi.com/projects/GenInfo/NoticeExplan/
*
*/
-/* $Id: geteuid01.c,v 1.7 2009/10/26 16:02:46 subrata_modak Exp $ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : geteuid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for geteuid(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.) geteuid(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * 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 geteuid(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
- * geteuid(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 <errno.h>
@@ -114,17 +43,14 @@
#include "test.h"
#include "usctest.h"
-
#include "compat_16.h"
-void setup();
-void cleanup();
+static void setup(void);
+static void cleanup(void);
TCID_DEFINE(geteuid01);
int TST_TOTAL = 1;
-int exp_enos[] = { 0 }; /* must be a 0 terminated list */
-
int main(int ac, char **av)
{
int lc;
@@ -135,13 +61,11 @@ int main(int ac, char **av)
setup();
- TEST_EXP_ENOS(exp_enos);
-
for (lc = 0; TEST_LOOPING(lc); lc++) {
tst_count = 0;
- TEST(GETEUID());
+ TEST(GETEUID(cleanup));
if (TEST_RETURN < 0) {
tst_resm(TFAIL | TTERRNO, "geteuid failed");
@@ -153,20 +77,16 @@ int main(int ac, char **av)
}
cleanup();
-
tst_exit();
}
-void setup()
+static void setup(void)
{
-
tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
TEST_PAUSE;
}
-void cleanup()
+static void cleanup(void)
{
TEST_CLEANUP;
-
}
diff --git a/testcases/kernel/syscalls/getitimer/getitimer01.c b/testcases/kernel/syscalls/geteuid/geteuid02.c
similarity index 55%
copy from testcases/kernel/syscalls/getitimer/getitimer01.c
copy to testcases/kernel/syscalls/geteuid/geteuid02.c
index 5569a49..cf25621 100644
--- a/testcases/kernel/syscalls/getitimer/getitimer01.c
+++ b/testcases/kernel/syscalls/geteuid/geteuid02.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) International Business Machines Corp., 2001
+ * Ported by Wayne Boyer
*
* 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
@@ -16,41 +17,27 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*
- HISTORY
- 03/2001 - Written by Wayne Boyer
-
- TEST ITEMS:
- Check that a correct call to getitimer() succeeds.
-*/
+#include <pwd.h>
+#include <errno.h>
#include "test.h"
#include "usctest.h"
+#include "compat_16.h"
-#include <errno.h>
-#include <sys/time.h>
+TCID_DEFINE(geteuid02);
+int TST_TOTAL = 1;
-static void cleanup(void);
static void setup(void);
-
-char *TCID = "getitimer01";
-int TST_TOTAL = 3;
-
-static int itimer_name[] = {
- ITIMER_REAL,
- ITIMER_VIRTUAL,
- ITIMER_PROF,
-};
+static void cleanup(void);
int main(int ac, char **av)
{
+ struct passwd *pwent;
int lc;
- int i;
char *msg;
- struct itimerval value;
+ uid_t uid;
- msg = parse_opts(ac, av, NULL, NULL);
- if (msg != NULL)
+ if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
setup();
@@ -58,42 +45,38 @@ int main(int ac, char **av)
for (lc = 0; TEST_LOOPING(lc); lc++) {
tst_count = 0;
- for (i = 0; i < 3; i++) {
-
- TEST(getitimer(itimer_name[i], &value));
-
- if (TEST_RETURN != 0)
- tst_resm(TFAIL, "call failed - errno = %d - %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
-
- if (STD_FUNCTIONAL_TEST) {
-
- /*
- * Since ITIMER is effectively disabled (we did
- * not set it before the getitimer call), the
- * elements in it_value should be zero.
- */
- if ((value.it_value.tv_sec == 0) &&
- (value.it_value.tv_usec == 0)) {
- tst_resm(TPASS, "functionality is ok");
- } else {
- tst_resm(TFAIL, "timer are non zero");
- }
- } else {
- tst_resm(TPASS, "call succeeded");
- }
- }
+ TEST(GETEUID(cleanup));
+
+ if (TEST_RETURN == -1)
+ tst_brkm(TBROK | TTERRNO, cleanup, "geteuid* failed");
+
+ if (STD_FUNCTIONAL_TEST) {
+ uid = geteuid();
+ pwent = getpwuid(uid);
+
+ if (pwent == NULL)
+ tst_resm(TFAIL | TERRNO, "getpwuid failed");
+
+ UID16_CHECK(pwent->pw_uid, geteuid, cleanup);
+ if (pwent->pw_uid != TEST_RETURN)
+ tst_resm(TFAIL, "getpwuid value, %d, "
+ "does not match geteuid "
+ "value, %ld", pwent->pw_uid,
+ TEST_RETURN);
+ else
+ tst_resm(TPASS, "values from geteuid "
+ "and getpwuid match");
+ } else
+ tst_resm(TPASS, "call succeeded");
}
cleanup();
-
tst_exit();
}
static void setup(void)
{
tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
TEST_PAUSE;
}
diff --git a/testcases/kernel/syscalls/getgid/compat_16.h b/testcases/kernel/syscalls/getgid/compat_16.h
deleted file mode 100644
index 249e270..0000000
--- a/testcases/kernel/syscalls/getgid/compat_16.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *
- * Copyright (c) Red Hat Inc., 2008
- *
- * 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
- */
-
-/* Author: Masatake YAMATO <ya...@re...> */
-
-#ifndef __GETGID_COMPAT_16_H__
-#define __GETGID_COMPAT_16_H__
-
-
-#include "linux_syscall_numbers.h"
-#include "compat_gid.h"
-
-
-#ifdef TST_USE_COMPAT16_SYSCALL
-
-GID_T
-GETGID(void)
-{
- return ltp_syscall(__NR_getgid);
-}
-
-GID_T
-GETEGID(void)
-{
- return ltp_syscall(__NR_getegid);
-}
-
-#else
-
-GID_T
-GETGID(void)
-{
- return getgid();
-}
-
-GID_T
-GETEGID(void)
-{
- return getegid();
-}
-
-#endif
-
-#endif /* __GETGID_COMPAT_16_H__ */
diff --git a/testcases/kernel/syscalls/getgid/getgid01.c b/testcases/kernel/syscalls/getgid/getgid01.c
index 07b5bcd..6e3f64b 100644
--- a/testcases/kernel/syscalls/getgid/getgid01.c
+++ b/testcases/kernel/syscalls/getgid/getgid01.c
@@ -30,101 +30,27 @@
* http://oss.sgi.com/projects/GenInfo/NoticeExplan/
*
*/
-/* $Id: getgid01.c,v 1.7 2009/10/26 14:55:47 subrata_modak Exp $ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : getgid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for getgid(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.) getgid(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 getgid(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
- * getgid(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 <sys/fcntl.h>
#include <errno.h>
#include <signal.h>
#include <string.h>
+
#include "test.h"
#include "usctest.h"
#include "compat_16.h"
-void setup();
-void cleanup();
+static void setup(void);
+static void cleanup(void);
TCID_DEFINE(getgid01);
int TST_TOTAL = 1;
-int exp_enos[] = { 0, 0 };
+static int exp_enos[] = { 0, 0 };
int main(int ac, char **av)
{
@@ -142,7 +68,7 @@ int main(int ac, char **av)
tst_count = 0;
- TEST(GETGID());
+ TEST(GETGID(cleanup));
if (TEST_RETURN == -1)
tst_resm(TFAIL, "getgid failed");
@@ -158,16 +84,13 @@ int main(int ac, char **av)
tst_exit();
}
-void setup()
+static void setup(void)
{
-
tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
TEST_PAUSE;
}
-void cleanup()
+static void cleanup(void)
{
TEST_CLEANUP;
-
}
diff --git a/testcases/kernel/syscalls/getgid/getgid03.c b/testcases/kernel/syscalls/getgid/getgid03.c
index 35325d9..0d04ece 100644
--- a/testcases/kernel/syscalls/getgid/getgid03.c
+++ b/testcases/kernel/syscalls/getgid/getgid03.c
@@ -1,62 +1,27 @@
/*
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported by Wayne Boyer
*
- * 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 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.
*
- * 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
+ * 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
*/
/*
- * NAME
- * getgid03.c
- *
- * DESCRIPTION
- * Testcase to check the basic functionality of getgid().
- *
- * ALGORITHM
- * call setup
- * loop if that option was specified
- * Execute getgid() call using TEST macro
- * if not expected value
- * break remaining tests and cleanup
- * if STD_FUNCTIONAL_TEST
- * Execute getuid() call
- * Execute getpwduid() call
- * if the passwd entry is NULL
- * break the remaining tests and cleanup
- * else if pwent->pw_gid != TEST_RETURN
- * print failure message
- * else
- * print pass message
- * else
- * print pass message
- * call cleanup
- *
- * USAGE: <for command-line>
- * getgid03 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
- * where, -c n : Run n copies concurrently.
- * -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 Ported by Wayne Boyer
+ * Testcase to check the basic functionality of getgid().
*
- * RESTRICTIONS
- * none
+ * For functionality test the return value from getgid() is compared to passwd
+ * entry.
*/
#include <pwd.h>
@@ -64,11 +29,10 @@
#include "test.h"
#include "usctest.h"
-
#include "compat_16.h"
-void cleanup(void);
-void setup(void);
+static void cleanup(void);
+static void setup(void);
TCID_DEFINE(getgid03);
int TST_TOTAL = 1;
@@ -77,22 +41,18 @@ int main(int ac, char **av)
{
int lc;
char *msg;
- int uid;
+ uid_t uid;
struct passwd *pwent;
- if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) {
+ if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- }
- setup(); /* global setup */
+ setup();
- /* The following loop checks looping state if -i option given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
-
- /* reset tst_count in case we are looping */
tst_count = 0;
- TEST(GETGID());
+ TEST(GETGID(cleanup));
if (TEST_RETURN < 0) {
tst_brkm(TBROK, cleanup, "This should never happen");
@@ -102,54 +62,36 @@ int main(int ac, char **av)
uid = getuid();
pwent = getpwuid(uid);
- if (pwent == NULL) {
+ if (pwent == NULL)
tst_brkm(TBROK, cleanup, "getuid() returned "
"unexpected value %d", uid);
- } else if (!GID_SIZE_CHECK(pwent->pw_gid)) {
- tst_brkm(TBROK,
- cleanup,
- "gid for uid %d is too large for testing getgid16",
- uid);
+
+ GID16_CHECK(pwent->pw_gid, getgid, cleanup);
+
+ if (pwent->pw_gid != TEST_RETURN) {
+ tst_resm(TFAIL, "getgid() return value "
+ "%ld unexpected - expected %d",
+ TEST_RETURN, pwent->pw_gid);
} else {
- if (pwent->pw_gid != TEST_RETURN) {
- tst_resm(TFAIL, "getgid() return value "
- "%ld unexpected - expected %d",
- TEST_RETURN, pwent->pw_gid);
- } else {
- tst_resm(TPASS, "group id %ld returned "
- "correctly", TEST_RETURN);
- }
+ tst_resm(TPASS, "values from getuid "
+ "and getpwuid match");
}
} else {
tst_resm(TPASS, "call succeeded");
}
}
- cleanup();
+ cleanup();
tst_exit();
}
-/*
- * setup() - performs all ONE TIME setup for this test
- */
-void setup()
+static void setup(void)
{
-
tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
TEST_PAUSE;
}
-/*
- * cleanup() - performs all the ONE TIME cleanup for this test at completion
- * or premature exit.
- */
-void cleanup()
+static void cleanup(void)
{
- /*
- * print timing status if that option was specified.
- * print errno log if that option was specified
- */
TEST_CLEANUP;
-
}
diff --git a/testcases/kernel/syscalls/getuid/compat_16.h b/testcases/kernel/syscalls/getuid/compat_16.h
deleted file mode 100644
index db6f332..0000000
--- a/testcases/kernel/syscalls/getuid/compat_16.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *
- * Copyright (c) Red Hat Inc., 2008
- *
- * 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
- */
-
-/* Author: Masatake YAMATO <ya...@re...> */
-
-#ifndef __GETUID_COMPAT_16_H__
-#define __GETUID_COMPAT_16_H__
-
-
-#include "linux_syscall_numbers.h"
-#include "compat_uid.h"
-
-
-#ifdef TST_USE_COMPAT16_SYSCALL
-
-UID_T
-GETUID(void)
-{
- return ltp_syscall(__NR_getuid);
-}
-
-UID_T
-GETEUID(void)
-{
- return ltp_syscall(__NR_geteuid);
-}
-
-#else
-
-UID_T
-GETUID(void)
-{
- return getuid();
-}
-
-UID_T
-GETEUID(void)
-{
- return geteuid();
-}
-
-#endif
-
-#endif /* __GETUID_COMPAT_16_H__ */
diff --git a/testcases/kernel/syscalls/getuid/getuid01.c b/testcases/kernel/syscalls/getuid/getuid01.c
index 4c2d65c..a9d508f 100644
--- a/testcases/kernel/syscalls/getuid/getuid01.c
+++ b/testcases/kernel/syscalls/getuid/getuid01.c
@@ -28,103 +28,28 @@
* For further information regarding this notice, see:
*
* http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
*/
-/* $Id: getuid01.c,v 1.9 2009/10/26 14:55:47 subrata_modak Exp $ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : getuid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for getuid(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.) getuid(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 getuid(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
- * getuid(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 <sys/fcntl.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
+
#include "test.h"
#include "usctest.h"
#include "compat_16.h"
-void setup();
-void cleanup();
+static void setup(void);
+static void cleanup(void);
TCID_DEFINE(getuid01);
int TST_TOTAL = 1;
-int exp_enos[] = { 0, 0 };
+static int exp_enos[] = { 0, 0 };
int main(int ac, char **av)
{
@@ -142,7 +67,7 @@ int main(int ac, char **av)
tst_count = 0;
- TEST(GETUID());
+ TEST(GETUID(cleanup));
if (TEST_RETURN == -1)
tst_resm(TFAIL | TTERRNO, "getuid failed");
@@ -155,15 +80,13 @@ int main(int ac, char **av)
tst_exit();
}
-void setup()
+static void setup(void)
{
-
tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
TEST_PAUSE;
}
-void cleanup()
+static void cleanup(void)
{
TEST_CLEANUP;
}
diff --git a/testcases/kernel/syscalls/getuid/getuid02.c b/testcases/kernel/syscalls/getuid/getuid02.c
deleted file mode 100644
index 27a24e0..0000000
--- a/testcases/kernel/syscalls/getuid/getuid02.c
+++ /dev/null
@@ -1,112 +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
- */
-
-/*
- * NAME
- * getuid02.c
- *
- * DESCRIPTION
- * Testcase to check the basic functionality of the geteuid() system call.
- *
- * USAGE: <for command-line>
- * getuid02 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
- * where, -c n : Run n copies concurrently.
- * -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 Ported by Wayne Boyer
- *
- * RESTRICTIONS
- * None
- */
-
-#include <pwd.h>
-#include <errno.h>
-#include "test.h"
-#include "usctest.h"
-#include "compat_16.h"
-
-TCID_DEFINE(getuid02);
-int TST_TOTAL = 1;
-
-void setup(void);
-void cleanup(void);
-
-int main(int ac, char **av)
-{
- struct passwd *pwent;
- int lc;
- char *msg; /* message returned by parse_opts */
-
- if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
-
- setup();
-
- for (lc = 0; TEST_LOOPING(lc); lc++) {
- tst_count = 0;
-
- TEST(GETEUID());
-
- if (TEST_RETURN == -1)
- tst_brkm(TBROK | TTERRNO, cleanup, "geteuid* failed");
-
- if (STD_FUNCTIONAL_TEST) {
-
- pwent = getpwuid(TEST_RETURN);
- if (pwent == NULL)
- tst_resm(TFAIL | TERRNO, "getpwuid failed");
- else if (!UID_SIZE_CHECK(pwent->pw_uid))
- tst_brkm(TBROK, cleanup,
- "uid = %ld is too large for testing "
- "via geteuid16", TEST_RETURN);
- else {
- if (pwent->pw_uid != TEST_RETURN)
- tst_resm(TFAIL, "getpwuid value, %d, "
- "does not match geteuid "
- "value, %ld", pwent->pw_uid,
- TEST_RETURN);
- else
- tst_resm(TPASS, "values from geteuid "
- "and getpwuid match");
- }
- } else
- tst_resm(TPASS, "call succeeded");
- }
- cleanup();
- tst_exit();
-
-}
-
-void setup()
-{
-
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- TEST_PAUSE;
-}
-
-void cleanup()
-{
- TEST_CLEANUP;
-}
diff --git a/testcases/kernel/syscalls/getuid/getuid03.c b/testcases/kernel/syscalls/getuid/getuid03.c
index a5fd7f1..5240f55 100644
--- a/testcases/kernel/syscalls/getuid/getuid03.c
+++ b/testcases/kernel/syscalls/getuid/getuid03.c
@@ -1,47 +1,32 @@
/*
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported by Wayne Boyer
*
- * 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 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.
*
- * 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
+ * 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
*/
/*
- * NAME
- * getuid03.c
- *
- * DESCRIPTION
- * Testcase to check the basic functionality of the getuid() system call.
- *
- * USAGE: <for command-line>
- * getuid03 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
- * where, -c n : Run n copies concurrently.
- * -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.
+ * Testcase to check the basic functionality of the getuid() system call.
*
- * HISTORY
- * 07/2001 Ported by Wayne Boyer
- *
- * RESTRICTIONS
- * None
+ * For functionality test the return value from getgid() is compared to passwd
+ * entry.
*/
#include <pwd.h>
#include <errno.h>
+
#include "test.h"
#include "usctest.h"
#include "compat_16.h"
@@ -49,14 +34,15 @@
TCID_DEFINE(getuid03);
int TST_TOTAL = 1;
-void setup(void);
-void cleanup(void);
+static void setup(void);
+static void cleanup(void);
int main(int ac, char **av)
{
struct passwd *pwent;
int lc;
- char *msg; /* message returned by parse_opts */
+ char *msg;
+ uid_t uid;
if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
@@ -67,29 +53,28 @@ int main(int ac, char **av)
tst_count = 0;
- TEST(GETUID());
+ TEST(GETUID(cleanup));
if (TEST_RETURN == -1)
tst_brkm(TBROK | TTERRNO, cleanup, "getuid failed");
if (STD_FUNCTIONAL_TEST) {
- pwent = getpwuid(TEST_RETURN);
+ uid = getuid();
+ pwent = getpwuid(uid);
+
if (pwent == NULL)
tst_resm(TFAIL | TERRNO, "getpwuid failed");
- else if (!UID_SIZE_CHECK(pwent->pw_uid))
- tst_brkm(TBROK, cleanup,
- "uid = %ld is too large for testing "
- "getuid16", TEST_RETURN);
- else {
- if (pwent->pw_uid != TEST_RETURN)
- tst_resm(TFAIL, "getpwuid value, %d, "
- "does not match getuid "
- "value, %ld", pwent->pw_uid,
- TEST_RETURN);
- else
- tst_resm(TPASS, "values from getuid "
- "and getpwuid match");
- }
+
+ UID16_CHECK(pwent->pw_uid, getuid, cleanup);
+
+ if (pwent->pw_uid != TEST_RETURN)
+ tst_resm(TFAIL, "getpwuid value, %d, "
+ "does not match getuid "
+ "value, %ld", pwent->pw_uid,
+ TEST_RETURN);
+ else
+ tst_resm(TPASS, "values from getuid "
+ "and getpwuid match");
} else
tst_resm(TPASS, "call succeeded");
}
@@ -97,15 +82,14 @@ int main(int ac, char **av)
tst_exit();
}
-void setup()
+static void setup(void)
{
-
tst_sig(NOFORK, DEF_HANDLER, cleanup);
TEST_PAUSE;
}
-void cleanup()
+static void cleanup(void)
{
TEST_CLEANUP;
}
diff --git a/testcases/kernel/syscalls/setgid/compat_16.h b/testcases/kernel/syscalls/setgid/compat_16.h
deleted file mode 100644
index 9d1d15c..0000000
--- a/testcases/kernel/syscalls/setgid/compat_16.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *
- * Copyright (c) Red Hat Inc., 2008
- *
- * 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
- */
-
-/* Author: Masatake YAMATO <ya...@re...> */
-
-#ifndef __SETGID_COMPAT_16_H__
-#define __SETGID_COMPAT_16_H__
-
-
-#include "linux_syscall_numbers.h"
-#include "compat_gid.h"
-
-
-#ifdef TST_USE_COMPAT16_SYSCALL
-
-int
-SETGID(GID_T gid)
-{
- return ltp_syscall(__NR_setgid, gid);
-}
-
-GID_T
-GETGID(void)
-{
- gid_t gid;
-
- gid = getgid();
- if (!GID_SIZE_CHECK(gid))
- tst_brkm(TBROK,
- cleanup,
- "gid for the current process is too large for testing setgid16");
-
- return (GID_T)gid;
-}
-
-#else
-
-int
-SETGID(GID_T gid)
-{
- return setgid(gid);
-}
-
-GID_T
-GETGID(void)
-{
- return getgid();
-}
-
-#endif
-
-#endif /* __SETGID_COMPAT_16_H__ */
diff --git a/testcases/kernel/syscalls/setgid/setgid01.c b/testcases/kernel/syscalls/setgid/setgid01.c
index 9121e47..9a701a2 100644
--- a/testcases/kernel/syscalls/setgid/setgid01.c
+++ b/testcases/kernel/syscalls/setgid/setgid01.c
@@ -30,143 +30,50 @@
* http://oss.sgi.com/projects/GenInfo/NoticeExplan/
*
*/
-/* $Id: setgid01.c,v 1.9 2009/11/02 13:57:18 subrata_modak Exp $ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : setgid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for setgid(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.) setgid(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 setgid(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
- * setgid(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 <errno.h>
#include <string.h>
#include <signal.h>
+
#include "test.h"
#include "usctest.h"
-
-static void setup();
-static void cleanup();
-
#include "compat_16.h"
+static void setup(void);
+static void cleanup(void);
+
TCID_DEFINE(setgid01);
int TST_TOTAL = 1;
-int exp_enos[] = { 0, 0 };
+static int exp_enos[] = { 0, 0 };
-GID_T gid;
+static gid_t gid;
int main(int ac, char **av)
{
int lc;
char *msg;
- /***************************************************************
- * parse standard options
- ***************************************************************/
if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
setup();
- /* set the expected errnos... */
TEST_EXP_ENOS(exp_enos);
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
for (lc = 0; TEST_LOOPING(lc); lc++) {
-
tst_count = 0;
- /*
- * Call setgid(2)
- */
- TEST(SETGID(gid));
+ TEST(SETGID(cleanup, gid));
- /* check return code */
if (TEST_RETURN == -1) {
TEST_ERROR_LOG(TEST_ERRNO);
tst_resm(TFAIL, "setgid(%d) Failed, errno=%d : %s", gid,
TEST_ERRNO, strerror(TEST_ERRNO));
} else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
if (STD_FUNCTIONAL_TEST) {
/* No Verification test, yet... */
tst_resm(TPASS, "setgid(%d) returned %ld", gid,
@@ -176,38 +83,21 @@ int main(int ac, char **av)
}
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
cleanup();
tst_exit();
- tst_exit();
-
}
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void setup()
+static void setup(void)
{
-
tst_sig(NOFORK, DEF_HANDLER, cleanup);
TEST_PAUSE;
- gid = GETGID();
+ gid = getgid();
+ GID16_CHECK(gid, setgid, cleanup);
}
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void cleanup()
+static void cleanup(void)
{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
TEST_CLEANUP;
-
}
diff --git a/testcases/kernel/syscalls/setgid/setgid02.c b/testcases/kernel/syscalls/setgid/setgid02.c
index f3894b1..352d1cd 100644
--- a/testcases/kernel/syscalls/setgid/setgid02.c
+++ b/testcases/kernel/syscalls/setgid/setgid02.c
@@ -1,85 +1,63 @@
/*
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported by Wayne Boyer
*
- * 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 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.
*
- * 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
+ * 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
*/
/*
- * NAME
- * setgid02.c
- *
- * DESCRIPTION
- * Testcase to ensure that the setgid() system call sets errno to EPERM
+ * Testcase to ensure that the setgid() system call sets errno to EPERM
*
* ALGORITHM
* Call setgid() to set the gid to that of root. Run this test as
* ltpuser1, and expect to get EPERM
- *
- * USAGE: <for command-line>
- * setgid02 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
- * where, -c n : Run n copies concurrently.
- * -e : Turn on errno logging.
- * -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 Ported by Wayne Boyer
- *
- * RESTRICTIONS
- * Must be run as a nonroot user
*/
#include <pwd.h>
#include <errno.h>
+
#include "test.h"
#include "usctest.h"
+#include "compat_16.h"
TCID_DEFINE(setgid02);
int TST_TOTAL = 1;
-char root[] = "root";
-char nobody_uid[] = "nobody";
-char nobody_gid[] = "nobody";
-struct passwd *ltpuser;
+static char root[] = "root";
+static char nobody_uid[] = "nobody";
+static char nobody_gid[] = "nobody";
+static struct passwd *ltpuser;
static void setup(void);
static void cleanup(void);
-#include "compat_16.h"
-
-int exp_enos[] = { EPERM, 0 };
+static int exp_enos[] = { EPERM, 0 };
int main(int ac, char **av)
{
struct passwd *getpwnam(), *rootpwent;
-
int lc;
- char *msg; /* message returned by parse_opts */
+ char *msg;
- if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) {
+ if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- }
setup();
TEST_EXP_ENOS(exp_enos);
for (lc = 0; TEST_LOOPING(lc); lc++) {
- /* reset tst_count in case we are looping */
tst_count = 0;
if ((rootpwent = getpwnam(root)) == NULL) {
@@ -87,14 +65,9 @@ int main(int ac, char **av)
"%s", root);
}
- if (!GID_SIZE_CHECK(rootpwent->pw_gid)) {
- tst_brkm(TBROK,
- cleanup,
- "gid for `%s' is too large for testing setgid16",
- root);
- }
+ GID16_CHECK(rootpwent->pw_gid, setgid, cleanup);
- TEST(SETGID(rootpwent->pw_gid));
+ TEST(SETGID(cleanup, rootpwent->pw_gid));
if (TEST_RETURN != -1) {
tst_resm(TFAIL, "call succeeded unexpectedly");
@@ -110,29 +83,20 @@ int main(int ac, char **av)
tst_resm(TPASS, "setgid returned EPERM");
}
}
+
cleanup();
tst_exit();
- tst_exit();
-
}
-/*
- * setup() - performs all ONE TIME setup for this test.
- */
-void setup()
+static void setup(void)
{
-/* Switch to nobody user for correct error code collection */
- if (geteuid() != 0) {
- tst_brkm(TBROK, NULL, "Test must be run as root");
- }
- ltpuser = getpwnam(nobody_uid);
+ tst_require_root(NULL);
- if (!GID_SIZE_CHECK(ltpuser->pw_gid)) {
- tst_brkm(TBROK,
- cleanup,
- "gid for `%s' is too large for testing setgid16",
- nobody_gid);
- }
+ /* Switch to nobody user for correct error code collection */
+ ltpuser = getpwnam(nobody_uid);
+ if (ltpuser == NULL)
+ tst_brkm(TBROK, cleanup, "getpwnam failed for user id %s",
+ nobody_uid);
if (setgid(ltpuser->pw_gid) == -1) {
tst_resm(TINFO, "setgid failed to "
@@ -151,16 +115,7 @@ void setup()
TEST_PAUSE;
}
-/*
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- */
-void cleanup()
+static void cleanup(void)
{
- ...
[truncated message content] |