CVS commit: src/tests/lib/libc/c063

2020-02-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb  8 19:58:37 UTC 2020

Modified Files:
src/tests/lib/libc/c063: t_o_search.c

Log Message:
O_SEARCH tests: expect revoke +x failure on NFS

Patch by Kyle Evans (FreeBSD)

PR misc/54946


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/lib/libc/c063/t_o_search.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/c063/t_o_search.c
diff -u src/tests/lib/libc/c063/t_o_search.c:1.9 src/tests/lib/libc/c063/t_o_search.c:1.10
--- src/tests/lib/libc/c063/t_o_search.c:1.9	Thu Feb  6 12:18:06 2020
+++ src/tests/lib/libc/c063/t_o_search.c	Sat Feb  8 19:58:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_o_search.c,v 1.9 2020/02/06 12:18:06 martin Exp $ */
+/*	$NetBSD: t_o_search.c,v 1.10 2020/02/08 19:58:36 kamil Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,11 +29,13 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_o_search.c,v 1.9 2020/02/06 12:18:06 martin Exp $");
+__RCSID("$NetBSD: t_o_search.c,v 1.10 2020/02/08 19:58:36 kamil Exp $");
 
 #include 
 
 #include 
+#include 
+#include 
 #include 
 
 #include 
@@ -55,6 +57,11 @@ __RCSID("$NetBSD: t_o_search.c,v 1.9 202
 #define USE_O_SEARCH
 #endif
 
+#ifdef __FreeBSD__
+#define	statvfs		statfs
+#define	fstatvfs	fstatfs
+#endif
+
 #define DIR "dir"
 #define FILE "dir/o_search"
 #define BASEFILE "o_search"
@@ -311,8 +318,9 @@ ATF_TC_HEAD(o_search_revokex, tc)
 }
 ATF_TC_BODY(o_search_revokex, tc)
 {
-	int dfd, fd;
+	struct statvfs vst;
 	struct stat sb;
+	int dfd, fd;
 
 	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
 	ATF_REQUIRE((fd = open(FILE, O_CREAT|O_RDWR, 0644)) != -1);
@@ -322,6 +330,11 @@ ATF_TC_BODY(o_search_revokex, tc)
 
 	/* Drop permissions. The kernel must still not check the exec bit. */
 	ATF_REQUIRE(chmod(DIR, ) == 0);
+
+	fstatvfs(dfd, );
+	if (strcmp(vst.f_fstypename, "nfs") == 0)
+		atf_tc_expect_fail("NFS protocol cannot observe O_SEARCH semantics");
+
 	ATF_REQUIRE(fstatat(dfd, BASEFILE, , 0) == 0);
 
 	ATF_REQUIRE(close(dfd) == 0);



CVS commit: src/tests/lib/libc/c063

2020-02-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb  6 12:18:06 UTC 2020

Modified Files:
src/tests/lib/libc/c063: t_o_search.c

Log Message:
Add a few O_SEARCH tests, currently only run on FreeBSD.
Patch from Kyle Evans.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libc/c063/t_o_search.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/c063/t_o_search.c
diff -u src/tests/lib/libc/c063/t_o_search.c:1.8 src/tests/lib/libc/c063/t_o_search.c:1.9
--- src/tests/lib/libc/c063/t_o_search.c:1.8	Wed Feb  5 17:13:24 2020
+++ src/tests/lib/libc/c063/t_o_search.c	Thu Feb  6 12:18:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_o_search.c,v 1.8 2020/02/05 17:13:24 martin Exp $ */
+/*	$NetBSD: t_o_search.c,v 1.9 2020/02/06 12:18:06 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,13 +29,14 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_o_search.c,v 1.8 2020/02/05 17:13:24 martin Exp $");
+__RCSID("$NetBSD: t_o_search.c,v 1.9 2020/02/06 12:18:06 martin Exp $");
 
 #include 
 
-#include 
+#include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -50,7 +51,7 @@ __RCSID("$NetBSD: t_o_search.c,v 1.8 202
  * until a decision is reached about the semantics of O_SEARCH and a
  * non-broken implementation is available.
  */
-#if (O_MASK & O_SEARCH) != 0
+#if defined(__FreeBSD__) || (O_MASK & O_SEARCH) != 0
 #define USE_O_SEARCH
 #endif
 
@@ -263,6 +264,70 @@ ATF_TC_BODY(o_search_notdir, tc)
 	ATF_REQUIRE(close(dfd) == 0);
 }
 
+#ifdef USE_O_SEARCH
+ATF_TC(o_search_nord);
+ATF_TC_HEAD(o_search_nord, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "See that openat succeeds with no read permission");
+	atf_tc_set_md_var(tc, "require.user", "unprivileged");
+}
+ATF_TC_BODY(o_search_nord, tc)
+{
+	int dfd, fd;
+
+	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
+	ATF_REQUIRE((fd = open(FILE, O_CREAT|O_RDWR, 0644)) != -1);
+	ATF_REQUIRE(close(fd) == 0);
+
+	ATF_REQUIRE(chmod(DIR, 0100) == 0);
+	ATF_REQUIRE((dfd = open(DIR, O_SEARCH, 0)) != -1);
+
+	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) != -1);
+
+	ATF_REQUIRE(close(dfd) == 0);
+}
+
+ATF_TC(o_search_getdents);
+ATF_TC_HEAD(o_search_getdents, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "See that O_SEARCH forbids getdents");
+}
+ATF_TC_BODY(o_search_getdents, tc)
+{
+	char buf[1024];
+	int dfd;
+
+	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
+	ATF_REQUIRE((dfd = open(DIR, O_SEARCH, 0)) != -1);
+	ATF_REQUIRE(getdents(dfd, buf, sizeof(buf)) < 0);
+	ATF_REQUIRE(close(dfd) == 0);
+}
+
+ATF_TC(o_search_revokex);
+ATF_TC_HEAD(o_search_revokex, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "See that *at behaves after chmod -x");
+	atf_tc_set_md_var(tc, "require.user", "unprivileged");
+}
+ATF_TC_BODY(o_search_revokex, tc)
+{
+	int dfd, fd;
+	struct stat sb;
+
+	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
+	ATF_REQUIRE((fd = open(FILE, O_CREAT|O_RDWR, 0644)) != -1);
+	ATF_REQUIRE(close(fd) == 0);
+
+	ATF_REQUIRE((dfd = open(DIR, O_SEARCH, 0)) != -1);
+
+	/* Drop permissions. The kernel must still not check the exec bit. */
+	ATF_REQUIRE(chmod(DIR, ) == 0);
+	ATF_REQUIRE(fstatat(dfd, BASEFILE, , 0) == 0);
+
+	ATF_REQUIRE(close(dfd) == 0);
+}
+#endif /* USE_O_SEARCH */
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -277,6 +342,11 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, o_search_unpriv_flag2);
 #endif
 	ATF_TP_ADD_TC(tp, o_search_notdir);
+#ifdef USE_O_SEARCH
+	ATF_TP_ADD_TC(tp, o_search_nord);
+	ATF_TP_ADD_TC(tp, o_search_getdents);
+	ATF_TP_ADD_TC(tp, o_search_revokex);
+#endif
 
 	return atf_no_error();
 }



CVS commit: src/tests/lib/libc/c063

2020-02-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  5 17:13:24 UTC 2020

Modified Files:
src/tests/lib/libc/c063: t_o_search.c

Log Message:
PR misc/54940: do not combine O_SEARCH with O_RDWR, from Kyle Evans.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/c063/t_o_search.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/c063/t_o_search.c
diff -u src/tests/lib/libc/c063/t_o_search.c:1.7 src/tests/lib/libc/c063/t_o_search.c:1.8
--- src/tests/lib/libc/c063/t_o_search.c:1.7	Wed Feb  5 08:52:46 2020
+++ src/tests/lib/libc/c063/t_o_search.c	Wed Feb  5 17:13:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_o_search.c,v 1.7 2020/02/05 08:52:46 martin Exp $ */
+/*	$NetBSD: t_o_search.c,v 1.8 2020/02/05 17:13:24 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_o_search.c,v 1.7 2020/02/05 08:52:46 martin Exp $");
+__RCSID("$NetBSD: t_o_search.c,v 1.8 2020/02/05 17:13:24 martin Exp $");
 
 #include 
 
@@ -257,7 +257,7 @@ ATF_TC_BODY(o_search_notdir, tc)
 	int fd;
 
 	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
-	ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_RDWR|O_SEARCH, 0644)) != -1);
+	ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_SEARCH, 0644)) != -1);
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1);
 	ATF_REQUIRE(errno == ENOTDIR);
 	ATF_REQUIRE(close(dfd) == 0);



CVS commit: src/tests/lib/libc/c063

2020-02-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  5 08:52:46 UTC 2020

Modified Files:
src/tests/lib/libc/c063: t_o_search.c

Log Message:
PR misc/54939: fix file descriptor leak, patch from Kyle Evans.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/c063/t_o_search.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/c063/t_o_search.c
diff -u src/tests/lib/libc/c063/t_o_search.c:1.6 src/tests/lib/libc/c063/t_o_search.c:1.7
--- src/tests/lib/libc/c063/t_o_search.c:1.6	Tue Jan 28 07:12:08 2020
+++ src/tests/lib/libc/c063/t_o_search.c	Wed Feb  5 08:52:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_o_search.c,v 1.6 2020/01/28 07:12:08 martin Exp $ */
+/*	$NetBSD: t_o_search.c,v 1.7 2020/02/05 08:52:46 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_o_search.c,v 1.6 2020/01/28 07:12:08 martin Exp $");
+__RCSID("$NetBSD: t_o_search.c,v 1.7 2020/02/05 08:52:46 martin Exp $");
 
 #include 
 
@@ -260,6 +260,7 @@ ATF_TC_BODY(o_search_notdir, tc)
 	ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_RDWR|O_SEARCH, 0644)) != -1);
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1);
 	ATF_REQUIRE(errno == ENOTDIR);
+	ATF_REQUIRE(close(dfd) == 0);
 }
 
 ATF_TP_ADD_TCS(tp)



CVS commit: src/tests/lib/libc/c063

2020-01-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 28 07:12:08 UTC 2020

Modified Files:
src/tests/lib/libc/c063: t_o_search.c

Log Message:
PR 54902: fix octal numbers accidently spelled as decimal.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/c063/t_o_search.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/c063/t_o_search.c
diff -u src/tests/lib/libc/c063/t_o_search.c:1.5 src/tests/lib/libc/c063/t_o_search.c:1.6
--- src/tests/lib/libc/c063/t_o_search.c:1.5	Tue Jan 10 22:25:01 2017
+++ src/tests/lib/libc/c063/t_o_search.c	Tue Jan 28 07:12:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25:01 christos Exp $ */
+/*	$NetBSD: t_o_search.c,v 1.6 2020/01/28 07:12:08 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25:01 christos Exp $");
+__RCSID("$NetBSD: t_o_search.c,v 1.6 2020/01/28 07:12:08 martin Exp $");
 
 #include 
 
@@ -79,7 +79,7 @@ ATF_TC_BODY(o_search_perm1, tc)
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
 	ATF_REQUIRE(close(fd) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 644) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1);
 	ATF_REQUIRE(errno == EACCES);
@@ -109,12 +109,12 @@ ATF_TC_BODY(o_search_root_flag1, tc)
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
 	ATF_REQUIRE(close(fd) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 644) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
 	ATF_REQUIRE(close(fd) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 444) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0444) == 0);
 
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
 
@@ -141,12 +141,12 @@ ATF_TC_BODY(o_search_unpriv_flag1, tc)
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
 	ATF_REQUIRE(close(fd) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 644) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
 	ATF_REQUIRE(close(fd) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 444) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0444) == 0);
 
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
 
@@ -173,7 +173,7 @@ ATF_TC_BODY(o_search_perm2, tc)
 
 	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 644) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
 	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == -1);
 	ATF_REQUIRE(errno == EACCES);
@@ -202,11 +202,11 @@ ATF_TC_BODY(o_search_root_flag2, tc)
 
 	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 644) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
 	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 444) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0444) == 0);
 
 	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
@@ -232,11 +232,11 @@ ATF_TC_BODY(o_search_unpriv_flag2, tc)
 
 	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 644) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
 	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 444) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0444) == 0);
 
 	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 



CVS commit: src/tests/lib/libc/c063

2017-01-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 10 22:25:01 UTC 2017

Modified Files:
src/tests/lib/libc/c063: t_o_search.c

Log Message:
need 


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/c063/t_o_search.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/c063/t_o_search.c
diff -u src/tests/lib/libc/c063/t_o_search.c:1.4 src/tests/lib/libc/c063/t_o_search.c:1.5
--- src/tests/lib/libc/c063/t_o_search.c:1.4	Sun Mar 17 00:46:06 2013
+++ src/tests/lib/libc/c063/t_o_search.c	Tue Jan 10 17:25:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_o_search.c,v 1.4 2013/03/17 04:46:06 jmmv Exp $ */
+/*	$NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25:01 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,9 +29,13 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_o_search.c,v 1.4 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25:01 christos Exp $");
 
 #include 
+
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -40,7 +44,6 @@ __RCSID("$NetBSD: t_o_search.c,v 1.4 201
 #include 
 #include 
 #include 
-#include 
 
 /*
  * dholland 20130112: disable tests that require O_SEARCH semantics



CVS commit: src/tests/lib/libc/c063

2017-01-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 10 15:15:09 UTC 2017

Modified Files:
src/tests/lib/libc/c063: t_fexecve.c t_mkfifoat.c t_mknodat.c

Log Message:
PR/51805: Ngie Cooper: Fix file descriptor leaks


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/c063/t_fexecve.c \
src/tests/lib/libc/c063/t_mkfifoat.c
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/c063/t_mknodat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/c063/t_fexecve.c
diff -u src/tests/lib/libc/c063/t_fexecve.c:1.2 src/tests/lib/libc/c063/t_fexecve.c:1.3
--- src/tests/lib/libc/c063/t_fexecve.c:1.2	Sun Mar 17 00:35:59 2013
+++ src/tests/lib/libc/c063/t_fexecve.c	Tue Jan 10 10:15:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fexecve.c,v 1.2 2013/03/17 04:35:59 jmmv Exp $ */
+/*	$NetBSD: t_fexecve.c,v 1.3 2017/01/10 15:15:09 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_fexecve.c,v 1.2 2013/03/17 04:35:59 jmmv Exp $");
+__RCSID("$NetBSD: t_fexecve.c,v 1.3 2017/01/10 15:15:09 christos Exp $");
 
 #include 
 
@@ -70,6 +70,7 @@ ATF_TC_BODY(fexecve, tc)
 error = 76;
 			else
 error = EXIT_FAILURE;
+			(void)close(fd);
 			err(error, "fexecve");
 		}
 	}
Index: src/tests/lib/libc/c063/t_mkfifoat.c
diff -u src/tests/lib/libc/c063/t_mkfifoat.c:1.2 src/tests/lib/libc/c063/t_mkfifoat.c:1.3
--- src/tests/lib/libc/c063/t_mkfifoat.c:1.2	Sun Mar 17 00:46:06 2013
+++ src/tests/lib/libc/c063/t_mkfifoat.c	Tue Jan 10 10:15:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mkfifoat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/*	$NetBSD: t_mkfifoat.c,v 1.3 2017/01/10 15:15:09 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_mkfifoat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_mkfifoat.c,v 1.3 2017/01/10 15:15:09 christos Exp $");
 
 #include 
 #include 
@@ -63,6 +63,7 @@ ATF_TC_BODY(mkfifoat_fd, tc)
 	ATF_REQUIRE((fd = mkfifoat(dfd, BASEFIFO, mode)) != -1);
 	ATF_REQUIRE(close(fd) == 0);
 	ATF_REQUIRE(access(FIFO, F_OK) == 0);
+	(void)close(dfd);
 }
 
 ATF_TC(mkfifoat_fdcwd);

Index: src/tests/lib/libc/c063/t_mknodat.c
diff -u src/tests/lib/libc/c063/t_mknodat.c:1.3 src/tests/lib/libc/c063/t_mknodat.c:1.4
--- src/tests/lib/libc/c063/t_mknodat.c:1.3	Sun Mar 17 00:46:06 2013
+++ src/tests/lib/libc/c063/t_mknodat.c	Tue Jan 10 10:15:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mknodat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $ */
+/*	$NetBSD: t_mknodat.c,v 1.4 2017/01/10 15:15:09 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_mknodat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_mknodat.c,v 1.4 2017/01/10 15:15:09 christos Exp $");
 
 #include 
 #include 
@@ -80,6 +80,7 @@ ATF_TC_BODY(mknodat_fd, tc)
 	ATF_REQUIRE((fd = mknodat(dfd, BASEFILE, mode, dev)) != -1);
 	ATF_REQUIRE(close(fd) == 0);
 	ATF_REQUIRE(access(FILE, F_OK) == 0);
+	(void)close(dfd);
 }
 
 ATF_TC(mknodat_fdcwd);



CVS commit: src/tests/lib/libc/c063

2017-01-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 10 15:13:56 UTC 2017

Modified Files:
src/tests/lib/libc/c063: t_faccessat.c t_fchmodat.c t_fchownat.c
t_fstatat.c t_openat.c t_readlinkat.c t_unlinkat.c t_utimensat.c

Log Message:
PR/51804: Ngie Cooper: Sort headers; include . On NetBSD,
 gets side-loaded from . Should be fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/c063/t_faccessat.c \
src/tests/lib/libc/c063/t_fchmodat.c src/tests/lib/libc/c063/t_fstatat.c \
src/tests/lib/libc/c063/t_openat.c src/tests/lib/libc/c063/t_unlinkat.c
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/c063/t_fchownat.c \
src/tests/lib/libc/c063/t_readlinkat.c
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/c063/t_utimensat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/c063/t_faccessat.c
diff -u src/tests/lib/libc/c063/t_faccessat.c:1.2 src/tests/lib/libc/c063/t_faccessat.c:1.3
--- src/tests/lib/libc/c063/t_faccessat.c:1.2	Sun Mar 17 00:46:06 2013
+++ src/tests/lib/libc/c063/t_faccessat.c	Tue Jan 10 10:13:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_faccessat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/*	$NetBSD: t_faccessat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_faccessat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_faccessat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -39,7 +41,6 @@ __RCSID("$NetBSD: t_faccessat.c,v 1.2 20
 #include 
 #include 
 #include 
-#include 
 
 #define DIR "dir"
 #define FILE "dir/faccessat"
Index: src/tests/lib/libc/c063/t_fchmodat.c
diff -u src/tests/lib/libc/c063/t_fchmodat.c:1.2 src/tests/lib/libc/c063/t_fchmodat.c:1.3
--- src/tests/lib/libc/c063/t_fchmodat.c:1.2	Sun Mar 17 00:46:06 2013
+++ src/tests/lib/libc/c063/t_fchmodat.c	Tue Jan 10 10:13:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fchmodat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/*	$NetBSD: t_fchmodat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_fchmodat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_fchmodat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -39,7 +41,6 @@ __RCSID("$NetBSD: t_fchmodat.c,v 1.2 201
 #include 
 #include 
 #include 
-#include 
 
 #define DIR "dir"
 #define FILE "dir/fchmodat"
Index: src/tests/lib/libc/c063/t_fstatat.c
diff -u src/tests/lib/libc/c063/t_fstatat.c:1.2 src/tests/lib/libc/c063/t_fstatat.c:1.3
--- src/tests/lib/libc/c063/t_fstatat.c:1.2	Sun Mar 17 00:46:06 2013
+++ src/tests/lib/libc/c063/t_fstatat.c	Tue Jan 10 10:13:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fstatat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/*	$NetBSD: t_fstatat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_fstatat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_fstatat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -39,7 +41,6 @@ __RCSID("$NetBSD: t_fstatat.c,v 1.2 2013
 #include 
 #include 
 #include 
-#include 
 
 #define DIR "dir"
 #define FILE "dir/fstatat"
Index: src/tests/lib/libc/c063/t_openat.c
diff -u src/tests/lib/libc/c063/t_openat.c:1.2 src/tests/lib/libc/c063/t_openat.c:1.3
--- src/tests/lib/libc/c063/t_openat.c:1.2	Sun Mar 17 00:46:06 2013
+++ src/tests/lib/libc/c063/t_openat.c	Tue Jan 10 10:13:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_openat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/*	$NetBSD: t_openat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_openat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_openat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -39,7 +41,6 @@ __RCSID("$NetBSD: t_openat.c,v 1.2 2013/
 #include 
 #include 
 #include 
-#include 
 
 #define DIR "dir"
 #define FILE "dir/openat"
Index: src/tests/lib/libc/c063/t_unlinkat.c
diff -u src/tests/lib/libc/c063/t_unlinkat.c:1.2 src/tests/lib/libc/c063/t_unlinkat.c:1.3
--- src/tests/lib/libc/c063/t_unlinkat.c:1.2	Sun Mar 17 00:46:06 2013
+++ src/tests/lib/libc/c063/t_unlinkat.c	Tue Jan 10 10:13:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unlinkat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/*	$NetBSD: t_unlinkat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD 

CVS commit: src/tests/lib/libc/c063

2013-03-16 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Sun Mar 17 04:36:00 UTC 2013

Modified Files:
src/tests/lib/libc/c063: t_fexecve.c

Log Message:
fexecve is not implemented, so mark the test as an expected failure.

While doing this, clean this whole thing: do not define a useless cleanup
routine and wait for the subprocess to finish instead of using sleep.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/c063/t_fexecve.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/c063/t_fexecve.c
diff -u src/tests/lib/libc/c063/t_fexecve.c:1.1 src/tests/lib/libc/c063/t_fexecve.c:1.2
--- src/tests/lib/libc/c063/t_fexecve.c:1.1	Sun Nov 18 17:41:54 2012
+++ src/tests/lib/libc/c063/t_fexecve.c	Sun Mar 17 04:35:59 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fexecve.c,v 1.1 2012/11/18 17:41:54 manu Exp $ */
+/*	$NetBSD: t_fexecve.c,v 1.2 2013/03/17 04:35:59 jmmv Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,48 +29,61 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_fexecve.c,v 1.1 2012/11/18 17:41:54 manu Exp $);
+__RCSID($NetBSD: t_fexecve.c,v 1.2 2013/03/17 04:35:59 jmmv Exp $);
+
+#include sys/wait.h
 
 #include atf-c.h
+#include err.h
 #include errno.h
 #include fcntl.h
 #include limits.h
 #include paths.h
 #include stdio.h
+#include stdlib.h
 #include string.h
 #include unistd.h
 #include sys/param.h
 
-#define FILE test
-
-ATF_TC_WITH_CLEANUP(fexecve);
+ATF_TC(fexecve);
 ATF_TC_HEAD(fexecve, tc)
 {
 	atf_tc_set_md_var(tc, descr, See that fexecve works);
 }
-
 ATF_TC_BODY(fexecve, tc)
 {
-	int fd;
+	int status;
 	pid_t pid;
-	const char *const argv[] = { touch, FILE, NULL };
+	const char *const argv[] = { touch, test, NULL };
 	const char *const envp[] = { NULL };
 
 	ATF_REQUIRE((pid = fork()) != -1);
-	if (pid != 0) {	/* parent */
-		sleep(1);
-		ATF_REQUIRE(access(FILE, F_OK) == 0);
-	} else {	/* child */
-		ATF_REQUIRE((fd = open(/usr/bin/touch, O_RDONLY, 0)) != -1);
-		ATF_REQUIRE(fexecve(fd, __UNCONST(argv), __UNCONST(envp)) == 0);
+	if (pid == 0) {
+		int fd;
+
+		if ((fd = open(/usr/bin/touch, O_RDONLY, 0)) == -1)
+			err(EXIT_FAILURE, open /usr/bin/touch);
+
+		if (fexecve(fd, __UNCONST(argv), __UNCONST(envp)) == -1) {
+			int error;
+			if (errno == ENOSYS)
+error = 76;
+			else
+error = EXIT_FAILURE;
+			err(error, fexecve);
+		}
 	}
-}
 
-ATF_TC_CLEANUP(fexecve, tc)
-{
-	(void)unlink(FILE);
-}
+	ATF_REQUIRE(waitpid(pid, status, 0) != -1);
+	if (!WIFEXITED(status))
+		atf_tc_fail(child process did not exit cleanly);
+	if (WEXITSTATUS(status) == 76)
+		atf_tc_expect_fail(fexecve not implemented);
+	else
+		ATF_REQUIRE(WEXITSTATUS(status) == EXIT_SUCCESS);
 
+	ATF_REQUIRE(access(test, F_OK) == 0);
+}
 
 ATF_TP_ADD_TCS(tp)
 {



CVS commit: src/tests/lib/libc/c063

2013-03-16 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Sun Mar 17 04:46:07 UTC 2013

Modified Files:
src/tests/lib/libc/c063: t_faccessat.c t_fchmodat.c t_fchownat.c
t_fstatat.c t_linkat.c t_mkdirat.c t_mkfifoat.c t_mknodat.c
t_o_search.c t_openat.c t_readlinkat.c t_renameat.c t_symlinkat.c
t_unlinkat.c t_utimensat.c

Log Message:
Remove unnecessary cleanup routines.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/c063/t_faccessat.c \
src/tests/lib/libc/c063/t_fchmodat.c src/tests/lib/libc/c063/t_fstatat.c \
src/tests/lib/libc/c063/t_linkat.c src/tests/lib/libc/c063/t_mkdirat.c \
src/tests/lib/libc/c063/t_mkfifoat.c src/tests/lib/libc/c063/t_openat.c \
src/tests/lib/libc/c063/t_renameat.c \
src/tests/lib/libc/c063/t_symlinkat.c \
src/tests/lib/libc/c063/t_unlinkat.c
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/c063/t_fchownat.c \
src/tests/lib/libc/c063/t_mknodat.c \
src/tests/lib/libc/c063/t_readlinkat.c
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/c063/t_o_search.c
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/c063/t_utimensat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/c063/t_faccessat.c
diff -u src/tests/lib/libc/c063/t_faccessat.c:1.1 src/tests/lib/libc/c063/t_faccessat.c:1.2
--- src/tests/lib/libc/c063/t_faccessat.c:1.1	Sun Nov 18 17:41:54 2012
+++ src/tests/lib/libc/c063/t_faccessat.c	Sun Mar 17 04:46:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_faccessat.c,v 1.1 2012/11/18 17:41:54 manu Exp $ */
+/*	$NetBSD: t_faccessat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_faccessat.c,v 1.1 2012/11/18 17:41:54 manu Exp $);
+__RCSID($NetBSD: t_faccessat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $);
 
 #include atf-c.h
 #include errno.h
@@ -48,12 +48,11 @@ __RCSID($NetBSD: t_faccessat.c,v 1.1 20
 #define BASELINK symlink
 #define FILEERR dir/faccessaterr
 
-ATF_TC_WITH_CLEANUP(faccessat_fd);
+ATF_TC(faccessat_fd);
 ATF_TC_HEAD(faccessat_fd, tc)
 {
 	atf_tc_set_md_var(tc, descr, See that faccessat works with fd);
 }
-
 ATF_TC_BODY(faccessat_fd, tc)
 {
 	int dfd;
@@ -68,20 +67,12 @@ ATF_TC_BODY(faccessat_fd, tc)
 	ATF_REQUIRE(close(dfd) == 0);
 }
 
-ATF_TC_CLEANUP(faccessat_fd, tc)
-{
-	(void)unlink(FILE);
-	(void)unlink(FILEERR);
-	(void)rmdir(DIR);
-}
-
-ATF_TC_WITH_CLEANUP(faccessat_fdcwd);
+ATF_TC(faccessat_fdcwd);
 ATF_TC_HEAD(faccessat_fdcwd, tc)
 {
 	atf_tc_set_md_var(tc, descr, 
 			  See that faccessat works with fd as AT_FDCWD);
 }
-
 ATF_TC_BODY(faccessat_fdcwd, tc)
 {
 	int fd;
@@ -94,39 +85,23 @@ ATF_TC_BODY(faccessat_fdcwd, tc)
 	ATF_REQUIRE(faccessat(AT_FDCWD, BASEFILE, F_OK, 0) == 0);
 }
 
-ATF_TC_CLEANUP(faccessat_fdcwd, tc)
-{
-	(void)unlink(FILE);
-	(void)unlink(FILEERR);
-	(void)rmdir(DIR);
-}
-
-ATF_TC_WITH_CLEANUP(faccessat_fdcwderr);
+ATF_TC(faccessat_fdcwderr);
 ATF_TC_HEAD(faccessat_fdcwderr, tc)
 {
 	atf_tc_set_md_var(tc, descr, 
 		  See that faccessat fails with fd as AT_FDCWD and bad path);
 }
-
 ATF_TC_BODY(faccessat_fdcwderr, tc)
 {
 	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
 	ATF_REQUIRE(faccessat(AT_FDCWD, FILEERR, F_OK, 0) == -1);
 }
 
-ATF_TC_CLEANUP(faccessat_fdcwderr, tc)
-{
-	(void)unlink(FILE);
-	(void)unlink(FILEERR);
-	(void)rmdir(DIR);
-}
-
-ATF_TC_WITH_CLEANUP(faccessat_fderr1);
+ATF_TC(faccessat_fderr1);
 ATF_TC_HEAD(faccessat_fderr1, tc)
 {
 	atf_tc_set_md_var(tc, descr, See that faccessat fail with bad path);
 }
-
 ATF_TC_BODY(faccessat_fderr1, tc)
 {
 	int dfd;
@@ -135,22 +110,13 @@ ATF_TC_BODY(faccessat_fderr1, tc)
 	ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1);
 	ATF_REQUIRE(faccessat(dfd, FILEERR, F_OK, 0) == -1);
 	ATF_REQUIRE(close(dfd) == 0);
-	
-}
-
-ATF_TC_CLEANUP(faccessat_fderr1, tc)
-{
-	(void)unlink(FILE);
-	(void)unlink(FILEERR);
-	(void)rmdir(DIR);
 }
 
-ATF_TC_WITH_CLEANUP(faccessat_fderr2);
+ATF_TC(faccessat_fderr2);
 ATF_TC_HEAD(faccessat_fderr2, tc)
 {
 	atf_tc_set_md_var(tc, descr, See that faccessat fails with bad fdat);
 }
-
 ATF_TC_BODY(faccessat_fderr2, tc)
 {
 	int dfd;
@@ -166,19 +132,11 @@ ATF_TC_BODY(faccessat_fderr2, tc)
 	ATF_REQUIRE(close(dfd) == 0);
 }
 
-ATF_TC_CLEANUP(faccessat_fderr2, tc)
-{
-	(void)unlink(FILE);
-	(void)unlink(FILEERR);
-	(void)rmdir(DIR);
-}
-
-ATF_TC_WITH_CLEANUP(faccessat_fderr3);
+ATF_TC(faccessat_fderr3);
 ATF_TC_HEAD(faccessat_fderr3, tc)
 {
 	atf_tc_set_md_var(tc, descr, See that faccessat fails with fd as -1);
 }
-
 ATF_TC_BODY(faccessat_fderr3, tc)
 {
 	int fd;
@@ -190,19 +148,11 @@ ATF_TC_BODY(faccessat_fderr3, tc)
 	ATF_REQUIRE(faccessat(-1, FILE, F_OK, 0) == -1);
 }
 
-ATF_TC_CLEANUP(faccessat_fderr3, tc)
-{
-	(void)unlink(FILE);
-	(void)unlink(FILEERR);
-	(void)rmdir(DIR);
-}
-
-ATF_TC_WITH_CLEANUP(faccessat_fdlink);
+ATF_TC(faccessat_fdlink);
 

CVS commit: src/tests/lib/libc/c063

2012-11-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov 23 08:24:20 UTC 2012

Modified Files:
src/tests/lib/libc/c063: t_o_search.c

Log Message:
Split the test cases where root/non-root makes a difference in two and mark
them apropriately. Exact permission semantics are still under discussion,
this will have to be cleaned up once that discussion is settled.
For now, one test cases fails.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/c063/t_o_search.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/c063/t_o_search.c
diff -u src/tests/lib/libc/c063/t_o_search.c:1.1 src/tests/lib/libc/c063/t_o_search.c:1.2
--- src/tests/lib/libc/c063/t_o_search.c:1.1	Sun Nov 18 17:41:54 2012
+++ src/tests/lib/libc/c063/t_o_search.c	Fri Nov 23 08:24:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_o_search.c,v 1.1 2012/11/18 17:41:54 manu Exp $ */
+/*	$NetBSD: t_o_search.c,v 1.2 2012/11/23 08:24:20 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_o_search.c,v 1.1 2012/11/18 17:41:54 manu Exp $);
+__RCSID($NetBSD: t_o_search.c,v 1.2 2012/11/23 08:24:20 martin Exp $);
 
 #include atf-c.h
 #include errno.h
@@ -81,13 +81,14 @@ ATF_TC_CLEANUP(o_search_perm1, tc)
 	(void)rmdir(DIR);
 } 
 
-ATF_TC_WITH_CLEANUP(o_search_flag1);
-ATF_TC_HEAD(o_search_flag1, tc)
+ATF_TC_WITH_CLEANUP(o_search_root_flag1);
+ATF_TC_HEAD(o_search_root_flag1, tc)
 {
 	atf_tc_set_md_var(tc, descr, See that openat honours O_SEARCH);
+	atf_tc_set_md_var(tc, require.user, root);
 }
 
-ATF_TC_BODY(o_search_flag1, tc)
+ATF_TC_BODY(o_search_root_flag1, tc)
 {
 	int dfd;
 	int fd;
@@ -113,7 +114,46 @@ ATF_TC_BODY(o_search_flag1, tc)
 	ATF_REQUIRE(close(dfd) == 0);
 }
 
-ATF_TC_CLEANUP(o_search_flag1, tc)
+ATF_TC_CLEANUP(o_search_root_flag1, tc)
+{
+	(void)unlink(FILE);
+	(void)rmdir(DIR);
+} 
+
+ATF_TC_WITH_CLEANUP(o_search_unpriv_flag1);
+ATF_TC_HEAD(o_search_unpriv_flag1, tc)
+{
+	atf_tc_set_md_var(tc, descr, See that openat honours O_SEARCH);
+	atf_tc_set_md_var(tc, require.user, unprivileged);
+}
+
+ATF_TC_BODY(o_search_unpriv_flag1, tc)
+{
+	int dfd;
+	int fd;
+
+	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
+	ATF_REQUIRE((fd = open(FILE, O_CREAT|O_RDWR, 0644)) != -1);
+	ATF_REQUIRE(close(fd) == 0);
+
+	ATF_REQUIRE((dfd = open(DIR, O_RDONLY|O_SEARCH, 0)) != -1);
+
+	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
+	ATF_REQUIRE(close(fd) == 0);
+
+	ATF_REQUIRE(fchmod(dfd, 744) == 0);
+
+	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
+	ATF_REQUIRE(close(fd) == 0);
+
+	ATF_REQUIRE(fchmod(dfd, 444) == 0);
+
+	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1);
+
+	ATF_REQUIRE(close(dfd) == 0);
+}
+
+ATF_TC_CLEANUP(o_search_unpriv_flag1, tc)
 {
 	(void)unlink(FILE);
 	(void)rmdir(DIR);
@@ -152,13 +192,14 @@ ATF_TC_CLEANUP(o_search_perm2, tc)
 	(void)rmdir(DIR);
 } 
 
-ATF_TC_WITH_CLEANUP(o_search_flag2);
-ATF_TC_HEAD(o_search_flag2, tc)
+ATF_TC_WITH_CLEANUP(o_search_root_flag2);
+ATF_TC_HEAD(o_search_root_flag2, tc)
 {
 	atf_tc_set_md_var(tc, descr, See that fstatat honours O_SEARCH);
+	atf_tc_set_md_var(tc, require.user, root);
 }
 
-ATF_TC_BODY(o_search_flag2, tc)
+ATF_TC_BODY(o_search_root_flag2, tc)
 {
 	int dfd;
 	int fd;
@@ -182,7 +223,44 @@ ATF_TC_BODY(o_search_flag2, tc)
 	ATF_REQUIRE(close(dfd) == 0);
 }
 
-ATF_TC_CLEANUP(o_search_flag2, tc)
+ATF_TC_CLEANUP(o_search_root_flag2, tc)
+{
+	(void)unlink(FILE);
+	(void)rmdir(DIR);
+} 
+
+ATF_TC_WITH_CLEANUP(o_search_unpriv_flag2);
+ATF_TC_HEAD(o_search_unpriv_flag2, tc)
+{
+	atf_tc_set_md_var(tc, descr, See that fstatat honours O_SEARCH);
+	atf_tc_set_md_var(tc, require.user, unprivileged);
+}
+
+ATF_TC_BODY(o_search_unpriv_flag2, tc)
+{
+	int dfd;
+	int fd;
+
+	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
+	ATF_REQUIRE((fd = open(FILE, O_CREAT|O_RDWR, 0644)) != -1);
+	ATF_REQUIRE(close(fd) == 0);
+
+	ATF_REQUIRE((dfd = open(DIR, O_RDONLY|O_SEARCH, 0)) != -1);
+
+	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
+
+	ATF_REQUIRE(fchmod(dfd, 744) == 0);
+
+	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
+
+	ATF_REQUIRE(fchmod(dfd, 444) == 0);
+
+	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
+
+	ATF_REQUIRE(close(dfd) == 0);
+}
+
+ATF_TC_CLEANUP(o_search_unpriv_flag2, tc)
 {
 	(void)unlink(FILE);
 	(void)rmdir(DIR);
@@ -217,9 +295,11 @@ ATF_TP_ADD_TCS(tp)
 {
 
 	ATF_TP_ADD_TC(tp, o_search_perm1);
-	ATF_TP_ADD_TC(tp, o_search_flag1);
+	ATF_TP_ADD_TC(tp, o_search_root_flag1);
+	ATF_TP_ADD_TC(tp, o_search_unpriv_flag1);
 	ATF_TP_ADD_TC(tp, o_search_perm2);
-	ATF_TP_ADD_TC(tp, o_search_flag2);
+	ATF_TP_ADD_TC(tp, o_search_root_flag2);
+	ATF_TP_ADD_TC(tp, o_search_unpriv_flag2);
 	ATF_TP_ADD_TC(tp, o_search_notdir);
 
 	return atf_no_error();



CVS commit: src/tests/lib/libc/c063

2012-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 22 14:51:19 UTC 2012

Modified Files:
src/tests/lib/libc/c063: t_utimensat.c

Log Message:
Fix off by one in static array acces, use valid timestamps (ns part  1e9),
just in case a filesystem would need to convert this to some other
representation.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/c063/t_utimensat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/c063/t_utimensat.c
diff -u src/tests/lib/libc/c063/t_utimensat.c:1.2 src/tests/lib/libc/c063/t_utimensat.c:1.3
--- src/tests/lib/libc/c063/t_utimensat.c:1.2	Mon Nov 19 16:07:56 2012
+++ src/tests/lib/libc/c063/t_utimensat.c	Thu Nov 22 14:51:19 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_utimensat.c,v 1.2 2012/11/19 16:07:56 martin Exp $ */
+/*	$NetBSD: t_utimensat.c,v 1.3 2012/11/22 14:51:19 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_utimensat.c,v 1.2 2012/11/19 16:07:56 martin Exp $);
+__RCSID($NetBSD: t_utimensat.c,v 1.3 2012/11/22 14:51:19 martin Exp $);
 
 #include atf-c.h
 #include errno.h
@@ -50,8 +50,8 @@ __RCSID($NetBSD: t_utimensat.c,v 1.2 20
 #define FILEERR dir/symlink
 
 const struct timespec tptr[] = { 
-	{ 0x12345678, 0x87654321 },
-	{ 0x15263748, 0x84736251 },
+	{ 0x12345678, 987654321 },
+	{ 0x15263748, 123456789 },
 };
 
 ATF_TC_WITH_CLEANUP(utimensat_fd);
@@ -75,10 +75,10 @@ ATF_TC_BODY(utimensat_fd, tc)
 	ATF_REQUIRE(close(dfd) == 0);
 
 	ATF_REQUIRE(stat(FILE, st) == 0);
-	ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[1].tv_sec);
-	ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[1].tv_nsec);
-	ATF_REQUIRE(st.st_ctimespec.tv_sec == tptr[2].tv_sec);
-	ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[2].tv_nsec);
+	ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[0].tv_sec);
+	ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[0].tv_nsec);
+	ATF_REQUIRE(st.st_ctimespec.tv_sec == tptr[1].tv_sec);
+	ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[1].tv_nsec);
 }
 
 ATF_TC_CLEANUP(utimensat_fd, tc)
@@ -108,10 +108,10 @@ ATF_TC_BODY(utimensat_fdcwd, tc)
 	ATF_REQUIRE(utimensat(AT_FDCWD, BASEFILE, tptr, 0) == 0);
 
 	ATF_REQUIRE(stat(BASEFILE, st) == 0);
-	ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[1].tv_sec);
-	ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[1].tv_nsec);
-	ATF_REQUIRE(st.st_ctimespec.tv_sec == tptr[2].tv_sec);
-	ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[2].tv_nsec);
+	ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[0].tv_sec);
+	ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[0].tv_nsec);
+	ATF_REQUIRE(st.st_ctimespec.tv_sec == tptr[1].tv_sec);
+	ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[1].tv_nsec);
 }
 
 ATF_TC_CLEANUP(utimensat_fdcwd, tc)
@@ -240,10 +240,10 @@ ATF_TC_BODY(utimensat_fdlink, tc)
 	ATF_REQUIRE(close(dfd) == 0);
 
 	ATF_REQUIRE(lstat(LINK, st) == 0);
-	ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[1].tv_sec);
-	ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[1].tv_nsec);
-	ATF_REQUIRE(st.st_ctimespec.tv_sec == tptr[2].tv_sec);
-	ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[2].tv_nsec);
+	ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[0].tv_sec);
+	ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[0].tv_nsec);
+	ATF_REQUIRE(st.st_ctimespec.tv_sec == tptr[1].tv_sec);
+	ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[1].tv_nsec);
 }
 
 ATF_TC_CLEANUP(utimensat_fdlink, tc)



CVS commit: src/tests/lib/libc/c063

2012-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 22 14:59:59 UTC 2012

Modified Files:
src/tests/lib/libc/c063: t_utimensat.c

Log Message:
Compare against modification time instead of creation time - which we did
not set.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/c063/t_utimensat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/c063/t_utimensat.c
diff -u src/tests/lib/libc/c063/t_utimensat.c:1.3 src/tests/lib/libc/c063/t_utimensat.c:1.4
--- src/tests/lib/libc/c063/t_utimensat.c:1.3	Thu Nov 22 14:51:19 2012
+++ src/tests/lib/libc/c063/t_utimensat.c	Thu Nov 22 14:59:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_utimensat.c,v 1.3 2012/11/22 14:51:19 martin Exp $ */
+/*	$NetBSD: t_utimensat.c,v 1.4 2012/11/22 14:59:59 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_utimensat.c,v 1.3 2012/11/22 14:51:19 martin Exp $);
+__RCSID($NetBSD: t_utimensat.c,v 1.4 2012/11/22 14:59:59 martin Exp $);
 
 #include atf-c.h
 #include errno.h
@@ -77,8 +77,8 @@ ATF_TC_BODY(utimensat_fd, tc)
 	ATF_REQUIRE(stat(FILE, st) == 0);
 	ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[0].tv_sec);
 	ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[0].tv_nsec);
-	ATF_REQUIRE(st.st_ctimespec.tv_sec == tptr[1].tv_sec);
-	ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[1].tv_nsec);
+	ATF_REQUIRE(st.st_mtimespec.tv_sec == tptr[1].tv_sec);
+	ATF_REQUIRE(st.st_mtimespec.tv_nsec == tptr[1].tv_nsec);
 }
 
 ATF_TC_CLEANUP(utimensat_fd, tc)
@@ -110,8 +110,8 @@ ATF_TC_BODY(utimensat_fdcwd, tc)
 	ATF_REQUIRE(stat(BASEFILE, st) == 0);
 	ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[0].tv_sec);
 	ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[0].tv_nsec);
-	ATF_REQUIRE(st.st_ctimespec.tv_sec == tptr[1].tv_sec);
-	ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[1].tv_nsec);
+	ATF_REQUIRE(st.st_mtimespec.tv_sec == tptr[1].tv_sec);
+	ATF_REQUIRE(st.st_mtimespec.tv_nsec == tptr[1].tv_nsec);
 }
 
 ATF_TC_CLEANUP(utimensat_fdcwd, tc)
@@ -242,8 +242,8 @@ ATF_TC_BODY(utimensat_fdlink, tc)
 	ATF_REQUIRE(lstat(LINK, st) == 0);
 	ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[0].tv_sec);
 	ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[0].tv_nsec);
-	ATF_REQUIRE(st.st_ctimespec.tv_sec == tptr[1].tv_sec);
-	ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[1].tv_nsec);
+	ATF_REQUIRE(st.st_mtimespec.tv_sec == tptr[1].tv_sec);
+	ATF_REQUIRE(st.st_mtimespec.tv_nsec == tptr[1].tv_nsec);
 }
 
 ATF_TC_CLEANUP(utimensat_fdlink, tc)



CVS commit: src/tests/lib/libc/c063

2012-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 22 20:17:48 UTC 2012

Modified Files:
src/tests/lib/libc/c063: t_readlinkat.c

Log Message:
0-terminate strings returned by readlinkat


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/c063/t_readlinkat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/c063/t_readlinkat.c
diff -u src/tests/lib/libc/c063/t_readlinkat.c:1.1 src/tests/lib/libc/c063/t_readlinkat.c:1.2
--- src/tests/lib/libc/c063/t_readlinkat.c:1.1	Sun Nov 18 17:41:54 2012
+++ src/tests/lib/libc/c063/t_readlinkat.c	Thu Nov 22 20:17:48 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_readlinkat.c,v 1.1 2012/11/18 17:41:54 manu Exp $ */
+/*	$NetBSD: t_readlinkat.c,v 1.2 2012/11/22 20:17:48 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_readlinkat.c,v 1.1 2012/11/18 17:41:54 manu Exp $);
+__RCSID($NetBSD: t_readlinkat.c,v 1.2 2012/11/22 20:17:48 martin Exp $);
 
 #include atf-c.h
 #include errno.h
@@ -58,6 +58,7 @@ ATF_TC_BODY(readlinkat_fd, tc)
 {
 	int dfd;
 	int fd;
+	ssize_t len;
 	char buf[MAXPATHLEN];
 
 	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
@@ -66,7 +67,9 @@ ATF_TC_BODY(readlinkat_fd, tc)
 	ATF_REQUIRE(symlink(FILE, LINK) == 0);
 
 	ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1);
-	ATF_REQUIRE(readlinkat(dfd, BASELINK, buf, sizeof(buf)) != -1);
+	len = readlinkat(dfd, BASELINK, buf, sizeof(buf)-1);
+	ATF_REQUIRE(len != -1);
+	buf[len] = 0;
 	ATF_REQUIRE(close(dfd) == 0);
 
 	ATF_REQUIRE(strcmp(buf, FILE) == 0);
@@ -90,6 +93,7 @@ ATF_TC_HEAD(readlinkat_fdcwd, tc)
 ATF_TC_BODY(readlinkat_fdcwd, tc)
 {
 	int fd;
+	ssize_t len;
 	char buf[MAXPATHLEN];
 
 	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
@@ -97,7 +101,9 @@ ATF_TC_BODY(readlinkat_fdcwd, tc)
 	ATF_REQUIRE(close(fd) == 0);
 	ATF_REQUIRE(symlink(FILE, LINK) == 0);
 
-	ATF_REQUIRE(readlinkat(AT_FDCWD, LINK, buf, sizeof(buf)) != -1);
+	len = readlinkat(AT_FDCWD, LINK, buf, sizeof(buf)-1);
+	ATF_REQUIRE(len != -1);
+	buf[len] = 0;
 
 	ATF_REQUIRE(strcmp(buf, FILE) == 0);
 }



CVS commit: src/tests/lib/libc/c063

2012-11-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 20 20:01:14 UTC 2012

Modified Files:
src/tests/lib/libc/c063: t_fchownat.c t_mknodat.c

Log Message:
Mark a few tests that require root


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/c063/t_fchownat.c \
src/tests/lib/libc/c063/t_mknodat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/c063/t_fchownat.c
diff -u src/tests/lib/libc/c063/t_fchownat.c:1.1 src/tests/lib/libc/c063/t_fchownat.c:1.2
--- src/tests/lib/libc/c063/t_fchownat.c:1.1	Sun Nov 18 17:41:54 2012
+++ src/tests/lib/libc/c063/t_fchownat.c	Tue Nov 20 20:01:14 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fchownat.c,v 1.1 2012/11/18 17:41:54 manu Exp $ */
+/*	$NetBSD: t_fchownat.c,v 1.2 2012/11/20 20:01:14 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_fchownat.c,v 1.1 2012/11/18 17:41:54 manu Exp $);
+__RCSID($NetBSD: t_fchownat.c,v 1.2 2012/11/20 20:01:14 martin Exp $);
 
 #include atf-c.h
 #include errno.h
@@ -69,6 +69,7 @@ ATF_TC_WITH_CLEANUP(fchownat_fd);
 ATF_TC_HEAD(fchownat_fd, tc)
 {
 	atf_tc_set_md_var(tc, descr, See that fchownat works with fd);
+	atf_tc_set_md_var(tc, require.user, root);
 }
 
 ATF_TC_BODY(fchownat_fd, tc)
@@ -105,6 +106,7 @@ ATF_TC_HEAD(fchownat_fdcwd, tc)
 {
 	atf_tc_set_md_var(tc, descr, 
 			  See that fchownat works with fd as AT_FDCWD);
+	atf_tc_set_md_var(tc, require.user, root);
 }
 
 ATF_TC_BODY(fchownat_fdcwd, tc)
@@ -139,6 +141,7 @@ ATF_TC_HEAD(fchownat_fdcwderr, tc)
 {
 	atf_tc_set_md_var(tc, descr, 
 		  See that fchownat fails with fd as AT_FDCWD and bad path);
+	atf_tc_set_md_var(tc, require.user, root);
 }
 
 ATF_TC_BODY(fchownat_fdcwderr, tc)
@@ -162,6 +165,7 @@ ATF_TC_WITH_CLEANUP(fchownat_fderr1);
 ATF_TC_HEAD(fchownat_fderr1, tc)
 {
 	atf_tc_set_md_var(tc, descr, See that fchownat fail with bad path);
+	atf_tc_set_md_var(tc, require.user, root);
 }
 
 ATF_TC_BODY(fchownat_fderr1, tc)
@@ -188,6 +192,7 @@ ATF_TC_WITH_CLEANUP(fchownat_fderr2);
 ATF_TC_HEAD(fchownat_fderr2, tc)
 {
 	atf_tc_set_md_var(tc, descr, See that fchownat fails with bad fdat);
+	atf_tc_set_md_var(tc, require.user, root);
 }
 
 ATF_TC_BODY(fchownat_fderr2, tc)
@@ -219,6 +224,7 @@ ATF_TC_WITH_CLEANUP(fchownat_fderr3);
 ATF_TC_HEAD(fchownat_fderr3, tc)
 {
 	atf_tc_set_md_var(tc, descr, See that fchownat fails with fd as -1);
+	atf_tc_set_md_var(tc, require.user, root);
 }
 
 ATF_TC_BODY(fchownat_fderr3, tc)
@@ -246,6 +252,7 @@ ATF_TC_WITH_CLEANUP(fchownat_fdlink);
 ATF_TC_HEAD(fchownat_fdlink, tc)
 {
 	atf_tc_set_md_var(tc, descr, See that fchownat works on symlink);
+	atf_tc_set_md_var(tc, require.user, root);
 }
 
 ATF_TC_BODY(fchownat_fdlink, tc)
Index: src/tests/lib/libc/c063/t_mknodat.c
diff -u src/tests/lib/libc/c063/t_mknodat.c:1.1 src/tests/lib/libc/c063/t_mknodat.c:1.2
--- src/tests/lib/libc/c063/t_mknodat.c:1.1	Sun Nov 18 17:41:54 2012
+++ src/tests/lib/libc/c063/t_mknodat.c	Tue Nov 20 20:01:14 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mknodat.c,v 1.1 2012/11/18 17:41:54 manu Exp $ */
+/*	$NetBSD: t_mknodat.c,v 1.2 2012/11/20 20:01:14 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_mknodat.c,v 1.1 2012/11/18 17:41:54 manu Exp $);
+__RCSID($NetBSD: t_mknodat.c,v 1.2 2012/11/20 20:01:14 martin Exp $);
 
 #include atf-c.h
 #include errno.h
@@ -65,6 +65,7 @@ ATF_TC_WITH_CLEANUP(mknodat_fd);
 ATF_TC_HEAD(mknodat_fd, tc)
 {
 	atf_tc_set_md_var(tc, descr, See that mknodat works with fd);
+	atf_tc_set_md_var(tc, require.user, root);
 }
 
 ATF_TC_BODY(mknodat_fd, tc)
@@ -95,6 +96,7 @@ ATF_TC_HEAD(mknodat_fdcwd, tc)
 {
 	atf_tc_set_md_var(tc, descr, 
 			  See that mknodat works with fd as AT_FDCWD);
+	atf_tc_set_md_var(tc, require.user, root);
 }
 
 ATF_TC_BODY(mknodat_fdcwd, tc)
@@ -122,6 +124,7 @@ ATF_TC_HEAD(mknodat_fdcwderr, tc)
 {
 	atf_tc_set_md_var(tc, descr, 
 		  See that mknodat fails with fd as AT_FDCWD and bad path);
+	atf_tc_set_md_var(tc, require.user, root);
 }
 
 ATF_TC_BODY(mknodat_fdcwderr, tc)
@@ -145,6 +148,7 @@ ATF_TC_WITH_CLEANUP(mknodat_fderr);
 ATF_TC_HEAD(mknodat_fderr, tc)
 {
 	atf_tc_set_md_var(tc, descr, See that mknodat fails with fd as -1);
+	atf_tc_set_md_var(tc, require.user, root);
 }
 
 ATF_TC_BODY(mknodat_fderr, tc)



CVS commit: src/tests/lib/libc/c063

2012-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 19 16:07:56 UTC 2012

Modified Files:
src/tests/lib/libc/c063: t_utimensat.c

Log Message:
Do not require tv_nsec to be != 0 but instead require equality with the
test value.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/c063/t_utimensat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/c063/t_utimensat.c
diff -u src/tests/lib/libc/c063/t_utimensat.c:1.1 src/tests/lib/libc/c063/t_utimensat.c:1.2
--- src/tests/lib/libc/c063/t_utimensat.c:1.1	Sun Nov 18 17:41:54 2012
+++ src/tests/lib/libc/c063/t_utimensat.c	Mon Nov 19 16:07:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_utimensat.c,v 1.1 2012/11/18 17:41:54 manu Exp $ */
+/*	$NetBSD: t_utimensat.c,v 1.2 2012/11/19 16:07:56 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_utimensat.c,v 1.1 2012/11/18 17:41:54 manu Exp $);
+__RCSID($NetBSD: t_utimensat.c,v 1.2 2012/11/19 16:07:56 martin Exp $);
 
 #include atf-c.h
 #include errno.h
@@ -75,10 +75,10 @@ ATF_TC_BODY(utimensat_fd, tc)
 	ATF_REQUIRE(close(dfd) == 0);
 
 	ATF_REQUIRE(stat(FILE, st) == 0);
-	ATF_REQUIRE(st.st_atimespec.tv_sec = tptr[1].tv_sec);
-	ATF_REQUIRE(st.st_atimespec.tv_nsec = tptr[1].tv_nsec);
-	ATF_REQUIRE(st.st_ctimespec.tv_sec = tptr[2].tv_sec);
-	ATF_REQUIRE(st.st_ctimespec.tv_nsec = tptr[2].tv_nsec);
+	ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[1].tv_sec);
+	ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[1].tv_nsec);
+	ATF_REQUIRE(st.st_ctimespec.tv_sec == tptr[2].tv_sec);
+	ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[2].tv_nsec);
 }
 
 ATF_TC_CLEANUP(utimensat_fd, tc)
@@ -108,10 +108,10 @@ ATF_TC_BODY(utimensat_fdcwd, tc)
 	ATF_REQUIRE(utimensat(AT_FDCWD, BASEFILE, tptr, 0) == 0);
 
 	ATF_REQUIRE(stat(BASEFILE, st) == 0);
-	ATF_REQUIRE(st.st_atimespec.tv_sec = tptr[1].tv_sec);
-	ATF_REQUIRE(st.st_atimespec.tv_nsec = tptr[1].tv_nsec);
-	ATF_REQUIRE(st.st_ctimespec.tv_sec = tptr[2].tv_sec);
-	ATF_REQUIRE(st.st_ctimespec.tv_nsec = tptr[2].tv_nsec);
+	ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[1].tv_sec);
+	ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[1].tv_nsec);
+	ATF_REQUIRE(st.st_ctimespec.tv_sec == tptr[2].tv_sec);
+	ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[2].tv_nsec);
 }
 
 ATF_TC_CLEANUP(utimensat_fdcwd, tc)
@@ -240,10 +240,10 @@ ATF_TC_BODY(utimensat_fdlink, tc)
 	ATF_REQUIRE(close(dfd) == 0);
 
 	ATF_REQUIRE(lstat(LINK, st) == 0);
-	ATF_REQUIRE(st.st_atimespec.tv_sec = tptr[1].tv_sec);
-	ATF_REQUIRE(st.st_atimespec.tv_nsec = tptr[1].tv_nsec);
-	ATF_REQUIRE(st.st_ctimespec.tv_sec = tptr[2].tv_sec);
-	ATF_REQUIRE(st.st_ctimespec.tv_nsec = tptr[2].tv_nsec);
+	ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[1].tv_sec);
+	ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[1].tv_nsec);
+	ATF_REQUIRE(st.st_ctimespec.tv_sec == tptr[2].tv_sec);
+	ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[2].tv_nsec);
 }
 
 ATF_TC_CLEANUP(utimensat_fdlink, tc)