getgid test cases are enhanced to support getgid16.
BTW, See getgid02.c. For me it doesn't test getgid but getegid.
I wonder why it is in getgid directory. I think it should be in
getegid directory. Am I missing something?
Signed-off-by: Masatake YAMATO <[EMAIL PROTECTED]>
diff --git a/testcases/kernel/syscalls/getgid/Makefile
b/testcases/kernel/syscalls/getgid/Makefile
index 6706403..2067f28 100644
--- a/testcases/kernel/syscalls/getgid/Makefile
+++ b/testcases/kernel/syscalls/getgid/Makefile
@@ -16,11 +16,13 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
-CFLAGS += -I../../../../include -Wall
+CFLAGS += -I../../../../include -I../utils -Wall
LDLIBS += -L../../../../lib -lltp
+include ../utils/compat_16.mk
+
SRCS = $(wildcard *.c)
-TARGETS = $(patsubst %.c,%,$(SRCS))
+TARGETS += $(patsubst %.c,%,$(SRCS))
all: $(TARGETS)
diff --git a/testcases/kernel/syscalls/getgid/compat_16.h
b/testcases/kernel/syscalls/getgid/compat_16.h
new file mode 100644
index 0000000..0958073
--- /dev/null
+++ b/testcases/kernel/syscalls/getgid/compat_16.h
@@ -0,0 +1,60 @@
+/*
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Author: Masatake YAMATO <[EMAIL PROTECTED]> */
+
+#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 syscall(__NR_getgid);
+}
+
+GID_T
+GETEGID(void)
+{
+ return 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 8ad1140..a5b9e66 100644
--- a/testcases/kernel/syscalls/getgid/getgid01.c
+++ b/testcases/kernel/syscalls/getgid/getgid01.c
@@ -116,13 +116,14 @@
#include <signal.h>
#include "test.h"
#include "usctest.h"
+#include "compat_16.h"
void setup();
void cleanup();
-char *TCID="getgid01"; /* Test program identifier. */
+TCID_DEFINE(getgid01); /* Test program identifier. */
int TST_TOTAL=1; /* Total number of test cases. */
extern int Tst_count; /* Test Case counter for tst_* routines */
@@ -159,7 +160,7 @@ main(int ac, char **av)
/*
* Call getgid(2)
*/
- TEST(getgid());
+ TEST(GETGID());
/* check return code */
if ( TEST_RETURN == -1 ) {
diff --git a/testcases/kernel/syscalls/getgid/getgid02.c
b/testcases/kernel/syscalls/getgid/getgid02.c
index fb5ac66..304ade6 100644
--- a/testcases/kernel/syscalls/getgid/getgid02.c
+++ b/testcases/kernel/syscalls/getgid/getgid02.c
@@ -65,10 +65,12 @@
#include "test.h"
#include "usctest.h"
+#include "compat_16.h"
+
void cleanup(void);
void setup(void);
-char *TCID= "getgid02";
+TCID_DEFINE(getgid02);
int TST_TOTAL = 1;
extern int Tst_count;
@@ -93,7 +95,7 @@ int main(int ac, char **av)
/* reset Tst_count in case we are looping */
Tst_count = 0;
- TEST(getegid());
+ TEST(GETEGID());
if (TEST_RETURN < 0) {
tst_brkm(TBROK, cleanup, "This should never happen");
@@ -107,6 +109,11 @@ int main(int ac, char **av)
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);
} else {
if (pwent->pw_gid != TEST_RETURN) {
tst_resm(TFAIL, "getegid() return value"
diff --git a/testcases/kernel/syscalls/getgid/getgid03.c
b/testcases/kernel/syscalls/getgid/getgid03.c
index 20a04b6..78a0e4f 100644
--- a/testcases/kernel/syscalls/getgid/getgid03.c
+++ b/testcases/kernel/syscalls/getgid/getgid03.c
@@ -65,10 +65,12 @@
#include "test.h"
#include "usctest.h"
+#include "compat_16.h"
+
void cleanup(void);
void setup(void);
-char *TCID= "getgid03";
+TCID_DEFINE(getgid03);
int TST_TOTAL = 1;
extern int Tst_count;
@@ -93,7 +95,7 @@ int main(int ac, char **av)
/* reset Tst_count in case we are looping */
Tst_count = 0;
- TEST(getgid());
+ TEST(GETGID());
if (TEST_RETURN < 0) {
tst_brkm(TBROK, cleanup, "This should never happen");
@@ -106,6 +108,11 @@ int main(int ac, char **av)
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);
} else {
if (pwent->pw_gid != TEST_RETURN) {
tst_resm(TFAIL, "getgid() return value "
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list