Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/fs/vfs Extend times testcase to check for non null tim...



details:   https://anonhg.NetBSD.org/src/rev/4a0cadaafa66
branches:  trunk
changeset: 778358:4a0cadaafa66
user:      njoly <njoly%NetBSD.org@localhost>
date:      Fri Mar 23 09:58:23 2012 +0000

description:
Extend times testcase to check for non null time values too.

diffstat:

 tests/fs/vfs/t_unpriv.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 56bee9b830c3 -r 4a0cadaafa66 tests/fs/vfs/t_unpriv.c
--- a/tests/fs/vfs/t_unpriv.c   Fri Mar 23 09:42:47 2012 +0000
+++ b/tests/fs/vfs/t_unpriv.c   Fri Mar 23 09:58:23 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_unpriv.c,v 1.6 2012/03/15 12:57:27 njoly Exp $       */
+/*     $NetBSD: t_unpriv.c,v 1.7 2012/03/23 09:58:23 njoly Exp $       */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -121,7 +121,8 @@
 times(const atf_tc_t *tc, const char *mp)
 {
        const char *name = "file.test";
-       int fd;
+       int fd, expect;
+       struct timeval tmv[2];
 
        FSTEST_ENTER();
 
@@ -140,6 +141,17 @@
        if (rump_sys_utimes(name, NULL) == -1)
                atf_tc_fail_errno("utimes");
 
+       rump_pub_lwproc_rfork(RUMP_RFCFDG);
+       if (rump_sys_setuid(1) == -1)
+               atf_tc_fail_errno("setuid");
+       expect = FSTYPE_MSDOS(tc) ? EACCES : EPERM;
+       if (rump_sys_utimes(name, tmv) != -1 || errno != expect)
+               atf_tc_fail_errno("utimes");
+       rump_pub_lwproc_releaselwp();
+
+       if (rump_sys_utimes(name, tmv) == -1)
+               atf_tc_fail_errno("utimes");
+
        if (rump_sys_unlink(name) == -1)
                atf_tc_fail_errno("unlink");
 



Home | Main Index | Thread Index | Old Index