Skip to contentSkip to conversation

syscalls/access03: reconstruct and convert to new API

PATCH Superseded Guangwen Feng 2 participants 3 messages Jun 29, 2016 – Jul 20, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/access03: reconstruct and convert to new API

* take use of some SAFE Marcos
* add test as root and nobody respectively

---
 include/tst_test.h                          |   3 +
 testcases/kernel/syscalls/access/access03.c | 142 ++++++++++++++--------------
 2 files changed, 74 insertions(+), 71 deletions(-)
include/tst_test.h +3 -0
index 7d0cff8..265e84a 100644
@@ -33,6 +33,9 @@
 #include "tst_atomic.h"
 #include "tst_kvercmp.h"
 
+/* lib/get_high_address.c */
+char *get_high_address(void);
+
 /*
  * Reports testcase result.
  */
testcases/kernel/syscalls/access/access03.c +71 -71

172 lines not on this page · raw message

Signature · 1 line
1.8.4.2
#1 lore raw

PATCH 1/1 syscalls/access03: reconstruct and convert to new API

Hi!

include/tst_test.h line 37

Quoted 10 lines
include/tst_test.h +2 -0
index 7d0cff8..265e84a 100644
@@ -33,6 +33,9 @@
 #include "tst_atomic.h"
 #include "tst_kvercmp.h"
 
+/* lib/get_high_address.c */
+char *get_high_address(void);

I do not like this.

If want to add an function to return invalid address it should be prefixed with tst_ and do something more sensible than advancing a few pages after the program break.

And given that quite a lot of the testcases just utilize (void*)-1 I would probably go for this one in this test as well.

Quoted 23 lines
include/tst_test.h +0 -0
 /*
  * Reports testcase result.
  */
testcases/kernel/syscalls/access/access03.c +1 -7
index 6f5fa70..ff93fe2 100644
@@ -23,101 +23,101 @@
  */
 
 /*
- * access(2) test for errno(s) EFAULT.
+ * access(2) test for errno(s) EFAULT as root and nobody respectively.
  */
 
 #include <errno.h>
-#include <string.h>
-#include <signal.h>
-
 #include <unistd.h>
-#include <sys/mman.h>
-#include "test.h"
-

testcases/kernel/syscalls/access/access03.c line 35

Quoted 10 lines
testcases/kernel/syscalls/access/access03.c +4 -5
-static void setup(void);
-static void cleanup(void);
-
-char *TCID = "access03";
-int TST_TOTAL = 8;
+#include <sys/types.h>
+#include <pwd.h>
+#include "tst_test.h"
 
+#ifndef UCLINUX

Just get rid of the UCLINUX ifdefs. You should filter the test in the Makefile instead, just line we do in syscalls/writev/Makefile.

The rest looks good.

Signature · 2 lines
Cyril Hrubis
[email protected]
#2 lore raw

PATCH v2 2/2 syscalls/access03: reconstruct and convert to new API

* take use of some SAFE Marcos
* add test as root and nobody respectively

---
 testcases/kernel/syscalls/access/Makefile   |   2 +-
 testcases/kernel/syscalls/access/access03.c | 138 ++++++++++++----------------
 2 files changed, 60 insertions(+), 80 deletions(-)
testcases/kernel/syscalls/access/Makefile +1 -1
index 3954429..06aaf9f 100644
@@ -19,7 +19,7 @@
 top_srcdir		?= ../../../..
 
 ifeq ($(UCLINUX),1)
-FILTER_OUT_MAKE_TARGETS += access02
+FILTER_OUT_MAKE_TARGETS += access02 access03
 endif
 
 include $(top_srcdir)/include/mk/testcases.mk
testcases/kernel/syscalls/access/access03.c +59 -79

160 lines not on this page · raw message

Signature · 1 line
1.8.4.2