Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/fs/vfs Don't pass an uninitialized variable as the tim...
details: https://anonhg.NetBSD.org/src/rev/7d47c08686e0
branches: trunk
changeset: 331895:7d47c08686e0
user: gson <gson%NetBSD.org@localhost>
date: Fri Aug 29 17:39:18 2014 +0000
description:
Don't pass an uninitialized variable as the times[] argument of
rump_sys_utimes(). Instead, pass combinations of values representing
edge cases: the farthest possible past, the epoch, and the farthest
possible future. Now the excessive runtime reported in PR bin/49144
occurs reliably, on multiple architectures, and not only with udf, but
also with msdosfs.
diffstat:
tests/fs/vfs/t_unpriv.c | 31 ++++++++++++++++++++++---------
1 files changed, 22 insertions(+), 9 deletions(-)
diffs (61 lines):
diff -r 98019f26f256 -r 7d47c08686e0 tests/fs/vfs/t_unpriv.c
--- a/tests/fs/vfs/t_unpriv.c Fri Aug 29 15:55:44 2014 +0000
+++ b/tests/fs/vfs/t_unpriv.c Fri Aug 29 17:39:18 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_unpriv.c,v 1.10 2013/03/16 05:45:37 jmmv Exp $ */
+/* $NetBSD: t_unpriv.c,v 1.11 2014/08/29 17:39:18 gson Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,6 +31,7 @@
#include <atf-c.h>
#include <libgen.h>
+#include <limits.h>
#include <unistd.h>
#include <rump/rump_syscalls.h>
@@ -127,7 +128,13 @@
{
const char *name = "file.test";
int fd;
+ unsigned int i, j;
struct timeval tmv[2];
+ static struct timeval tmvs[] = {
+ { QUAD_MIN, 0 },
+ { 0, 0 },
+ { QUAD_MAX, 999999 }
+ };
FSTEST_ENTER();
@@ -148,15 +155,21 @@
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");
- if (rump_sys_utimes(name, tmv) != -1 || errno != EPERM)
- atf_tc_fail_errno("utimes");
- rump_pub_lwproc_releaselwp();
+ for (i = 0; i < sizeof(tmvs) / sizeof(tmvs[0]); i++) {
+ for (j = 0; j < sizeof(tmvs) / sizeof(tmvs[0]); j++) {
+ tmv[0] = tmvs[i];
+ tmv[1] = tmvs[j];
+ rump_pub_lwproc_rfork(RUMP_RFCFDG);
+ if (rump_sys_setuid(1) == -1)
+ atf_tc_fail_errno("setuid");
+ if (rump_sys_utimes(name, tmv) != -1 || errno != EPERM)
+ atf_tc_fail_errno("utimes");
+ rump_pub_lwproc_releaselwp();
- if (rump_sys_utimes(name, tmv) == -1)
- atf_tc_fail_errno("utimes");
+ 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