public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/cma: add runtime check to setup()
@ 2013-04-23  8:17 Jan Stancek
  2013-04-23 10:29 ` chrubis
  2013-04-23 16:13 ` Mike Frysinger
  0 siblings, 2 replies; 7+ messages in thread
From: Jan Stancek @ 2013-04-23  8:17 UTC (permalink / raw)
  To: ltp-list

__NR_process_vm_readv / __NR_process_vm_writev defined doesn't
guarantee, that kernel supports these syscalls. Add check to setup(),
which uses ltp_syscall(). If syscall isn't supported it will
end the testcase with TCONF.

This also fixes small copy-paste error in process_vm_writev02.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/syscalls/cma/process_vm.h         |    1 +
 testcases/kernel/syscalls/cma/process_vm01.c       |    2 ++
 testcases/kernel/syscalls/cma/process_vm_readv02.c |    2 ++
 testcases/kernel/syscalls/cma/process_vm_readv03.c |    2 ++
 .../kernel/syscalls/cma/process_vm_writev02.c      |    6 ++++--
 5 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/cma/process_vm.h b/testcases/kernel/syscalls/cma/process_vm.h
index 5241fa1..35086c6 100644
--- a/testcases/kernel/syscalls/cma/process_vm.h
+++ b/testcases/kernel/syscalls/cma/process_vm.h
@@ -31,6 +31,7 @@
 #include <sys/syscall.h>
 #include <sys/uio.h>
 #include <unistd.h>
+#include "linux_syscall_numbers.h"
 
 union semun {
 	int val;
diff --git a/testcases/kernel/syscalls/cma/process_vm01.c b/testcases/kernel/syscalls/cma/process_vm01.c
index 1a91570..bb09855 100644
--- a/testcases/kernel/syscalls/cma/process_vm01.c
+++ b/testcases/kernel/syscalls/cma/process_vm01.c
@@ -108,6 +108,7 @@ static void setup(char *argv[])
 	else if (rflag) {
 		TCID = TCID_readv;
 #if defined(__NR_process_vm_readv)
+		ltp_syscall(__NR_process_vm_readv, 0, NULL, 0, NULL, 0, 0);
 		cma_test_params = cma_test_params_read;
 #else
 		tst_brkm(TCONF, NULL, "process_vm_readv does not"
@@ -116,6 +117,7 @@ static void setup(char *argv[])
 	} else if (wflag) {
 		TCID = TCID_writev;
 #if defined(__NR_process_vm_writev)
+		ltp_syscall(__NR_process_vm_writev, 0, NULL, 0, NULL, 0, 0);
 		cma_test_params = cma_test_params_write;
 #else
 		tst_brkm(TCONF, NULL, "process_vm_writev does not"
diff --git a/testcases/kernel/syscalls/cma/process_vm_readv02.c b/testcases/kernel/syscalls/cma/process_vm_readv02.c
index dea1bbe..752a513 100644
--- a/testcases/kernel/syscalls/cma/process_vm_readv02.c
+++ b/testcases/kernel/syscalls/cma/process_vm_readv02.c
@@ -159,6 +159,8 @@ static void setup(void)
 #if !defined(__NR_process_vm_readv)
 	tst_brkm(TCONF, NULL, "process_vm_readv does not exist "
 		 "on your system");
+#else
+	ltp_syscall(__NR_process_vm_readv, 0, NULL, 0, NULL, 0, 0);
 #endif
 	semid = init_sem(1);
 
diff --git a/testcases/kernel/syscalls/cma/process_vm_readv03.c b/testcases/kernel/syscalls/cma/process_vm_readv03.c
index 7475a64..2a8f631 100644
--- a/testcases/kernel/syscalls/cma/process_vm_readv03.c
+++ b/testcases/kernel/syscalls/cma/process_vm_readv03.c
@@ -261,6 +261,8 @@ static void setup(void)
 #if !defined(__NR_process_vm_readv)
 	tst_brkm(TCONF, NULL, "process_vm_readv does not exist "
 		 "on your system");
+#else
+	ltp_syscall(__NR_process_vm_readv, 0, NULL, 0, NULL, 0, 0);
 #endif
 	semid = init_sem(1);
 	srand(time(NULL));
diff --git a/testcases/kernel/syscalls/cma/process_vm_writev02.c b/testcases/kernel/syscalls/cma/process_vm_writev02.c
index 0ea956d..6fd7aea 100644
--- a/testcases/kernel/syscalls/cma/process_vm_writev02.c
+++ b/testcases/kernel/syscalls/cma/process_vm_writev02.c
@@ -180,7 +180,7 @@ static void child_write(void)
 	tst_resm(TINFO, "child 2: write to the same memory location.");
 	TEST(test_process_vm_writev(pids[0], &local, 1, &remote, 1, 0));
 	if (TEST_RETURN != bufsz)
-		tst_brkm(TFAIL | TERRNO, tst_exit, "process_vm_readv");
+		tst_brkm(TFAIL | TERRNO, tst_exit, "process_vm_writev");
 }
 
 static void setup(void)
@@ -191,9 +191,11 @@ static void setup(void)
 	    sflag ? SAFE_STRTOL(NULL, sz_opt, 1, LONG_MAX - PADDING_SIZE * 2)
 	    : 100000;
 
-#if !defined(__NR_process_vm_readv)
+#if !defined(__NR_process_vm_writev)
 	tst_brkm(TCONF, NULL, "process_vm_writev does not exist "
 		 "on your system");
+#else
+	ltp_syscall(__NR_process_vm_writev, 0, NULL, 0, NULL, 0, 0);
 #endif
 	semid = init_sem(1);
 
-- 
1.7.1


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-04-24 15:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-23  8:17 [LTP] [PATCH] syscalls/cma: add runtime check to setup() Jan Stancek
2013-04-23 10:29 ` chrubis
     [not found]   ` <956651177.1121108.1366719315370.JavaMail.root@redhat.com>
2013-04-23 12:45     ` chrubis
2013-04-23 16:13 ` Mike Frysinger
2013-04-24  6:53   ` Jan Stancek
2013-04-24 15:52     ` Mike Frysinger
2013-04-24 15:58       ` chrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox