Michael,
Would you like to review Ramon´s test cases on get_robust_list() and
set_robust_list() ?
Hi Ramon,
Here are my small observations of the patch:
1) You have disabled compiling the testcases: get_robust_list01.c and
set_robust01.c through ltp/testcases/kernel/syscalls/Makefile. I am not
sure what purpose does it serve in adding the syscall tests when you do
not want to compile/install/run them. And also a entry for both
get_robust_list01 and set_robust list01 is missing from
runtest/syscalls. I hope in your next patch you will compile this by
deafult and also include an entry to run them along with other syscalls.
I enabled the test cases to build/install and run, and following are my
observations when i ran them across some architectures:
1) Linux 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:12 EDT 2008 i686 i686
i386 GNU/Linux
BUILD=PASS, INSTALL=PASS, RUN=PASS
2) Linux 2.6.18-91.el5 #1 SMP Tue Apr 22 17:43:57 EDT 2008 x86_64 x86_64
x86_64 GNU/Linux
BUILD=PASS, INSTALL=PASS, RUN=PASS
3) Linux 2.6.18-91.el5 #1 SMP Tue Apr 22 17:48:59 EDT 2008 ppc64 ppc64
ppc64 GNU/Linux
BUILD=PASS, INSTALL=PASS, RUN=PASS
4) Linux 2.6.25-gcov-nomodconfig-smp #1 SMP Thu Jun 12 06:29:27 EDT 2008
i686 i686 i386 GNU/Linux
BUILD=FAIL,
5) Linux 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:32:02 EDT 2006 x86_64
x86_64 x86_64 GNU/Linux
BUILD=FAIL
6) Linux 2.6.9-42.EL #1 SMP Wed Jul 12 23:22:51 EDT 2006 ppc64 ppc64
ppc64 GNU/Linux
BUILD=FAIL
7) Linux 2.6.16.21-0.8-default #1 SMP Mon Jul 3 18:25:39 UTC 2006 ia64
ia64 ia64 GNU/Linux
BUILD=FAIL
Following are the error messages when they failed:
cc -Wall -I../../include -g -Wall -I../../../../include -Wall
get_robust_list01.c -L../../../../lib -lltp -o get_robust_list01
get_robust_list01.c: In function ‘main’:
get_robust_list01.c:75: error: storage size of ‘head’ isn’t known
get_robust_list01.c:87: error: invalid application of ‘sizeof’ to
incomplete type ‘struct robust_list_head’
get_robust_list01.c:100: error: ‘__NR_get_robust_list’ undeclared (first
use in this function)
get_robust_list01.c:100: error: (Each undeclared identifier is reported
only once
get_robust_list01.c:100: error: for each function it appears in.)
get_robust_list01.c:75: warning: unused variable ‘head’
make[4]: *** [get_robust_list01] Error 1
cc -Wall -I../../include -g -Wall -I../../../../include -Wall
set_robust_list01.c -L../../../../lib -lltp -o set_robust_list01
set_robust_list01.c: In function ‘main’:
set_robust_list01.c:75: error: storage size of ‘head’ isn’t known
set_robust_list01.c:87: error: invalid application of ‘sizeof’ to
incomplete type ‘struct robust_list_head’
set_robust_list01.c:97: error: ‘__NR_set_robust_list’ undeclared (first
use in this function)
set_robust_list01.c:97: error: (Each undeclared identifier is reported
only once
set_robust_list01.c:97: error: for each function it appears in.)
set_robust_list01.c:75: warning: unused variable ‘head’
make[4]: *** [set_robust_list01] Error 1
I think you need to include some code which handles stuff like
header/library/support checking in the Makefile, so that it aborts
compilation and hence install due to lack of this.
But in all instances you should be able to showup proper message(s) to
the user when your test cases is not compiled/installed, but is run
(this will definitely happen when executing runtest/syscalls). You may
want to see the following thread how Vijay has handled it in his
move_pages() syscall tests.
Hope to see an updated patch from you soon.
Regards--
Subrata
-------- Forwarded Message --------
From: Ramon de Carvalho Valle <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: ltp-list@lists.sourceforge.net
Subject: [LTP] [PATCH] New testcases for get_robust_list and
set_robust_list system calls
Date: Fri, 25 Jul 2008 16:23:56 -0300
Hi,
The attached patch contains new testcases for get_robust_list and
set_robust_list system calls.
Best regards,
-------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
diff -urN ltp-intermediate-20080717.original/testcases/kernel/syscalls/get_robust_list/get_robust_list01.c ltp-intermediate-20080717/testcases/kernel/syscalls/get_robust_list/get_robust_list01.c
--- ltp-intermediate-20080717.original/testcases/kernel/syscalls/get_robust_list/get_robust_list01.c 1969-12-31 19:00:00.000000000 -0500
+++ ltp-intermediate-20080717/testcases/kernel/syscalls/get_robust_list/get_robust_list01.c 2008-07-25 05:45:06.000000000 -0400
@@ -0,0 +1,239 @@
+/*
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * Test Name: get_robust_list01
+ *
+ * Test Description:
+ * Verify that get_robust_list() returns the proper errno for various failure
+ * cases
+ *
+ * Usage: <for command-line>
+ * get_robust_list01 [-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/2008 Ramon de Carvalho Valle <[EMAIL PROTECTED]>
+ * -Created
+ *
+ * Restrictions:
+ * None.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <sys/syscall.h>
+#include <asm/types.h> /* needed because of u32 in futex.h */
+#ifndef u32
+typedef unsigned int u32;
+#endif
+#include <sys/types.h>
+#include <linux/futex.h>
+
+#include "test.h"
+#include "usctest.h"
+
+extern int Tst_count; /* counter for tst_xxx routines. */
+
+char *TCID = "get_robust_list01"; /* test program identifier. */
+int TST_TOTAL = 5; /* total number of tests in this file. */
+
+int exp_enos[] = {ESRCH, EPERM, EFAULT, 0};
+
+void setup(void);
+void cleanup(void);
+
+int
+main(int argc, char **argv)
+{
+ int lc; /* loop counter */
+ char *msg; /* message returned from parse_opts */
+ struct robust_list_head head;
+ size_t len_ptr; /* size of structure struct robust_list_head */
+ int retval;
+
+ msg = parse_opts(argc, argv, (option_t *) NULL, NULL);
+ if (msg != (char *) NULL) {
+ tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+ tst_exit();
+ }
+
+ setup();
+
+ len_ptr = sizeof(struct robust_list_head);
+
+ for (lc = 0; TEST_LOOPING(lc); ++lc) {
+ Tst_count = 0;
+
+ /*
+ * The get_robust_list function fails with EFAULT if the size of the
+ * struct robust_list_head can't be stored in the memory address space
+ * specified by len_ptr argument, or the head of the robust list can't
+ * be stored in the memory address space specified by the head_ptr
+ * argument.
+ */
+
+ TEST(retval = syscall(__NR_get_robust_list, 0,
+ (struct robust_list_head *)&head, (size_t *)NULL));
+
+ if (TEST_RETURN) {
+ if (TEST_ERRNO == EFAULT)
+ tst_resm(TPASS, "get_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, -1, TEST_ERRNO, EFAULT);
+ else
+ tst_resm(TFAIL, "get_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, -1, TEST_ERRNO, EFAULT);
+ }
+ else {
+ tst_resm(TFAIL, "get_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, -1, TEST_ERRNO, EFAULT);
+ }
+
+ TEST(retval = syscall(__NR_get_robust_list, 0,
+ (struct robust_list_head **)NULL, &len_ptr));
+
+ if (TEST_RETURN) {
+ if (TEST_ERRNO == EFAULT)
+ tst_resm(TPASS, "get_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, -1, TEST_ERRNO, EFAULT);
+ else
+ tst_resm(TFAIL, "get_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, -1, TEST_ERRNO, EFAULT);
+ }
+ else {
+ tst_resm(TFAIL, "get_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, -1, TEST_ERRNO, EFAULT);
+ }
+
+ /*
+ * The get_robust_list function fails with ESRCH if it can't find the
+ * task specified by the pid argument. The value 65535 is used as the
+ * pid argument.
+ */
+
+ TEST(retval = syscall(__NR_get_robust_list, 65535,
+ (struct robust_list_head *)&head, &len_ptr));
+
+ if (TEST_RETURN) {
+ if (TEST_ERRNO == ESRCH)
+ tst_resm(TPASS, "get_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, -1, TEST_ERRNO, ESRCH);
+ else
+ tst_resm(TFAIL, "get_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, -1, TEST_ERRNO, ESRCH);
+ }
+ else {
+ tst_resm(TFAIL, "get_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, -1, TEST_ERRNO, ESRCH);
+ }
+
+ /*
+ * The get_robust_list function fails with EPERM if it has no
+ * permission to access the task specified by the pid argument.
+ * The current user id of the process is changed to 1 (bin), and the
+ * value of 1 (init) is used as the pid argument.
+ */
+
+ /*
+ * Temporarily drop root privleges.
+ */
+ seteuid(1);
+
+ TEST(retval = syscall(__NR_get_robust_list, 1,
+ (struct robust_list_head *)&head, &len_ptr));
+
+ if (TEST_RETURN) {
+ if (TEST_ERRNO == EPERM)
+ tst_resm(TPASS, "get_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, -1, TEST_ERRNO, EPERM);
+ else
+ tst_resm(TFAIL, "get_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, -1, TEST_ERRNO, EPERM);
+ }
+ else {
+ tst_resm(TFAIL, "get_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, -1, TEST_ERRNO, EPERM);
+ }
+
+ /*
+ * Regain root privileges.
+ */
+ seteuid(0);
+
+ /*
+ * This call to get_robust_list function should be sucessful.
+ */
+
+ TEST(retval = syscall(__NR_get_robust_list, 0,
+ (struct robust_list_head **)&head, &len_ptr));
+
+ if (TEST_RETURN == 0) {
+ tst_resm(TPASS, "get_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, 0, TEST_ERRNO, 0);
+ }
+ else {
+ tst_resm(TFAIL, "get_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, 0, TEST_ERRNO, 0);
+ }
+
+ }
+
+ cleanup();
+
+ exit(EXIT_SUCCESS);
+}
+
+void
+setup(void)
+{
+ TEST_EXP_ENOS(exp_enos);
+
+ TEST_PAUSE;
+}
+
+void
+cleanup(void)
+{
+ TEST_CLEANUP;
+
+ tst_exit();
+}
+
diff -urN ltp-intermediate-20080717.original/testcases/kernel/syscalls/get_robust_list/Makefile ltp-intermediate-20080717/testcases/kernel/syscalls/get_robust_list/Makefile
--- ltp-intermediate-20080717.original/testcases/kernel/syscalls/get_robust_list/Makefile 1969-12-31 19:00:00.000000000 -0500
+++ ltp-intermediate-20080717/testcases/kernel/syscalls/get_robust_list/Makefile 2008-07-25 05:45:06.000000000 -0400
@@ -0,0 +1,31 @@
+#
+# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+CFLAGS += -I../../../../include -Wall
+LDLIBS += -L../../../../lib -lltp
+
+SRCS = $(wildcard *.c)
+TARGETS = $(patsubst %.c,%,$(SRCS))
+
+all: $(TARGETS)
+
+install:
+ @set -e; for i in $(TARGETS); do ln -f $$i ../../../bin/$$i ; done
+
+clean:
+ rm -f $(TARGETS)
diff -urN ltp-intermediate-20080717.original/testcases/kernel/syscalls/Makefile ltp-intermediate-20080717/testcases/kernel/syscalls/Makefile
--- ltp-intermediate-20080717.original/testcases/kernel/syscalls/Makefile 2008-07-17 10:15:58.000000000 -0400
+++ ltp-intermediate-20080717/testcases/kernel/syscalls/Makefile 2008-07-25 08:47:42.000000000 -0400
@@ -25,7 +25,7 @@
#
# Commented this out since there are directories here we don't want built by default
#
-SUBDIR = `ls */Makefile | sed "s/Makefile//g" | grep -v epoll`
+SUBDIR = `ls */Makefile | sed "s/Makefile//g" | grep -vE "^epoll|get_robust_list|set_robust_list"`
UCLINUX_SUBDIR = `ls */Makefile | sed "s/Makefile//g" | grep -vE "^fork|epoll|capget|capset|chmod|chown|llseek|nftw|clone|profil|getcontext"`
all:
diff -urN ltp-intermediate-20080717.original/testcases/kernel/syscalls/set_robust_list/Makefile ltp-intermediate-20080717/testcases/kernel/syscalls/set_robust_list/Makefile
--- ltp-intermediate-20080717.original/testcases/kernel/syscalls/set_robust_list/Makefile 1969-12-31 19:00:00.000000000 -0500
+++ ltp-intermediate-20080717/testcases/kernel/syscalls/set_robust_list/Makefile 2008-07-25 05:45:06.000000000 -0400
@@ -0,0 +1,31 @@
+#
+# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+CFLAGS += -I../../../../include -Wall
+LDLIBS += -L../../../../lib -lltp
+
+SRCS = $(wildcard *.c)
+TARGETS = $(patsubst %.c,%,$(SRCS))
+
+all: $(TARGETS)
+
+install:
+ @set -e; for i in $(TARGETS); do ln -f $$i ../../../bin/$$i ; done
+
+clean:
+ rm -f $(TARGETS)
diff -urN ltp-intermediate-20080717.original/testcases/kernel/syscalls/set_robust_list/set_robust_list01.c ltp-intermediate-20080717/testcases/kernel/syscalls/set_robust_list/set_robust_list01.c
--- ltp-intermediate-20080717.original/testcases/kernel/syscalls/set_robust_list/set_robust_list01.c 1969-12-31 19:00:00.000000000 -0500
+++ ltp-intermediate-20080717/testcases/kernel/syscalls/set_robust_list/set_robust_list01.c 2008-07-25 05:45:06.000000000 -0400
@@ -0,0 +1,154 @@
+/*
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * Test Name: set_robust_list01
+ *
+ * Test Description:
+ * Verify that set_robust_list() returns the proper errno for various failure
+ * cases
+ *
+ * Usage: <for command-line>
+ * set_robust_list01 [-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/2008 Ramon de Carvalho Valle <[EMAIL PROTECTED]>
+ * -Created
+ *
+ * Restrictions:
+ * None.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <sys/syscall.h>
+#include <asm/types.h> /* needed because of u32 in futex.h */
+#ifndef u32
+typedef unsigned int u32;
+#endif
+#include <sys/types.h>
+#include <linux/futex.h>
+
+#include "test.h"
+#include "usctest.h"
+
+extern int Tst_count; /* counter for tst_xxx routines. */
+
+char *TCID = "set_robust_list01"; /* test program identifier. */
+int TST_TOTAL = 2; /* total number of tests in this file. */
+
+int exp_enos[] = {EINVAL, 0};
+
+void setup(void);
+void cleanup(void);
+
+int
+main(int argc, char **argv)
+{
+ int lc; /* loop counter */
+ char *msg; /* message returned from parse_opts */
+ struct robust_list_head head;
+ size_t len; /* size of structure struct robust_list_head */
+ int retval;
+
+ msg = parse_opts(argc, argv, (option_t *) NULL, NULL);
+ if (msg != (char *) NULL) {
+ tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+ tst_exit();
+ }
+
+ setup();
+
+ len = sizeof(struct robust_list_head);
+
+ for (lc = 0; TEST_LOOPING(lc); ++lc) {
+ Tst_count = 0;
+
+ /*
+ * The set_robust_list function fails with EINVAL if the len argument
+ * doesn't match the size of structure struct robust_list_head.
+ */
+
+ TEST(retval = syscall(__NR_set_robust_list, &head, -1));
+
+ if (TEST_RETURN) {
+ if (TEST_ERRNO == EINVAL)
+ tst_resm(TPASS, "set_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, -1, TEST_ERRNO, EINVAL);
+ else
+ tst_resm(TFAIL, "set_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, -1, TEST_ERRNO, EINVAL);
+ }
+ else {
+ tst_resm(TFAIL, "set_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, -1, TEST_ERRNO, EINVAL);
+ }
+
+ /*
+ * This call to get_robust_list function should be sucessful.
+ */
+
+ TEST(retval = syscall(__NR_set_robust_list, &head, len));
+
+ if (TEST_RETURN == 0) {
+ tst_resm(TPASS, "set_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, 0, TEST_ERRNO, 0);
+ }
+ else {
+ tst_resm(TFAIL, "set_robust_list: retval = %d (expected %d), "
+ "errno = %d (expected %d)",
+ TEST_RETURN, 0, TEST_ERRNO, 0);
+ }
+
+ }
+
+ cleanup();
+
+ exit(EXIT_SUCCESS);
+}
+
+void
+setup(void)
+{
+ TEST_EXP_ENOS(exp_enos);
+
+ TEST_PAUSE;
+}
+
+void
+cleanup(void)
+{
+ TEST_CLEANUP;
+
+ tst_exit();
+}
+
-------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list