Thanks Paul,
On Tue, 2008-09-02 at 11:25 +1000, Paul Mackerras wrote:
> Subrata Modak writes:
>
> > You have added the new system call switch() for the POWERPC architecture
> > in the recent 2.6.26 kernel. Could you please share with us the ways you
> > tested it. Did you develop/write an automated test case for this. In
> > such a case, would you be willing to contribute the same test case(s) to
> > LTP (http://ltp.cvs.sourceforge.net/ltp/ltp/testcases/kernel/syscalls/)
> > under GPLv2 ?
>
> This can only be tested on a POWER6 machine. A program to test it is
> attached.
Thanks for sharing the test case with LTP. I have ported it to bare
minimum LTP requirement and ran it on various architectures and kernel
versions to test out the behaviour of the test on these machines.
Yamato,
When you find time, kindly add more specific stuff that we have
specially for the LTP syscall tests, things like running in a loop,
running concurrently, etc.
And here goes the Patch. Paul, you can propose more modification to this
if you wish to:
Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
Signed-off-by: Subrata Modak <[EMAIL PROTECTED]>
diff -uprN ltp-full-20080831.orig/runtest/syscalls
ltp-full-20080831/runtest/syscalls
--- ltp-full-20080831.orig/runtest/syscalls 2008-09-02
23:00:21.000000000 +0530
+++ ltp-full-20080831/runtest/syscalls 2008-09-02 23:16:13.000000000
+0530
@@ -917,6 +917,9 @@ swapon01 swapon01
swapon02 swapon02
swapon03 swapon03
+#Exclusive syscall() for POWER6 machines only
+switch01 switch01
+
symlink01 symlink01
symlink02 symlink02
symlink03 symlink03
diff -uprN
ltp-full-20080831.orig/testcases/kernel/syscalls/switch/Makefile
ltp-full-20080831/testcases/kernel/syscalls/switch/Makefile
--- ltp-full-20080831.orig/testcases/kernel/syscalls/switch/Makefile
1970-01-01 05:30:00.000000000 +0530
+++ ltp-full-20080831/testcases/kernel/syscalls/switch/Makefile
2008-09-02 23:15:09.000000000 +0530
@@ -0,0 +1,32 @@
+#################################################################################
+# Copyright (c) International Business Machines Corp., 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 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 -uprN
ltp-full-20080831.orig/testcases/kernel/syscalls/switch/switch01.c
ltp-full-20080831/testcases/kernel/syscalls/switch/switch01.c
--- ltp-full-20080831.orig/testcases/kernel/syscalls/switch/switch01.c
1970-01-01 05:30:00.000000000 +0530
+++ ltp-full-20080831/testcases/kernel/syscalls/switch/switch01.c
2008-09-02 23:13:23.000000000 +0530
@@ -0,0 +1,139 @@
+/******************************************************************************/
+/*
*/
+/* Copyright (c) International Business Machines Corp., 2008
*/
+/* Copyright 2008 Paul Mackerras, IBM Corp.
*/
+/*
*/
+/* 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 */
+/*
*/
+/******************************************************************************/
+/******************************************************************************/
+/*
*/
+/* File: switch01.c
*/
+/*
*/
+/* Description: Test little-endian mode switch system call. Requires a
64-bit */
+/* processor that supports little-endian mode,such as
POWER6. */
+/*
*/
+/* Total Tests: 1
*/
+/*
*/
+/* Test Name: switch01
*/
+/*
*/
+/* Author: Paul Mackerras <[EMAIL PROTECTED]>
*/
+/*
*/
+/* History: Created - Sep 02 2008 - Paul Mackerras
<[EMAIL PROTECTED]> */
+/* Ported to LTP
*/
+/* - Sep 02 2008
*/
+/* - Subrata Modak <[EMAIL PROTECTED]>
*/
+/*
*/
+/******************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <elf.h>
+#include <signal.h>
+#include <setjmp.h>
+#include "test.h"
+#include "usctest.h"
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <fcntl.h>
+#include <sys/utsname.h>
+#include <unistd.h>
+#include "linux_syscall_numbers.h"
+
+static void setup();
+static void cleanup();
+
+char *TCID = "switch01"; /* Test program identifier. */
+int TST_TOTAL = 1; /* Total number of test cases. */
+extern int Tst_count; /* Test Case counter for tst_* routines */
+
+void setup() {
+
+ /* capture signals */
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ /* Check whether we are root*/
+ if (geteuid() != 0) {
+ tst_brkm(TBROK, tst_exit, "Test must be run as root");
+ }
+
+ /* Pause if that option was specified */
+ TEST_PAUSE;
+
+}
+
+
+void cleanup() {
+ /*
+ * print timing stats if that option was specified.
+ * print errno log if that option was specified.
+ */
+ TEST_CLEANUP;
+
+ /* exit with return code appropriate for results */
+ tst_exit();
+} /* End cleanup() */
+
+
+#if defined (__powerpc64__) || (__powerpc__)
+#ifndef PPC_FEATURE_TRUE_LE
+ #define PPC_FEATURE_TRUE_LE 0x00000002
+#endif
+
+#include <asm/cputable.h>
+
+volatile int got_sigill;
+sigjmp_buf jb;
+
+void sigill(int sig) {
+ got_sigill = 1;
+ siglongjmp(jb, 1);
+}
+
+void do_le_switch(void) {
+ register int r0 asm("r0");
+
+ r0 = 0x1ebe;
+ asm volatile("sc; .long 0x02000044"
+ : "=&r" (r0) : "0" (r0)
+ : "cr0", "r9", "r10", "r11", "r12");
+}
+
+int main(int ac, char **av, char **envp, unsigned long *auxv) {
+ for (; *auxv != AT_NULL && *auxv != AT_HWCAP; auxv += 2)
+ ;
+ if (!(auxv[0] == AT_HWCAP && (auxv[1] & PPC_FEATURE_TRUE_LE))) {
+ tst_brkm(TCONF, cleanup, "Processor does not support
little-endian mode");
+ tst_exit();
+ }
+ signal(SIGILL, sigill);
+ if (sigsetjmp(jb, 1) == 0)
+ do_le_switch();
+ if (got_sigill) {
+ tst_resm(TFAIL, "Got SIGILL - test failed");
+ tst_exit();
+ }
+ tst_resm(TPASS, "switch() syscall tests passed");
+ tst_exit();
+}
+
+#else
+
+int main() {
+
+ tst_brkm(TCONF, cleanup, "This system does not support running
of switch() syscall");
+ tst_exit();
+}
+
+#endif
Regards--
Subrata
>
> Paul.
>
-------------------------------------------------------------------------
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